public function LdapServer::groupAddMember in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_servers/LdapServer.class.php \LdapServer::groupAddMember()
NOT TESTED add a member to a group.
Parameters
string $ldap_user_dn: as ldap dn.
mixed $user:
- drupal user object (stdClass Object)
- ldap entry of user (array) (with top level keys of 'dn', 'mail',
'sid' and 'attr' )
- ldap dn of user (array)
- drupal username of user (string)
Return value
bool
File
- ldap_servers/
LdapServer.class.php, line 1568 - Defines server classes and related functions.
Class
- LdapServer
- LDAP Server Class.
Code
public function groupAddMember($group_dn, $user) {
$user_ldap_entry = $this
->userUserToExistingLdapEntry($user);
$result = FALSE;
if ($user_ldap_entry && $this->groupGroupEntryMembershipsConfigured) {
$add = [];
$add[$this->groupMembershipsAttr] = $user_ldap_entry['dn'];
$this
->connectAndBindIfNotAlready();
$result = @ldap_mod_add($this->connection, $group_dn, $add);
}
return $result;
}