connect( $server['ldap_host'], $server['ldap_root_dn'], $server['ldap_root_pw'] ); $entries = $ldapService->accountSearch($params['search'], array('cn', $t.'idNumber', $t.'id' ), $server['ldap_context'], $t, 'cn'); $options = ''; foreach( $entries as $value ) { $id = $value[$t.'id'] ? $value[$t.'id'] : $value[$t.'idnumber']; $options .= ''; } return $options; } public function get_grants($app){ $db2 = $GLOBALS['phpgw']->db; $db2->select('phpgw_acl',array('acl_location','acl_account','acl_rights'),"acl_appname='".$app."' AND acl_location <> 'run'",__LINE__,__FILE__); $grants = array(); while ($db2->next_record()) { $objectID = $db2->f('acl_account'); $type = $GLOBALS['phpgw']->accounts->get_type($objectID); if($type == 'g') { $userID = $db2->f('acl_location'); $rights = $db2->f('acl_rights'); $grants[$userID.";".$objectID] = array( "userID"=> $userID,"groupID"=> $objectID, "rights" => $rights); } } unset($db2); return $grants; } public final function add_user($params) { list($user,$group,$rights) = explode(";",$params['id']); $objDB = new db_functions(); $db = $objDB -> db; $db -> select('phpgw_acl','count(*)',array( 'acl_appname' => "calendar", 'acl_location' => $user, 'acl_account' => $group),__LINE__,__FILE__); // Verify if already exists.... if ($db->next_record() && $db->f(0)) { return false; } $where = false; $db -> insert('phpgw_acl',array( 'acl_appname' => "calendar", 'acl_location' => $user, 'acl_account' => $group, 'acl_rights' => $rights ), $where, __LINE__,__FILE__); return true; } public final function rem_user($params){ list($user,$group) = explode(";",$params['id']); $objDB = new db_functions(); $db = $objDB -> db; $db -> delete('phpgw_acl',array( 'acl_appname' => "calendar", 'acl_location' => $user, 'acl_account' => $group),__LINE__,__FILE__); return true; } } ?>