http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95942
Revision: 95942
Author: laner
Date: 2011-09-01 07:11:39 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
Fixing objectclass handling
Modified Paths:
--------------
trunk/extensions/OpenStackManager/OpenStackNovaUser.php
Modified: trunk/extensions/OpenStackManager/OpenStackNovaUser.php
===================================================================
--- trunk/extensions/OpenStackManager/OpenStackNovaUser.php 2011-09-01
07:09:51 UTC (rev 95941)
+++ trunk/extensions/OpenStackManager/OpenStackNovaUser.php 2011-09-01
07:11:39 UTC (rev 95942)
@@ -489,9 +489,18 @@
* @return bool
*/
static function LDAPSetNovaInfo( $auth ) {
+ OpenStackNovaUser::connect();
if ( !isset( $auth->userInfo[0]['accesskey'] ) or !isset(
$auth->userInfo[0]['secretkey'] ) ) {
- if ( !in_array( 'novauser',
$auth->userInfo[0]['objectclass'] ) ) {
- $values['objectclass'] =
$auth->userInfo[0]['objectclass'];
+ $objectclasses = $auth->userInfo[0]['objectclass'];
+ # First entry is a count
+ array_shift( $objectclasses );
+ if ( !in_array( 'novauser', $objectclasses ) ) {
+ $values['objectclass'] = array();
+ # ldap_modify for objectclasses requires the
array indexes be sequential.
+ # It is stupid, yes.
+ foreach ( $objectclasses as $objectclass ) {
+ $values['objectclass'][] = $objectclass;
+ }
$values['objectclass'][] = 'novauser';
}
$values['accesskey'] = OpenStackNovaUser::uuid4();
@@ -505,7 +514,7 @@
$auth->printDebug( "Successfully modified the
user's nova attributes", NONSENSITIVE );
return true;
} else {
- $auth->printDebug( "Failed to modify the user's
nova attributes", NONSENSITIVE );
+ $auth->printDebug( "Failed to modify the user's
nova attributes.", NONSENSITIVE );
# Always return true, other hooks should still
run, even if this fails
return true;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs