r79585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79584‎ | r79585 | r79586 >
Date:15:54, 4 January 2011
Author:laner
Status:deferred
Tags:
Comment:
Changing LDAP code to use version 2 of the openstack LDAP schema
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php
@@ -27,7 +27,7 @@
2828
2929 wfSuppressWarnings();
3030 $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN,
31 - '(&(cn=' . $this->projectname . ')(projectManager=*))' );
 31+ '(&(cn=' . $this->projectname . ')(owner=*))' );
3232 $this->projectInfo = ldap_get_entries( $wgAuth->ldapconn, $result );
3333 wfRestoreWarnings();
3434 $this->projectDN = $this->projectInfo[0]['dn'];
@@ -126,7 +126,7 @@
127127
128128 $projects = array();
129129 wfSuppressWarnings();
130 - $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, '(projectManager=*)' );
 130+ $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, '(owner=*)' );
131131 wfRestoreWarnings();
132132 if ( $result ) {
133133 wfSuppressWarnings();
@@ -153,11 +153,10 @@
154154 $wgAuth->connect();
155155 $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword );
156156
157 - $project['objectclass'][] = 'novaproject';
158157 $project['objectclass'][] = 'groupofnames';
159158 $project['objectclass'][] = 'posixgroup';
160159 $project['cn'] = $projectname;
161 - $project['projectmanager'] = $wgOpenStackManagerLDAPUser;
 160+ $project['owner'] = $wgOpenStackManagerLDAPUser;
162161 $project['gidnumber'] = OpenStackNovaUser::getNextIdNumber( $wgAuth, 'gidnumber' );
163162 $dn = 'cn=' . $projectname . ',' . $wgOpenStackManagerLDAPProjectBaseDN;
164163
@@ -215,7 +214,7 @@
216215 $wgAuth->connect( $wgOpenStackManagerLDAPDomain );
217216 $wgAuth->bindAs( $wgOpenStackManagerLDAPUser, $wgOpenStackManagerLDAPUserPassword );
218217
219 - $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, 'projectmanager=*' );
 218+ $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, 'owner=*' );
220219 $entries = ldap_get_entries( $wgAuth->ldapconn, $result );
221220 if ( $entries ) {
222221 array_shift($entries);
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php
@@ -58,8 +58,8 @@
5959 }
6060
6161 function isAdmin() {
62 - if ( isset( $this->userInfo[0]['isadmin'] ) ) {
63 - $isAdmin = $this->userInfo[0]['isadmin'][0];
 62+ if ( isset( $this->userInfo[0]['isnovaadmin'] ) ) {
 63+ $isAdmin = $this->userInfo[0]['isnovaadmin'][0];
6464 if ( strtolower( $isAdmin ) == "true" ) {
6565 return true;
6666 }
@@ -82,10 +82,10 @@
8383
8484 $this->connect();
8585
86 - # All projects have a projectManager attribute, project
 86+ # All projects have a owner attribute, project
8787 # roles do not
8888 $projects = array();
89 - $filter = "(&(projectManager=*)(member=$this->userDN))";
 89+ $filter = "(&(owner=*)(member=$this->userDN))";
9090 wfSuppressWarnings();
9191 $result = ldap_search( $wgAuth->ldapconn, $wgOpenStackManagerLDAPProjectBaseDN, $filter );
9292 wfRestoreWarnings();
@@ -280,7 +280,7 @@
281281 $values['objectclass'][] = 'shadowaccount';
282282 $values['accesskey'] = OpenStackNovaUser::uuid4();
283283 $values['secretkey'] = OpenStackNovaUser::uuid4();
284 - $values['isadmin'] = 'FALSE';
 284+ $values['isnovaadmin'] = 'FALSE';
285285 $uidnumber = OpenStackNovaUser::getNextIdNumber( $auth, 'uidnumber' );
286286 if ( ! $uidnumber ) {
287287 $result = false;

Status & tagging log