Changeset View
Changeset View
Standalone View
Standalone View
scripts/user/account_admin.php
| Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | $user->openTransaction(); | ||||
| } else { | } else { | ||||
| if ($verify_email) { | if ($verify_email) { | ||||
| $user->setIsEmailVerified(1); | $user->setIsEmailVerified(1); | ||||
| $verify_email->setIsVerified($set_verified ? 1 : 0); | $verify_email->setIsVerified($set_verified ? 1 : 0); | ||||
| } | } | ||||
| $editor->updateUser($user, $verify_email); | $editor->updateUser($user, $verify_email); | ||||
| } | } | ||||
| $editor->makeAdminUser($user, $set_admin); | |||||
| $editor->makeSystemAgentUser($user, $set_system_agent); | $editor->makeSystemAgentUser($user, $set_system_agent); | ||||
| $xactions = array(); | |||||
| $xactions[] = id(new PhabricatorUserTransaction()) | |||||
| ->setTransactionType( | |||||
| PhabricatorUserEmpowerTransaction::TRANSACTIONTYPE) | |||||
| ->setNewValue($set_admin); | |||||
| $actor = PhabricatorUser::getOmnipotentUser(); | |||||
| $content_source = PhabricatorContentSource::newForSource( | |||||
| PhabricatorConsoleContentSource::SOURCECONST); | |||||
| $people_application_phid = id(new PhabricatorPeopleApplication())->getPHID(); | |||||
| $transaction_editor = id(new PhabricatorUserTransactionEditor()) | |||||
| ->setActor($actor) | |||||
| ->setActingAsPHID($people_application_phid) | |||||
| ->setContentSource($content_source) | |||||
| ->setContinueOnMissingFields(true); | |||||
| $transaction_editor->applyTransactions($user, $xactions); | |||||
| $user->saveTransaction(); | $user->saveTransaction(); | ||||
| echo pht('Saved changes.')."\n"; | echo pht('Saved changes.')."\n"; | ||||