function group_add_user($group,$user){
        //adding a user is a bit fiddly, we need to get the full DN of the user
        //and add it using the full DN of the group
        
        //find the user's dn
        $user_info=$this->user_info($user,array("cn"));
        if ($user_info[0]["dn"]==NULL){ return (false); }
        $user_dn=$user_info[0]["dn"];
        
        //find the group's dn
        $group_info=$this->group_info($group,array("cn"));
        if ($group_info[0]["dn"]==NULL){ return (false); }
        $group_dn=$group_info[0]["dn"];
        
        $add=array();
        $add["member"] = $user_dn;
        
        $result=@ldap_mod_add($this->_conn,$group_dn,$add);
        if ($result==false){ return (false); }
        return (true);
    }
function group_add_user($group,$user){
        //adding a user is a bit fiddly, we need to get the full DN of the user
        //and add it using the full DN of the group
        
        //find the user's dn
        $user_info=$this->user_info($user,array("cn"));
        if ($user_info[0]["dn"]==NULL){ return (false); }
        $user_dn=$user_info[0]["dn"];
        
        //find the group's dn
        $group_info=$this->group_info($group,array("cn"));
        if ($group_info[0]["dn"]==NULL){ return (false); }
        $group_dn=$group_info[0]["dn"];
        
        $add=array();
        $add["member"] = $user_dn;
        
        $result=@ldap_mod_add($this->_conn,$group_dn,$add);
        if ($result==false){ return (false); }
        return (true);
    }
function group_add_user ( $ group , $ user ) { //adding a user is a bit fiddly, we need to get the full DN of the user //and add it using the full DN of the group //find the user's dn $ user_info = $ this -> user_info ( $ user , array ( "cn" ) ) ; if ( $ user_info [ 0 ] [ "dn" ] == NULL ) { return ( false ) ; } $ user_dn = $ user_info [ 0 ] [ "dn" ] ; //find the group's dn $ group_info = $ this -> group_info ( $ group , array ( "cn" ) ) ; if ( $ group_info [ 0 ] [ "dn" ] == NULL ) { return ( false ) ; } $ group_dn = $ group_info [ 0 ] [ "dn" ] ; $ add = array ( ) ; $ add [ "member" ] = $ user_dn ; $ result = @ ldap_mod_add ( $ this -> _conn , $ group_dn , $ add ) ; if ( $ result == false ) { return ( false ) ; } return ( true ) ; }
Add a user to a group
Add a user to a group