public function LdapServer::groupAddGroup in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_servers/LdapServer.class.php \LdapServer::groupAddGroup()
NOT TESTED add a group entry
Parameters
string $group_dn as ldap dn:
array $attributes in key value form: $attributes = array( "attribute1" = "value", "attribute2" = array("value1", "value2"), )
Return value
boolean success
File
- ldap_servers/
LdapServer.class.php, line 1272 - Defines server classes and related functions.
Class
- LdapServer
- LDAP Server Class
Code
public function groupAddGroup($group_dn, $attributes = array()) {
//debug("this->dnExists( $group_dn, boolean)"); debug($this->dnExists($group_dn, 'boolean'));
// debug("this->dnExists( $group_dn, boolean)"); debug($this->dnExists($group_dn));
if ($this
->dnExists($group_dn, 'boolean')) {
return FALSE;
}
$attributes = array_change_key_case($attributes, CASE_LOWER);
$objectclass = empty($attributes['objectclass']) ? $this->groupObjectClass : $attributes['objectclass'];
$attributes['objectclass'] = $objectclass;
/**
* 2. give other modules a chance to add or alter attributes
*/
$context = array(
'action' => 'add',
'corresponding_drupal_data' => array(
$group_dn => $attributes,
),
'corresponding_drupal_data_type' => 'group',
);
$ldap_entries = array(
$group_dn => $attributes,
);
drupal_alter('ldap_entry_pre_provision', $ldap_entries, $this, $context);
$attributes = $ldap_entries[$group_dn];
/**
* 4. provision ldap entry
* @todo how is error handling done here?
*/
$ldap_entry_created = $this
->createLdapEntry($attributes, $group_dn);
/**
* 5. allow other modules to react to provisioned ldap entry
* @todo how is error handling done here?
*/
if ($ldap_entry_created) {
module_invoke_all('ldap_entry_post_provision', $ldap_entries, $this, $context);
return TRUE;
}
else {
return FALSE;
}
}