jenkins-bot has submitted this change and it was merged. Change subject: Revert "Do not make an automatic shell request for all new accounts" ......................................................................
Revert "Do not make an automatic shell request for all new accounts" This reverts commit 89b249662fb1192047e6d6104e749331475890d2. Bug: T105353 Change-Id: I41bb19875d81f030ff23c87f375a5102cf77de72 --- M OpenStackManager.php M nova/OpenStackNovaUser.php 2 files changed, 37 insertions(+), 0 deletions(-) Approvals: coren: Looks good to me, approved jenkins-bot: Verified diff --git a/OpenStackManager.php b/OpenStackManager.php index 3f90808..e21d64f 100644 --- a/OpenStackManager.php +++ b/OpenStackManager.php @@ -236,6 +236,7 @@ $wgHooks['DynamicSidebarGetGroups'][] = 'OpenStackNovaUser::DynamicSidebarGetGroups'; $wgHooks['ChainAuth'][] = 'OpenStackNovaUser::ChainAuth'; $wgHooks['GetPreferences'][] = 'OpenStackNovaUser::novaUserPreferences'; +$wgHooks['AddNewAccount'][] = 'OpenStackNovaUser::RequestShellAccess'; $commonModuleInfo = array( 'localBasePath' => dirname( __FILE__ ) . '/modules', diff --git a/nova/OpenStackNovaUser.php b/nova/OpenStackNovaUser.php index 94c81fb..953047d 100644 --- a/nova/OpenStackNovaUser.php +++ b/nova/OpenStackNovaUser.php @@ -424,6 +424,42 @@ } /** + * Create a shell request page for $username + * + * @static + * @param $auth + * @param $username + * @return bool + */ + static function RequestShellAccess( $user, $_byEmail ) { + global $wgAuth; + $username = $user->getName(); + + $titletext = "Shell_Request/" . $username; + $title = Title::newFromText( $titletext ); + $article = WikiPage::factory( $title ); + + if ( $article->exists() ) { + $wgAuth->printDebug( "shell request for " . $username . " already exists.", NONSENSITIVE ); + return false; + } + + $text = "{{Shell Access Request " + . "|Justification=(auto request on account creation) " + . "|Completed=false " + . "|User Name=$username}}"; + + $logbot = User::newFromName( 'labslogbot' ); + if ( ! $logbot ) { + $wgAuth->printDebug( "Failed to get 'labslogbot' user, so unable to create shell request.", NONSENSITIVE ); + } else { + $article->doEdit( $text, 'auto request', 0, false, $logbot ); + } + + return true; + } + + /** * Hook to add objectclasses and attributes for users being created. * * @static -- To view, visit https://gerrit.wikimedia.org/r/223805 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I41bb19875d81f030ff23c87f375a5102cf77de72 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/OpenStackManager Gerrit-Branch: master Gerrit-Owner: Andrew Bogott <abog...@wikimedia.org> Gerrit-Reviewer: Yuvipanda <yuvipa...@gmail.com> Gerrit-Reviewer: coren <mpellet...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits