Index: trunk/extensions/OpenStackManager/special/SpecialNovaInstance.php |
— | — | @@ -21,12 +21,12 @@ |
22 | 22 | |
23 | 23 | if ( ! $wgUser->isLoggedIn() ) { |
24 | 24 | $this->notLoggedIn(); |
25 | | - return true; |
| 25 | + return; |
26 | 26 | } |
27 | 27 | $this->userLDAP = new OpenStackNovaUser(); |
28 | 28 | if ( ! $this->userLDAP->exists() ) { |
29 | 29 | $this->noCredentials(); |
30 | | - return true; |
| 30 | + return; |
31 | 31 | } |
32 | 32 | $project = $wgRequest->getVal( 'project' ); |
33 | 33 | $userCredentials = $this->userLDAP->getCredentials(); |
— | — | @@ -39,31 +39,31 @@ |
40 | 40 | if ( $action == "create" ) { |
41 | 41 | if ( ! $this->userLDAP->inProject( $project ) ) { |
42 | 42 | $this->notInProject(); |
43 | | - return true; |
| 43 | + return; |
44 | 44 | } |
45 | 45 | $this->createInstance(); |
46 | 46 | } elseif ( $action == "delete" ) { |
47 | 47 | if ( ! $this->userLDAP->inProject( $project ) ) { |
48 | 48 | $this->notInProject(); |
49 | | - return true; |
| 49 | + return; |
50 | 50 | } |
51 | 51 | $this->deleteInstance(); |
52 | 52 | } elseif ( $action == "configure" ) { |
53 | 53 | if ( ! $this->userLDAP->inProject( $project ) ) { |
54 | 54 | $this->notInProject(); |
55 | | - return true; |
| 55 | + return; |
56 | 56 | } |
57 | 57 | $this->configureInstance(); |
58 | 58 | } elseif ( $action == "reboot" ) { |
59 | 59 | if ( ! $this->userLDAP->inProject( $project ) ) { |
60 | 60 | $this->notInProject(); |
61 | | - return true; |
| 61 | + return; |
62 | 62 | } |
63 | 63 | $this->rebootInstance(); |
64 | 64 | } elseif ( $action == "consoleoutput" ) { |
65 | 65 | if ( ! $this->userLDAP->inProject( $project ) ) { |
66 | 66 | $this->notInProject(); |
67 | | - return true; |
| 67 | + return; |
68 | 68 | } |
69 | 69 | $this->getConsoleOutput(); |
70 | 70 | } else { |
— | — | @@ -442,7 +442,7 @@ |
443 | 443 | $project = $wgRequest->getText( 'project' ); |
444 | 444 | if ( ! $this->userLDAP->inRole( 'sysadmin', $project ) ) { |
445 | 445 | $this->notInRole( 'sysadmin' ); |
446 | | - return false; |
| 446 | + return; |
447 | 447 | } |
448 | 448 | $instanceid = $wgRequest->getText( 'instanceid' ); |
449 | 449 | $consoleOutput = $this->userNova->getConsoleOutput( $instanceid ); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaSecurityGroup.php |
— | — | @@ -19,14 +19,14 @@ |
20 | 20 | global $wgRequest, $wgUser; |
21 | 21 | global $wgOpenStackManagerNovaAdminKeys; |
22 | 22 | |
23 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 23 | + if ( !$wgUser->isLoggedIn() ) { |
24 | 24 | $this->notLoggedIn(); |
25 | | - return true; |
| 25 | + return; |
26 | 26 | } |
27 | 27 | $this->userLDAP = new OpenStackNovaUser(); |
28 | 28 | if ( ! $this->userLDAP->exists() ) { |
29 | 29 | $this->noCredentials(); |
30 | | - return true; |
| 30 | + return; |
31 | 31 | } |
32 | 32 | $adminCredentials = $wgOpenStackManagerNovaAdminKeys; |
33 | 33 | $this->adminNova = new OpenStackNovaController( $adminCredentials ); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php |
— | — | @@ -17,14 +17,14 @@ |
18 | 18 | global $wgRequest, $wgUser; |
19 | 19 | global $wgOpenStackManagerNovaAdminKeys; |
20 | 20 | |
21 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 21 | + if ( !$wgUser->isLoggedIn() ) { |
22 | 22 | $this->notLoggedIn(); |
23 | | - return false; |
| 23 | + return; |
24 | 24 | } |
25 | 25 | $this->userLDAP = new OpenStackNovaUser(); |
26 | | - if ( ! $this->userLDAP->exists() ) { |
| 26 | + if ( !$this->userLDAP->exists() ) { |
27 | 27 | $this->noCredentials(); |
28 | | - return true; |
| 28 | + return; |
29 | 29 | } |
30 | 30 | $adminCredentials = $wgOpenStackManagerNovaAdminKeys; |
31 | 31 | $this->adminNova = new OpenStackNovaController( $adminCredentials ); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php |
— | — | @@ -17,9 +17,9 @@ |
18 | 18 | function execute( $par ) { |
19 | 19 | global $wgRequest, $wgUser; |
20 | 20 | |
21 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 21 | + if ( !$wgUser->isLoggedIn() ) { |
22 | 22 | $this->notLoggedIn(); |
23 | | - return false; |
| 23 | + return; |
24 | 24 | } |
25 | 25 | $this->userLDAP = new OpenStackNovaUser(); |
26 | 26 | $action = $wgRequest->getVal( 'action' ); |
— | — | @@ -65,6 +65,7 @@ |
66 | 66 | 'section' => 'project/membership', |
67 | 67 | 'name' => 'member', |
68 | 68 | ); |
| 69 | + $role_keys = array(); |
69 | 70 | foreach ( OpenStackNovaProject::$rolenames as $rolename ) { |
70 | 71 | $role_keys["$rolename"] = $rolename; |
71 | 72 | } |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaDomain.php |
— | — | @@ -17,28 +17,26 @@ |
18 | 18 | global $wgRequest, $wgUser; |
19 | 19 | global $wgOpenStackManagerLDAPRolesIntersect; |
20 | 20 | |
21 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 21 | + if ( !$wgUser->isLoggedIn() ) { |
22 | 22 | $this->notLoggedIn(); |
23 | | - return false; |
| 23 | + return; |
24 | 24 | } |
25 | | - if ( ! $this->userLDAP->exists() ) { |
| 25 | + if ( !$this->userLDAP->exists() ) { |
26 | 26 | $this->noCredentials(); |
27 | | - return false; |
| 27 | + return; |
28 | 28 | } |
29 | 29 | # Must be in the global role |
30 | 30 | if ( $wgOpenStackManagerLDAPRolesIntersect ) { |
31 | 31 | # If roles intersect, we need to require cloudadmins, since |
32 | 32 | # users are required to be in netadmins to manage project |
33 | 33 | # specific netadmin things |
34 | | - if ( ! $this->userLDAP->inGlobalRole( 'cloudadmin' ) ) { |
| 34 | + if ( !$this->userLDAP->inGlobalRole( 'cloudadmin' ) ) { |
35 | 35 | $this->notInRole( 'cloudadmin' ); |
36 | | - return false; |
| 36 | + return; |
37 | 37 | } |
38 | | - } else { |
39 | | - if ( ! $this->userLDAP->inGlobalRole( 'netadmin' ) ) { |
40 | | - $this->notInRole( 'netadmin' ); |
41 | | - return false; |
42 | | - } |
| 38 | + } elseif ( !$this->userLDAP->inGlobalRole( 'netadmin' ) ) { |
| 39 | + $this->notInRole( 'netadmin' ); |
| 40 | + return; |
43 | 41 | } |
44 | 42 | |
45 | 43 | $action = $wgRequest->getVal( 'action' ); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaVolume.php |
— | — | @@ -19,14 +19,14 @@ |
20 | 20 | global $wgRequest, $wgUser; |
21 | 21 | global $wgOpenStackManagerNovaAdminKeys; |
22 | 22 | |
23 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 23 | + if ( !$wgUser->isLoggedIn() ) { |
24 | 24 | $this->notLoggedIn(); |
25 | | - return true; |
| 25 | + return; |
26 | 26 | } |
27 | 27 | $this->userLDAP = new OpenStackNovaUser(); |
28 | | - if ( ! $this->userLDAP->exists() ) { |
| 28 | + if ( !$this->userLDAP->exists() ) { |
29 | 29 | $this->noCredentials(); |
30 | | - return true; |
| 30 | + return; |
31 | 31 | } |
32 | 32 | $project = $wgRequest->getVal( 'project' ); |
33 | 33 | $userCredentials = $this->userLDAP->getCredentials(); |
— | — | @@ -39,25 +39,25 @@ |
40 | 40 | if ( $action == "create" ) { |
41 | 41 | if ( ! $this->userLDAP->inProject( $project ) ) { |
42 | 42 | $this->notInProject(); |
43 | | - return true; |
| 43 | + return; |
44 | 44 | } |
45 | 45 | $this->createVolume(); |
46 | 46 | } elseif ( $action == "delete" ) { |
47 | 47 | if ( ! $this->userLDAP->inProject( $project ) ) { |
48 | 48 | $this->notInProject(); |
49 | | - return true; |
| 49 | + return; |
50 | 50 | } |
51 | 51 | $this->deleteVolume(); |
52 | 52 | } elseif ( $action == "attach" ) { |
53 | 53 | if ( ! $this->userLDAP->inProject( $project ) ) { |
54 | 54 | $this->notInProject(); |
55 | | - return true; |
| 55 | + return; |
56 | 56 | } |
57 | 57 | $this->attachVolume(); |
58 | 58 | } elseif ( $action == "detach" ) { |
59 | 59 | if ( ! $this->userLDAP->inProject( $project ) ) { |
60 | 60 | $this->notInProject(); |
61 | | - return true; |
| 61 | + return; |
62 | 62 | } |
63 | 63 | $this->detachVolume(); |
64 | 64 | } else { |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaKey.php |
— | — | @@ -15,14 +15,14 @@ |
16 | 16 | function execute( $par ) { |
17 | 17 | global $wgRequest, $wgUser; |
18 | 18 | |
19 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 19 | + if ( !$wgUser->isLoggedIn() ) { |
20 | 20 | $this->notLoggedIn(); |
21 | | - return true; |
| 21 | + return; |
22 | 22 | } |
23 | 23 | $this->userLDAP = new OpenStackNovaUser(); |
24 | | - if ( ! $this->userLDAP->exists() ) { |
| 24 | + if ( !$this->userLDAP->exists() ) { |
25 | 25 | $this->noCredentials(); |
26 | | - return true; |
| 26 | + return; |
27 | 27 | } |
28 | 28 | |
29 | 29 | $action = $wgRequest->getVal( 'action' ); |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | $project = $wgRequest->getVal( 'project' ); |
49 | 49 | if ( $project && ! $this->userLDAP->inProject( $project ) ) { |
50 | 50 | $this->notInProject(); |
51 | | - return true; |
| 51 | + return; |
52 | 52 | } |
53 | 53 | $userCredentials = $this->userLDAP->getCredentials(); |
54 | 54 | $this->userNova = new OpenStackNovaController( $userCredentials, $project ); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaPuppetGroup.php |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | |
12 | 12 | if ( ! $wgUser->isLoggedIn() ) { |
13 | 13 | $this->notLoggedIn(); |
14 | | - return false; |
| 14 | + return; |
15 | 15 | } |
16 | 16 | $action = $wgRequest->getVal( 'action' ); |
17 | 17 | if ( $action == "create" ) { |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaRole.php |
— | — | @@ -17,9 +17,9 @@ |
18 | 18 | function execute( $par ) { |
19 | 19 | global $wgRequest, $wgUser; |
20 | 20 | |
21 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 21 | + if ( !$wgUser->isLoggedIn() ) { |
22 | 22 | $this->notLoggedIn(); |
23 | | - return false; |
| 23 | + return; |
24 | 24 | } |
25 | 25 | $this->userLDAP = new OpenStackNovaUser(); |
26 | 26 | $action = $wgRequest->getVal( 'action' ); |
Index: trunk/extensions/OpenStackManager/special/SpecialNovaSudoer.php |
— | — | @@ -12,13 +12,13 @@ |
13 | 13 | function execute( $par ) { |
14 | 14 | global $wgRequest, $wgUser; |
15 | 15 | |
16 | | - if ( ! $wgUser->isLoggedIn() ) { |
| 16 | + if ( !$wgUser->isLoggedIn() ) { |
17 | 17 | $this->notLoggedIn(); |
18 | | - return false; |
| 18 | + return; |
19 | 19 | } |
20 | | - if ( ! $this->userLDAP->exists() ) { |
| 20 | + if ( !$this->userLDAP->exists() ) { |
21 | 21 | $this->noCredentials(); |
22 | | - return false; |
| 22 | + return; |
23 | 23 | } |
24 | 24 | |
25 | 25 | $action = $wgRequest->getVal( 'action' ); |
Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | /** |
139 | 139 | * Add a member to this project based on username |
140 | 140 | * |
141 | | - * @param $username string |
| 141 | + * @param $username string |
142 | 142 | * @return bool |
143 | 143 | */ |
144 | 144 | function addMember( $username ) { |
— | — | @@ -264,7 +264,6 @@ |
265 | 265 | * Deletes a project based on project name. This function will also delete all roles |
266 | 266 | * associated with the project. |
267 | 267 | * |
268 | | - * @static |
269 | 268 | * @param $projectname String |
270 | 269 | * @return bool |
271 | 270 | */ |
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php |
— | — | @@ -210,6 +210,7 @@ |
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | } |
| 214 | + return false; |
214 | 215 | } |
215 | 216 | |
216 | 217 | /** |
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php |
— | — | @@ -247,9 +247,8 @@ |
248 | 248 | wfRestoreWarnings(); |
249 | 249 | return ( (int)$entries['count'] > 0 ); |
250 | 250 | } |
251 | | - } else { |
252 | | - return false; |
253 | 251 | } |
| 252 | + return false; |
254 | 253 | } |
255 | 254 | |
256 | 255 | /** |
— | — | @@ -474,7 +473,6 @@ |
475 | 474 | */ |
476 | 475 | static function LDAPSetNovaInfo( $auth ) { |
477 | 476 | OpenStackNovaLdapConnection::connect(); |
478 | | - $dn = $auth->userInfo[0]['dn']; |
479 | 477 | wfSuppressWarnings(); |
480 | 478 | $result = ldap_read( $auth->ldapconn, $auth->userInfo[0]['dn'], '(objectclass=*)', array( 'secretkey', 'accesskey', 'objectclass' ) ); |
481 | 479 | $userInfo = ldap_get_entries( $auth->ldapconn, $result ); |