|
eZ Publish
[4.0]
|
00001 <?php 00002 // 00003 // Definition of Ldapusermanage class 00004 // 00005 // Created on: <28-Jul-2003 15:12:08 wy> 00006 // 00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00008 // SOFTWARE NAME: eZ Publish 00009 // SOFTWARE RELEASE: 4.0.x 00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS 00011 // SOFTWARE LICENSE: GNU General Public License v2.0 00012 // NOTICE: > 00013 // This program is free software; you can redistribute it and/or 00014 // modify it under the terms of version 2.0 of the GNU General 00015 // Public License as published by the Free Software Foundation. 00016 // 00017 // This program is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU General Public License for more details. 00021 // 00022 // You should have received a copy of version 2.0 of the GNU General 00023 // Public License along with this program; if not, write to the Free 00024 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00025 // MA 02110-1301, USA. 00026 // 00027 // 00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ## 00029 // 00030 00031 /*! \file ldapusermanage.php 00032 */ 00033 00034 //include_once( "lib/ezdb/classes/ezdb.php" ); 00035 //include_once( 'lib/ezutils/classes/ezini.php' ); 00036 //include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' ); 00037 //include_once( 'kernel/classes/datatypes/ezuser/ezusersetting.php' ); 00038 //include_once( 'kernel/classes/ezcontentobject.php' ); 00039 00040 if ( !$isQuiet ) 00041 $cli->output( "Checking LDAP users ..." ); 00042 00043 // fetching ldap users already stored in the database 00044 $db = eZDB::instance(); 00045 $query = "SELECT contentobject_id, login 00046 FROM ezcontentobject, ezuser 00047 WHERE remote_id like 'LDAP%' 00048 AND ezcontentobject.id=contentobject_id"; 00049 $LDAPUsers = $db->arrayQuery( $query ); 00050 00051 // get LDAP ini settings 00052 $ini = eZINI::instance(); 00053 $LDAPIni = eZINI::instance( 'ldap.ini' ); 00054 00055 $LDAPVersion = $LDAPIni->variable( 'LDAPSettings', 'LDAPVersion' ); 00056 $LDAPServer = $LDAPIni->variable( 'LDAPSettings', 'LDAPServer' ); 00057 $LDAPHost = $LDAPServer; 00058 00059 $LDAPPort = $LDAPIni->variable( 'LDAPSettings', 'LDAPPort' ); 00060 $LDAPBaseDN = $LDAPIni->variable( 'LDAPSettings', 'LDAPBaseDn' ); 00061 $LDAPBindUser = $LDAPIni->variable( 'LDAPSettings', 'LDAPBindUser' ); 00062 $LDAPBindPassword = $LDAPIni->variable( 'LDAPSettings', 'LDAPBindPassword' ); 00063 00064 $LDAPSearchScope = $LDAPIni->variable( 'LDAPSettings', 'LDAPSearchScope' ); 00065 $LDAPLoginAttribute = $LDAPIni->variable( 'LDAPSettings', 'LDAPLoginAttribute' ); 00066 $LDAPLogin = $LDAPLoginAttribute; 00067 $LDAPFirstNameAttribute = $LDAPIni->variable( 'LDAPSettings', 'LDAPFirstNameAttribute' ); 00068 $LDAPLastNameAttribute = $LDAPIni->variable( 'LDAPSettings', 'LDAPLastNameAttribute' ); 00069 $LDAPEmailAttribute = $LDAPIni->variable( 'LDAPSettings', 'LDAPEmailAttribute' ); 00070 00071 $defaultUserPlacement = $ini->variable( "UserSettings", "DefaultUserPlacement" ); 00072 00073 $LDAPUserGroupAttributeType = $LDAPIni->variable( 'LDAPSettings', 'LDAPUserGroupAttributeType' ); 00074 $LDAPUserGroupAttribute = $LDAPIni->variable( 'LDAPSettings', 'LDAPUserGroupAttribute' ); 00075 00076 if ( $LDAPIni->hasVariable( 'LDAPSettings', 'Utf8Encoding' ) ) 00077 { 00078 $Utf8Encoding = $LDAPIni->variable( 'LDAPSettings', 'Utf8Encoding' ); 00079 if ( $Utf8Encoding == "true" ) 00080 $isUtf8Encoding = true; 00081 else 00082 $isUtf8Encoding = false; 00083 } 00084 else 00085 { 00086 $isUtf8Encoding = false; 00087 } 00088 00089 if ( $LDAPIni->hasVariable( 'LDAPSettings', 'LDAPSearchFilters' ) ) 00090 { 00091 $LDAPFilters = $LDAPIni->variable( 'LDAPSettings', 'LDAPSearchFilters' ); 00092 } 00093 if ( $LDAPIni->hasVariable( 'LDAPSettings', 'LDAPUserGroupType' ) and $LDAPIni->hasVariable( 'LDAPSettings', 'LDAPUserGroup' ) ) 00094 { 00095 $LDAPUserGroupType = $LDAPIni->variable( 'LDAPSettings', 'LDAPUserGroupType' ); 00096 $LDAPUserGroup = $LDAPIni->variable( 'LDAPSettings', 'LDAPUserGroup' ); 00097 } 00098 00099 $LDAPEqualSign = trim($LDAPIni->variable( 'LDAPSettings', "LDAPEqualSign" ) ); 00100 $LDAPBaseDN = str_replace( $LDAPEqualSign, "=", $LDAPBaseDN ); 00101 00102 $retrieveAttributes = array( $LDAPLoginAttribute, 00103 $LDAPFirstNameAttribute, 00104 $LDAPLastNameAttribute, 00105 $LDAPEmailAttribute ); 00106 if ( $LDAPUserGroupAttributeType ) 00107 $retrieveAttributes[] = $LDAPUserGroupAttribute; 00108 00109 00110 $extraNodeAssignments = array(); 00111 if ( $LDAPUserGroupType != null ) 00112 { 00113 if ( $LDAPUserGroupType == "name" ) 00114 { 00115 if ( is_array( $LDAPUserGroup ) ) 00116 { 00117 foreach ( array_keys( $LDAPUserGroup ) as $key ) 00118 { 00119 $groupName = $LDAPUserGroup[$key]; 00120 $db->escapeString( $groupName ); 00121 $groupQuery = "SELECT ezcontentobject_tree.node_id 00122 FROM ezcontentobject, ezcontentobject_tree 00123 WHERE ezcontentobject.name like '$groupName' 00124 AND ezcontentobject.id=ezcontentobject_tree.contentobject_id 00125 AND ezcontentobject.contentclass_id=3"; 00126 $groupObject = $db->arrayQuery( $groupQuery ); 00127 if ( count( $groupObject ) > 0 and $key == 0 ) 00128 { 00129 $defaultUserPlacement = $groupObject[0]['node_id']; 00130 } 00131 else if ( count( $groupObject ) > 0 ) 00132 { 00133 $extraNodeAssignments[] = $groupObject[0]['node_id']; 00134 } 00135 } 00136 } 00137 else 00138 { 00139 $groupName = $LDAPUserGroup; 00140 $db->escapeString( $groupName ); 00141 $groupQuery = "SELECT ezcontentobject_tree.node_id 00142 FROM ezcontentobject, ezcontentobject_tree 00143 WHERE ezcontentobject.name like '$groupName' 00144 AND ezcontentobject.id=ezcontentobject_tree.contentobject_id 00145 AND ezcontentobject.contentclass_id=3"; 00146 $groupObject = $db->arrayQuery( $groupQuery ); 00147 00148 if ( count( $groupObject ) > 0 ) 00149 { 00150 $defaultUserPlacement = $groupObject[0]['node_id']; 00151 } 00152 } 00153 } 00154 else if ( $LDAPUserGroupType == "id" ) 00155 { 00156 if ( is_array( $LDAPUserGroup ) ) 00157 { 00158 foreach ( array_keys( $LDAPUserGroup ) as $key ) 00159 { 00160 $groupID =(int) $LDAPUserGroup[$key]; 00161 $groupQuery = "SELECT ezcontentobject_tree.node_id 00162 FROM ezcontentobject, ezcontentobject_tree 00163 WHERE ezcontentobject.id='$groupID' 00164 AND ezcontentobject.id=ezcontentobject_tree.contentobject_id 00165 AND ezcontentobject.contentclass_id=3"; 00166 $groupObject = $db->arrayQuery( $groupQuery ); 00167 if ( count( $groupObject ) > 0 and $key == 0 ) 00168 { 00169 $defaultUserPlacement = $groupObject[0]['node_id']; 00170 } 00171 else if ( count( $groupObject ) > 0 ) 00172 { 00173 $extraNodeAssignments[] = $groupObject[0]['node_id']; 00174 } 00175 } 00176 } 00177 else 00178 { 00179 $groupID =(int) $LDAPUserGroup; 00180 $groupQuery = "SELECT ezcontentobject_tree.node_id 00181 FROM ezcontentobject, ezcontentobject_tree 00182 WHERE ezcontentobject.id='$groupID' 00183 AND ezcontentobject.id=ezcontentobject_tree.contentobject_id 00184 AND ezcontentobject.contentclass_id=3"; 00185 $groupObject = $db->arrayQuery( $groupQuery ); 00186 00187 if ( count( $groupObject ) > 0 ) 00188 { 00189 $defaultUserPlacement = $groupObject[0]['node_id']; 00190 } 00191 } 00192 } 00193 } 00194 00195 //connect to LDAP server 00196 $ds = ldap_connect( $LDAPHost, $LDAPPort ); 00197 if ( $ds ) 00198 { 00199 ldap_set_option( $ds, LDAP_OPT_PROTOCOL_VERSION, $LDAPVersion ); 00200 if ( $LDAPBindUser == '' ) 00201 { 00202 $r = ldap_bind( $ds ); 00203 } 00204 else 00205 { 00206 $r = ldap_bind( $ds, $LDAPBindUser, $LDAPBindPassword ); 00207 } 00208 if ( !$r ) 00209 { 00210 eZDebug::writeError( 'Cannot bind in to LDAP server', 'ldapusermanage.php' ); 00211 return false; 00212 } 00213 ldap_set_option( $ds, LDAP_OPT_SIZELIMIT, 0 ); 00214 ldap_set_option( $ds, LDAP_OPT_TIMELIMIT, 0 ); 00215 } 00216 else 00217 { 00218 eZDebug::writeError( 'Cannot initialize connection for LDAP server', 'ldapusermanage.php' ); 00219 return false; 00220 } 00221 00222 $db->begin(); 00223 foreach ( $LDAPUsers as $LDAPUser ) 00224 { 00225 $login = $LDAPUser['login']; 00226 $userID = $LDAPUser['contentobject_id']; 00227 00228 $LDAPFilter = "( &"; 00229 if ( count( $LDAPFilters ) > 0 ) 00230 { 00231 foreach ( array_keys( $LDAPFilters ) as $key ) 00232 { 00233 $LDAPFilter .= "(" . $LDAPFilters[$key] . ")"; 00234 } 00235 } 00236 $LDAPFilter .= "($LDAPLogin=$login)"; 00237 $LDAPFilter .= ")"; 00238 $LDAPFilter = str_replace( $LDAPEqualSign, "=", $LDAPFilter ); 00239 00240 if ( $LDAPSearchScope == "one" ) 00241 $sr = ldap_list( $ds, $LDAPBaseDN, $LDAPFilter, $retrieveAttributes ); 00242 else if ( $LDAPSearchScope == "base" ) 00243 $sr = ldap_read( $ds, $LDAPBaseDN, $LDAPFilter, $retrieveAttributes ); 00244 else 00245 $sr = ldap_search( $ds, $LDAPBaseDN, $LDAPFilter, $retrieveAttributes ); 00246 00247 $info = ldap_get_entries( $ds, $sr ); 00248 if ( $info["count"] != 1 ) 00249 { 00250 $cli->output( "Disable user " . $cli->stylize( 'emphasize', $login ) ); 00251 // Disable the user 00252 $userSetting = eZUserSetting::fetch( $userID ); 00253 $userSetting->setAttribute( "is_enabled", false ); 00254 $userSetting->store(); 00255 } 00256 else 00257 { 00258 // Update user information 00259 $contentObject = eZContentObject::fetch( $userID ); 00260 00261 $parentNodeID = $contentObject->attribute( 'main_parent_node_id' ); 00262 $currentVersion = $contentObject->attribute( 'current_version' ); 00263 00264 $version = $contentObject->attribute( 'current' ); 00265 $contentObjectAttributes = $version->contentObjectAttributes(); 00266 00267 if ( $isUtf8Encoding ) 00268 { 00269 $firstName = utf8_decode( $info[0][$LDAPFirstNameAttribute][0] ); 00270 $lastName = utf8_decode( $info[0][$LDAPLastNameAttribute][0] ); 00271 $ldapEMail = utf8_decode( $info[0][$LDAPEmailAttribute][0] ); 00272 } 00273 else 00274 { 00275 $firstName = $info[0][$LDAPFirstNameAttribute][0]; 00276 $lastName = $info[0][$LDAPLastNameAttribute][0]; 00277 $ldapEMail = $info[0][$LDAPEmailAttribute][0]; 00278 } 00279 00280 $contentObjectAttributes[0]->setAttribute( 'data_text', $firstName ); 00281 $contentObjectAttributes[0]->store(); 00282 00283 $contentObjectAttributes[1]->setAttribute( 'data_text', $lastName ); 00284 $contentObjectAttributes[1]->store(); 00285 00286 $contentClass = $contentObject->attribute( 'content_class' ); 00287 $name = $contentClass->contentObjectName( $contentObject ); 00288 $contentObject->setName( $name ); 00289 00290 $existUser = eZUser::fetch( $userID ); 00291 $existUser->setAttribute('email', $ldapEMail ); 00292 $existUser->setAttribute('password_hash', "" ); 00293 $existUser->setAttribute('password_hash_type', 0 ); 00294 $existUser->store(); 00295 00296 // If user has changed to another group, update it. 00297 if ( $LDAPUserGroupAttributeType != null ) 00298 { 00299 $republishRequired = false; 00300 $IsLDAPMain = true; 00301 $hasOtherNodeType = false; 00302 $hasLDAPNodeType = false; 00303 $otherNodeArray = array(); 00304 $LDAPNodeArray = array(); 00305 $newLDAPNodeArray = array(); 00306 $parentNodes = $contentObject->parentNodes( $currentVersion ); 00307 foreach( $parentNodes as $parentNode ) 00308 { 00309 $parentNodeID = $parentNode->attribute( 'node_id' ); 00310 $parentNodeName = $parentNode->attribute( 'name' ); 00311 $nodeAssignment = eZNodeAssignment::fetch( $contentObject->attribute( 'id' ), $currentVersion, $parentNodeID ); 00312 $isMain = $nodeAssignment->attribute( 'is_main' ); 00313 $remoteID = $nodeAssignment->attribute( 'parent_remote_id' ); 00314 if ( preg_match( "/LDAP/i", $remoteID ) ) 00315 { 00316 $LDAPNodeArray[] = array( 'parent_node_name' => $parentNodeName, 'parent_node_id' => $parentNodeID, 'is_main' => $isMain ); 00317 } 00318 else 00319 { 00320 $otherNodeArray[] = array( 'parent_node_name' => $parentNodeName, 'parent_node_id' => $parentNodeID, 'is_main' => $isMain ); 00321 $hasOtherNodeType = true; 00322 if ( $isMain ) 00323 { 00324 $IsLDAPMain = false; 00325 } 00326 } 00327 } 00328 $LDAPUserGroupCount = count( $LDAPNodeArray ); 00329 $groupAttributeCount = $info[0][$LDAPUserGroupAttribute]['count']; 00330 00331 if ( $LDAPUserGroupAttributeType == "name" ) 00332 { 00333 for ( $i = 0; $i < $groupAttributeCount; $i++ ) 00334 { 00335 if ( $isUtf8Encoding ) 00336 { 00337 $groupName = utf8_decode( $info[0][$LDAPUserGroupAttribute][$i] ); 00338 } 00339 else 00340 { 00341 $groupName = $info[0][$LDAPUserGroupAttribute][$i]; 00342 } 00343 $exist = false; 00344 foreach( $LDAPNodeArray as $LDAPNode ) 00345 { 00346 $existGroupName = $LDAPNode['parent_node_name']; 00347 $existGroupID = $LDAPNode['parent_node_id']; 00348 if ( strcasecmp( $existGroupName, $groupName ) == 0 ) 00349 { 00350 $exist = true; 00351 $hasLDAPNodeType = true; 00352 if ( $IsLDAPMain and count( $newLDAPNodeArray ) == 0 ) 00353 { 00354 $newLDAPNodeArray[] = array( 'parent_node_name' => $existGroupName, 'parent_node_id' => $existGroupID, 'is_main' => 1 ); 00355 } 00356 else 00357 { 00358 $newLDAPNodeArray[] = array( 'parent_node_name' => $existGroupName, 'parent_node_id' => $existGroupID, 'is_main' => 0 ); 00359 } 00360 $LDAPUserGroupCount--; 00361 } 00362 } 00363 00364 if ( $exist == false ) 00365 { 00366 $groupName = $db->escapeString( $groupName ); 00367 $groupQuery = "SELECT ezcontentobject_tree.node_id 00368 FROM ezcontentobject, ezcontentobject_tree 00369 WHERE ezcontentobject.name like '$groupName' 00370 AND ezcontentobject.id=ezcontentobject_tree.contentobject_id 00371 AND ezcontentobject.contentclass_id=3"; 00372 $groupObject = $db->arrayQuery( $groupQuery ); 00373 00374 if ( count( $groupObject ) > 0 ) 00375 { 00376 $hasLDAPNodeType = true; 00377 if ( $IsLDAPMain and count( $newLDAPNodeArray ) == 0 ) 00378 { 00379 $newLDAPNodeArray[] = array( 'parent_node_name' => $groupName, 'parent_node_id' => $groupObject[0]['node_id'], 'is_main' => 1 ); 00380 } 00381 else 00382 { 00383 $newLDAPNodeArray[] = array( 'parent_node_name' => $groupName, 'parent_node_id' => $groupObject[0]['node_id'], 'is_main' => 0 ); 00384 } 00385 $republishRequired = true; 00386 } 00387 } 00388 } 00389 00390 if ( $LDAPUserGroupCount != 0 ) 00391 { 00392 $republishRequired = true; 00393 } 00394 } 00395 else if ( $LDAPUserGroupAttributeType == "id" ) 00396 { 00397 for ( $i = 0; $i < $groupAttributeCount; $i++ ) 00398 { 00399 if ( $isUtf8Encoding ) 00400 { 00401 $groupID = utf8_decode( $info[0][$LDAPUserGroupAttribute][$i] ); 00402 } 00403 else 00404 { 00405 $groupID = $info[0][$LDAPUserGroupAttribute][$i]; 00406 } 00407 00408 $groupName = "LDAP " . $groupID; 00409 00410 $exist = false; 00411 foreach( $LDAPNodeArray as $LDAPNode ) 00412 { 00413 $existGroupName = $LDAPNode['parent_node_name']; 00414 $existGroupID = $LDAPNode['parent_node_id']; 00415 if ( strcasecmp( $existGroupName, $groupName ) == 0 ) 00416 { 00417 $exist = true; 00418 $hasLDAPNodeType = true; 00419 if ( $IsLDAPMain and count( $newLDAPNodeArray ) == 0 ) 00420 { 00421 $newLDAPNodeArray[] = array( 'parent_node_name' => $existGroupName, 'parent_node_id' => $existGroupID, 'is_main' => 1 ); 00422 } 00423 else 00424 { 00425 $newLDAPNodeArray[] = array( 'parent_node_name' => $existGroupName, 'parent_node_id' => $existGroupID, 'is_main' => 0 ); 00426 } 00427 $LDAPUserGroupCount--; 00428 } 00429 } 00430 00431 if ( $exist == false ) 00432 { 00433 $groupName = $db->escapeString( $groupName ); 00434 $groupQuery = "SELECT ezcontentobject_tree.node_id 00435 FROM ezcontentobject, ezcontentobject_tree 00436 WHERE ezcontentobject.name like '$groupName' 00437 AND ezcontentobject.id=ezcontentobject_tree.contentobject_id 00438 AND ezcontentobject.contentclass_id=3"; 00439 $groupObject = $db->arrayQuery( $groupQuery ); 00440 00441 if ( count( $groupObject ) > 0 ) 00442 { 00443 $hasLDAPNodeType = true; 00444 if ( $IsLDAPMain and count( $newLDAPNodeArray ) == 0 ) 00445 { 00446 $newLDAPNodeArray[] = array( 'parent_node_name' => $groupName, 'parent_node_id' => $groupObject[0]['node_id'], 'is_main' => 1 ); 00447 } 00448 else 00449 { 00450 $newLDAPNodeArray[] = array( 'parent_node_name' => $groupName, 'parent_node_id' => $groupObject[0]['node_id'], 'is_main' => 0 ); 00451 } 00452 $republishRequired = true; 00453 } 00454 } 00455 } 00456 00457 if ( $LDAPUserGroupCount != 0 ) 00458 { 00459 $republishRequired = true; 00460 } 00461 } 00462 if ( $republishRequired ) 00463 { 00464 $noRemoveAssignmentList = array(); 00465 if ( $hasOtherNodeType ) 00466 { 00467 foreach ( $otherNodeArray as $otherNode ) 00468 { 00469 $noRemoveAssignmentList[$otherNode['parent_node_id']] = $otherNode['is_main']; 00470 } 00471 } 00472 00473 if ( $hasLDAPNodeType ) 00474 { 00475 foreach ( $newLDAPNodeArray as $newLDAPNode ) 00476 { 00477 $noRemoveAssignmentList[$newLDAPNode['parent_node_id']] = $newLDAPNode['is_main']; 00478 } 00479 } 00480 00481 if ( !$hasOtherNodeType and !$hasLDAPNodeType ) 00482 { 00483 $noRemoveAssignmentList[$defaultUserPlacement] = 1; 00484 } 00485 00486 $newVersion = $contentObject->createNewVersion(); 00487 $newVersionNr = $newVersion->attribute( 'version' ); 00488 $nodeAssignmentList = $newVersion->attribute( 'node_assignments' ); 00489 $noAddAssignmentList = array(); 00490 foreach ( $nodeAssignmentList as $nodeAssignment ) 00491 { 00492 $parentNodeID = $nodeAssignment->attribute( 'parent_node' ); 00493 if ( array_key_exists( $parentNodeID, $noRemoveAssignmentList ) ) 00494 { 00495 $noAddAssignmentList[] = $parentNodeID; 00496 $nodeAssignment->setAttribute( 'parent_remote_id', uniqid( 'LDAP_' ) ); 00497 $nodeAssignment->store(); 00498 } 00499 else 00500 { 00501 eZNodeAssignment::removeByID( $nodeAssignment->attribute( 'id' ) ); 00502 } 00503 } 00504 00505 if ( $hasOtherNodeType ) 00506 { 00507 foreach ( $otherNodeArray as $otherNode ) 00508 { 00509 if ( !in_array( $otherNode['parent_node_id'], $noAddAssignmentList ) ) 00510 { 00511 $newVersion->assignToNode( $otherNode['parent_node_id'], $otherNode['is_main'] ); 00512 } 00513 } 00514 } 00515 00516 if ( $hasLDAPNodeType ) 00517 { 00518 foreach ( $newLDAPNodeArray as $newLDAPNode ) 00519 { 00520 if ( !in_array( $newLDAPNode['parent_node_id'], $noAddAssignmentList ) ) 00521 { 00522 $newVersion->assignToNode( $newLDAPNode['parent_node_id'], $newLDAPNode['is_main'] ); 00523 } 00524 $assignment = eZNodeAssignment::fetch( $contentObject->attribute( 'id' ), $newVersionNr, $newLDAPNode['parent_node_id'] ); 00525 $assignment->setAttribute( 'parent_remote_id', uniqid( 'LDAP_' ) ); 00526 $assignment->store(); 00527 } 00528 } 00529 00530 if ( !$hasOtherNodeType and !$hasLDAPNodeType ) 00531 { 00532 if ( !in_array( $defaultUserPlacement, $noAddAssignmentList ) ) 00533 { 00534 $newVersion->assignToNode( $defaultUserPlacement, 1 ); 00535 } 00536 } 00537 //include_once( 'lib/ezutils/classes/ezoperationhandler.php' ); 00538 $adminUser = eZUser::fetchByName( 'admin' ); 00539 $adminUserContentObjectID = $adminUser->attribute( 'contentobject_id' ); 00540 eZUser::setCurrentlyLoggedInUser( $adminUser, $adminUserContentObjectID ); 00541 $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $userID, 00542 'version' => $newVersionNr ) ); 00543 $cli->output( $cli->stylize( 'emphasize', $existUser->attribute('login') ) . " has changed group, updated." ); 00544 } 00545 } 00546 } 00547 } 00548 $db->commit(); 00549 00550 if ( !$isQuiet ) 00551 $cli->output( "All LDAP users have been updated!" ); 00552 ?>