ldap_functions = new ldap_functions; $this->imap_functions = new imap_functions; $this->functions = new functions; $this->db_functions = new db_functions(); } function create($params) { $params['uid'] = $this->get_shared_mail2uid($params); $return = $this->ldap_functions->create_shared_accounts($params); if( $return['status'] ){ //Create mailbox $mailquota = 10; $return = $this->imap_functions->create($params['uid'], $params['mailquota']); $owners_acl_new = unserialize($params['owners_acl']); //add new users e set permissions foreach($owners_acl_new as $user => $acl){ $result &= $this->imap_functions->setaclfrombox($user,$acl,$params['uid']); } $owners_calendar_acl_new = unserialize($params['owners_calendar_acl']); $owner = $this->ldap_functions->uid2uidnumber($params['uid']); foreach($owners_calendar_acl_new as $user => $acl){ $result &= $this->db_functions->save_calendar_acls($this->ldap_functions->uid2uidnumber($user),$acl,$owner); } $this->db_functions->write_log('Create Shared account',$params['uid']); } return $return; } function save($params) { $params['uid'] = $this->get_shared_mail2uid($params); $params['old_uid'] = $this->get_shared_dn2uid($params['anchor']); $result = $this->ldap_functions->save_shared_accounts($params); if( $result['status']){ $result = $this->imap_functions->save_shared_account($params); $owners_calendar_acl_new = unserialize($params['owners_calendar_acl']); $owner = $params['uidnumber']; foreach($owners_calendar_acl_new as $user => $acl){ $this->db_functions->save_calendar_acls($this->ldap_functions->uid2uidnumber($user),$acl,$owner); } $this->db_functions->write_log('Update Shared account','Old UID:'.$params['old_uid'].' New UID '.$params['uid']); } return $result; } function get($params) { if (!$this->functions->check_acl($_SESSION['phpgw_info']['expresso']['user']['account_lid'], 'list_institutional_accounts')) { $return['status'] = false; $return['msg'] = $this->functions->lang('You do not have right to list institutional accounts') . "."; return $return; } $input = $params['input']; $justthese = array("cn", "mail", "uid"); $trs = array(); foreach ($this->manager_contexts as $idx=>$context) { $shared_accounts = ldap_search($this->ldap, $context, ("(&(phpgwAccountType=s)(|(mail=$input*)(cn=*$input*)))"), $justthese); $entries = ldap_get_entries($this->ldap, $shared_accounts); for ($i=0; $i<$entries['count']; ++$i) { $tr = "