* Admin: add a description to stock groups Admins, Default and NoGroup, allow to edit that description for LDAP and ADS

This commit is contained in:
Ralf Becker 2015-02-18 11:40:26 +00:00
parent 4078a48fb8
commit 426f9e0f84
6 changed files with 54 additions and 5 deletions

View File

@ -426,6 +426,7 @@ class admin_ui
{ {
$tree['item'][] = self::fix_userdata(array( $tree['item'][] = self::fix_userdata(array(
'text' => $group['account_lid'], 'text' => $group['account_lid'],
'tooltip' => $group['account_description'],
'id' => $root.'/'.$group['account_id'], 'id' => $root.'/'.$group['account_id'],
)); ));
} }

View File

@ -335,6 +335,17 @@ class accounts
else else
{ {
$account_search[$serial]['data'] = $this->backend->search($param); $account_search[$serial]['data'] = $this->backend->search($param);
if ($param['type'] !== 'accounts')
{
foreach($account_search[$serial]['data'] as &$account)
{
// add default description for Admins and Default group
if ($account['account_type'] === 'g' && empty($account['account_description']))
{
self::add_default_group_description($account);
}
}
}
$account_search[$serial]['total'] = $this->total = $this->backend->total; $account_search[$serial]['total'] = $this->total = $this->backend->total;
} }
//echo "<p>accounts::search(".array2string(unserialize($serial)).")= returning ".count($account_search[$serial]['data'])." of $this->total entries<pre>".print_r($account_search[$serial]['data'],True)."</pre>\n"; //echo "<p>accounts::search(".array2string(unserialize($serial)).")= returning ".count($account_search[$serial]['data'])." of $this->total entries<pre>".print_r($account_search[$serial]['data'],True)."</pre>\n";
@ -429,6 +440,12 @@ class accounts
$data = self::cache_read($id); $data = self::cache_read($id);
// add default description for Admins and Default group
if ($data['account_type'] === 'g' && empty($data['account_description']))
{
self::add_default_group_description($data);
}
if ($set_depricated_names && $data) if ($set_depricated_names && $data)
{ {
foreach($this->depricated_names as $name) foreach($this->depricated_names as $name)
@ -469,6 +486,28 @@ class accounts
return json_encode($account); return json_encode($account);
} }
/**
* Add a default description for stock groups: Admins, Default, NoGroup
*
* @param array &$data
*/
protected static function add_default_group_description(array &$data)
{
switch($data['account_lid'])
{
case 'Default':
$data['account_description'] = lang('EGroupware all users group, do NOT delete');
break;
case 'Admins':
$data['account_description'] = lang('EGroupware administrators group, do NOT delete');
break;
case 'NoGroup':
$data['account_description'] = lang('EGroupware anonymous users group, do NOT delete');
break;
}
error_log(__METHOD__."(".array2string($data).")");
}
/** /**
* Saves / adds the data of one account * Saves / adds the data of one account
* *
@ -490,6 +529,11 @@ class accounts
} }
} }
} }
// add default description for Admins and Default group
if ($data['account_type'] === 'g' && empty($data['account_description']))
{
self::add_default_group_description($data);
}
if (($id = $this->backend->save($data)) && $data['account_type'] != 'g') if (($id = $this->backend->save($data)) && $data['account_type'] != 'g')
{ {
// if we are not on a pure LDAP system, we have to write the account-date via the contacts class now // if we are not on a pure LDAP system, we have to write the account-date via the contacts class now

View File

@ -578,10 +578,6 @@ class accounts_ads
protected function _save_group(array &$data, array $old=null) protected function _save_group(array &$data, array $old=null)
{ {
//error_log(__METHOD__.'('.array2string($data).', old='.array2string($old).')'); //error_log(__METHOD__.'('.array2string($data).', old='.array2string($old).')');
if (empty($data['account_description']))
{
$data['account_description'] = 'EGroupware '.lang('Group').' '.$data['account_lid'];
}
if (!$old) // new entry if (!$old) // new entry
{ {

View File

@ -446,7 +446,7 @@ class accounts_ldap
} }
} }
$sri = ldap_search($this->ds, $this->group_context,'(&(objectClass=posixGroup)(gidnumber=' . abs($account_id).'))', $sri = ldap_search($this->ds, $this->group_context,'(&(objectClass=posixGroup)(gidnumber=' . abs($account_id).'))',
array('dn', 'gidnumber', 'cn', 'objectclass', static::MAIL_ATTR, 'memberuid')); array('dn', 'gidnumber', 'cn', 'objectclass', static::MAIL_ATTR, 'memberuid', 'description'));
$ldap_data = ldap_get_entries($this->ds, $sri); $ldap_data = ldap_get_entries($this->ds, $sri);
if (!$ldap_data['count']) if (!$ldap_data['count'])
@ -467,6 +467,7 @@ class accounts_ldap
'objectclass' => array_map('strtolower', $data['objectclass']), 'objectclass' => array_map('strtolower', $data['objectclass']),
'account_email' => $data[static::MAIL_ATTR][0], 'account_email' => $data[static::MAIL_ATTR][0],
'members' => array(), 'members' => array(),
'account_description' => $data['description'][0],
); );
if (isset($data['memberuid'])) if (isset($data['memberuid']))
@ -554,6 +555,7 @@ class accounts_ldap
{ {
$to_write['gidnumber'] = abs($data['account_id']); $to_write['gidnumber'] = abs($data['account_id']);
$to_write['cn'] = $data['account_lid']; $to_write['cn'] = $data['account_lid'];
$to_write['description'] = $data['account_description'];
return $to_write; return $to_write;
} }

View File

@ -277,6 +277,9 @@ edit %1 category for common de %1 Kategorie editieren für
edit categories common de Kategorien editieren edit categories common de Kategorien editieren
edit category common de Kategorie editieren edit category common de Kategorie editieren
egroupware common de EGroupware egroupware common de EGroupware
egroupware administrators group, do not delete common de EGroupware Gruppe für Administratoren, NICHT löschen
egroupware all users group, do not delete common de EGroupware Gruppe für alle Benutzer, NICHT löschen
egroupware anonymous users group, do not delete common de EGroupware Gruppe für anonymen Benutzer, nicht löschen
egroupware api version common de EGroupware API Version egroupware api version common de EGroupware API Version
egroupware maintenance update %1 available common de EGroupware Fehlerbehebungsupdate %1 ist verfügbar egroupware maintenance update %1 available common de EGroupware Fehlerbehebungsupdate %1 ist verfügbar
egroupware security update %1 needs to be installed! common de EGroupware Sicherheitsupdate %1 muss installiert werden! egroupware security update %1 needs to be installed! common de EGroupware Sicherheitsupdate %1 muss installiert werden!

View File

@ -277,6 +277,9 @@ edit %1 category for common en Edit %1 category for
edit categories common en Edit categories edit categories common en Edit categories
edit category common en Edit category edit category common en Edit category
egroupware common en EGroupware egroupware common en EGroupware
egroupware administrators group, do not delete common en EGroupware administrators group, do NOT delete
egroupware all users group, do not delete common en EGroupware all users group, do NOT delete
egroupware anonymous users group, do not delete common en EGroupware anonymous users group, do NOT delete
egroupware api version common en EGroupware API version egroupware api version common en EGroupware API version
egroupware maintenance update %1 available common en EGroupware maintenance update %1 available egroupware maintenance update %1 available common en EGroupware maintenance update %1 available
egroupware security update %1 needs to be installed! common en EGroupware security update %1 needs to be installed! egroupware security update %1 needs to be installed! common en EGroupware security update %1 needs to be installed!