mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 01:29:05 +01:00
* LDAP/Addressbook: make further LDAP attributes available as custom-fields using "ldap_<attribute>" as name for accounts in LDAP
This commit is contained in:
parent
c2714a6813
commit
6c327e7a64
@ -2730,7 +2730,13 @@ class addressbook_ui extends addressbook_bo
|
|||||||
if (isset($readonlys['n_fileas'])) $readonlys['fileas_type'] = $readonlys['n_fileas'];
|
if (isset($readonlys['n_fileas'])) $readonlys['fileas_type'] = $readonlys['n_fileas'];
|
||||||
// disable not needed tabs
|
// disable not needed tabs
|
||||||
$readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']);
|
$readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']);
|
||||||
$readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'],$content['owner']) == $this->so_accounts;
|
$readonlys['tabs']['custom'] = !$this->customfields ||
|
||||||
|
// only show custom fields tab for LDAP, if we have LDAP CF's defined and an existing contact (as no schema defined)
|
||||||
|
$this->get_backend($content['id'],$content['owner']) == $this->so_accounts &&
|
||||||
|
(empty($content['id']) || !array_filter($this->customfields, static function($cf)
|
||||||
|
{
|
||||||
|
return substr($cf['name'], 0, 5) === 'ldap_';
|
||||||
|
}));
|
||||||
$readonlys['tabs']['custom_private'] = $readonlys['tabs']['custom'] || !$this->config['private_cf_tab'];
|
$readonlys['tabs']['custom_private'] = $readonlys['tabs']['custom'] || !$this->config['private_cf_tab'];
|
||||||
$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
|
$readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false;
|
||||||
$readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] ||
|
$readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] ||
|
||||||
|
@ -31,6 +31,11 @@ class Ldap
|
|||||||
const PERSONAL = 2;
|
const PERSONAL = 2;
|
||||||
const GROUP = 3;
|
const GROUP = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pseudo objectclass used for LDAP attributes made available to use as custom fields
|
||||||
|
*/
|
||||||
|
const CF_OBJECTCLASS = 'egwcustomfields';
|
||||||
|
|
||||||
var $data;
|
var $data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -345,6 +350,15 @@ class Ldap
|
|||||||
}
|
}
|
||||||
$this->ldapServerInfo = $GLOBALS['egw']->ldap->getLDAPServerInfo($this->ldap_config['ldap_contact_host']);
|
$this->ldapServerInfo = $GLOBALS['egw']->ldap->getLDAPServerInfo($this->ldap_config['ldap_contact_host']);
|
||||||
|
|
||||||
|
// check if there are any attributes defined via custom-fields
|
||||||
|
foreach(Api\Storage\Customfields::get('addressbook') as $cf)
|
||||||
|
{
|
||||||
|
if (substr($cf['name'], 0, 5) === 'ldap_')
|
||||||
|
{
|
||||||
|
$this->schema2egw[self::CF_OBJECTCLASS]['#'.$cf['name']] = strtolower(substr($cf['name'], 5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach($this->schema2egw as $attributes)
|
foreach($this->schema2egw as $attributes)
|
||||||
{
|
{
|
||||||
$this->all_attributes = array_merge($this->all_attributes,array_values($attributes));
|
$this->all_attributes = array_merge($this->all_attributes,array_values($attributes));
|
||||||
@ -1284,6 +1298,10 @@ class Ldap
|
|||||||
'id' => $entry['uid'][0] ?? $entry['entryuuid'][0],
|
'id' => $entry['uid'][0] ?? $entry['entryuuid'][0],
|
||||||
'tid' => 'n', // the type id for the addressbook
|
'tid' => 'n', // the type id for the addressbook
|
||||||
);
|
);
|
||||||
|
if (!empty($this->schema2egw[self::CF_OBJECTCLASS]))
|
||||||
|
{
|
||||||
|
$entry['objectclass'][] = self::CF_OBJECTCLASS;
|
||||||
|
}
|
||||||
foreach($entry['objectclass'] as $ii => $objectclass)
|
foreach($entry['objectclass'] as $ii => $objectclass)
|
||||||
{
|
{
|
||||||
$objectclass = strtolower($objectclass);
|
$objectclass = strtolower($objectclass);
|
||||||
|
Loading…
Reference in New Issue
Block a user