Lines Matching +full:delete +full:- +full:user -(+path:inc +path:lang) -(+path:lib +path:plugins +path:lang) -(+path:lib +path:tpl +path:dokuwiki +path:lang)

12  * Copyright (c) 2006-2012 Scott Barnett, Richard Hyland
31 * @copyright (c) 2006-2012 Scott Barnett, Richard Hyland
32 * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html LGPLv2.1
54 $this->adldap = $adldap;
67 $parentGroup = $this->ginfo($parent, array("cn"));
74 $childGroup = $this->info($child, array("cn"));
83 $result = @ldap_mod_add($this->adldap->getLdapConnection(), $parentDn, $add);
91 * Add a user to a group
93 * @param string $group The group to add the user to
94 * @param string $user The user to add to the group
98 public function addUser($group, $user, $isGUID = false)
100 // Adding a user is a bit fiddly, we need to get the full DN of the user
103 // Find the user's dn
104 $userDn = $this->adldap->user()->dn($user, $isGUID);
110 $groupInfo = $this->info($group, array("cn"));
119 $result = @ldap_mod_add($this->adldap->getLdapConnection(), $groupDn, $add);
139 $groupInfo = $this->info($group, array("cn"));
148 $result = @ldap_mod_add($this->adldap->getLdapConnection(), $groupDn, $add);
182 $result = ldap_add($this->adldap->getLdapConnection(), "CN=" . $add["cn"] . ", " . $container . "," . $this->adldap->getBaseDn(), $add);
190 * Delete a group account
192 * @param string $group The group to delete (please be careful here!)
196 public function delete($group) {
197 if (!$this->adldap->getLdapBind()){ return false; }
200 $groupInfo = $this->info($group, array("*"));
202 $result = $this->adldap->folder()->delete($dn);
219 $parentGroup = $this->info($parent, array("cn"));
226 $childGroup = $this->info($child, array("cn"));
235 $result = @ldap_mod_del($this->adldap->getLdapConnection(), $parentDn, $del);
243 * Remove a user from a group
245 * @param string $group The group to remove a user from
246 * @param string $user The AD user to remove from the group
250 public function removeUser($group, $user, $isGUID = false)
254 $groupInfo = $this->info($group, array("cn"));
261 $userDn = $this->adldap->user()->dn($user, $isGUID);
269 $result = @ldap_mod_del($this->adldap->getLdapConnection(), $groupDn, $del);
279 * @param string $group The group to remove a user from
287 $groupInfo = $this->info($group, array("cn"));
296 $result = @ldap_mod_del($this->adldap->getLdapConnection(), $groupDn, $del);
312 if (!$this->adldap->getLdapBind()){ return false; }
313 if ($recursive === NULL){ $recursive = $this->adldap->getRecursiveGroups(); } // Use the default option if they haven't set it
316 $info = $this->info($group, array("member","cn"));
325 $filter = "(&(objectCategory=group)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($groups[$i]) . "))";
327 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
328 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
332 $filter = "(&(objectCategory=group)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($groups[$i]) . "))";
334 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
335 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
339 $subGroups = $this->inGroup($entries[0]['distinguishedname'][0], $recursive);
361 if (!$this->adldap->getLdapBind()){ return false; }
362 if ($recursive === NULL){ $recursive = $this->adldap->getRecursiveGroups(); } // Use the default option if they haven't set it
364 $info = $this->info($group, array("member","cn"));
373 $filter = "(&(objectCategory=person)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($users[$i]) . "))";
375 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
376 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
380 $filter = "(&(objectCategory=group)(distinguishedName=" . $this->adldap->utilities()->ldapSlashes($users[$i]) . "))";
382 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
383 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
387 $subUsers = $this->members($entries[0]['samaccountname'][0], $recursive);
419 if (!$this->adldap->getLdapBind()) { return false; }
425 $filter = "(&(objectCategory=group)(name=" . $this->adldap->utilities()->ldapSlashes($groupName) . "))";
429 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
430 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
446 if (!$this->adldap->getLdapBind()) { return false; }
448 $info = $this->info($groupName, $fields);
450 $collection = new adLDAPGroupCollection($info, $this->adldap);
475 $info = $this->info($parent, array("memberof"));
480 $groupNames = $this->adldap->utilities()->niceNames($groups);
504 if (!$this->adldap->getLdapBind()) { return false; }
513 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
514 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
543 $groupsArray = $this->search(null, $includeDescription, $search, $sorted);
556 $groupsArray = $this->search(adLDAP::ADLDAP_SECURITY_GLOBAL_GROUP, $includeDescription, $search, $sorted);
569 $groupsArray = $this->search(adLDAP::ADLDAP_DISTRIBUTION_GROUP, $includeDescription, $search, $sorted);
577 * This is a re-write based on code submitted by Bruce which prevents the
581 * @param string $usersid User's Object SID
589 $gsid = substr_replace($usersid, pack('V',$gid), strlen($usersid)-4,4);
590 $filter = '(objectsid=' . $this->adldap->utilities()->getTextSID($gsid).')';
592 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
593 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);
620 $sr = ldap_search($this->adldap->getLdapConnection(), $this->adldap->getBaseDn(), $filter, $fields);
621 $entries = ldap_get_entries($this->adldap->getLdapConnection(), $sr);