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;
    }

  }
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;
    }

  }
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 ; } }
NOT TESTED
add a group entry

@param string $group_dn as ldap dn
@param array $attributes in key value form
$attributes = array(
"attribute1" = "value",
"attribute2" = array("value1", "value2"),
)
@return boolean success
NOT TESTED add a group entry