allow to show member/owner count

This commit is contained in:
Roland Gruber 2019-07-17 21:10:24 +02:00
parent 03caa12d31
commit b831414ca4
5 changed files with 98 additions and 11 deletions

View File

@ -1,3 +1,7 @@
September 2019
- Group account types can show member+owner count in list view
02.07.2019 6.8
- Parallel editing of multiple entries in different browser tabs supported
- LAM supports the progressive web app standard which allows to install LAM as an icon on home screen

View File

@ -2259,8 +2259,8 @@ AuthorizedKeysCommandUser root</literallayout>
<para><emphasis role="bold">Configuration</emphasis></para>
<para>Please add the account type "Groups" and then select account
module "Unix (posixGroup)".</para>
<para>Special Please add the account type "Groups" and then select
account module "Unix (posixGroup)".</para>
<screenshot>
<mediaobject>
@ -2270,6 +2270,43 @@ AuthorizedKeysCommandUser root</literallayout>
</mediaobject>
</screenshot>
<para>Virtual list attributes:</para>
<screenshot>
<graphic fileref="images/mod_unixGroupConfig2.png"/>
</screenshot>
<para>The following virtual attributes can be shown in the group list.
These are no real LDAP attributes but extra data that can be shown by
LAM.</para>
<itemizedlist>
<listitem>
<para>memberuid_count: number of entries in attribute
"memberuid"</para>
</listitem>
<listitem>
<para>member_count: number of entries in attribute "member"</para>
</listitem>
<listitem>
<para>uniqueMember_count: number of entries in attribute
"uniquemember"</para>
</listitem>
<listitem>
<para>owner_count: number of entries in attribute "owner"</para>
</listitem>
<listitem>
<para>roleOccupant_count: number of entries in attribute
"roleOccupant"</para>
</listitem>
</itemizedlist>
<para>Module settings:</para>
<para>GID generator: LAM will suggest GID numbers for your accounts.
Please note that it may happen that there are duplicate IDs assigned if
users create groups at the same time. Use an <ulink
@ -3036,6 +3073,38 @@ AuthorizedKeysCommandUser root</literallayout>
</mediaobject>
</screenshot>
<para>Virtual list attributes:</para>
<screenshot>
<graphic fileref="images/mod_gon.png"/>
</screenshot>
<para>The following virtual attributes can be shown in the group list.
These are no real LDAP attributes but extra data that can be shown by
LAM.</para>
<itemizedlist>
<listitem>
<para>member_count: number of entries in attribute "member"</para>
</listitem>
<listitem>
<para>uniqueMember_count: number of entries in attribute
"uniquemember"</para>
</listitem>
<listitem>
<para>owner_count: number of entries in attribute "owner"</para>
</listitem>
<listitem>
<para>roleOccupant_count: number of entries in attribute
"roleOccupant"</para>
</listitem>
</itemizedlist>
<para>Module settings:</para>
<para>On the module settings tab you set some options like the display
format for members/owners and if fields like description should not be
displayed.</para>

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -3,7 +3,7 @@ use \LAM\TYPES\TypeManager;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2005 - 2018 Roland Gruber
Copyright (C) 2005 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -115,7 +115,12 @@ class group extends baseType {
"roleOccupant" => _("Role member DNs"),
"uniqueMember" => _("Group member DNs"),
"memberUrl" => _("Entries"),
));
'memberuid_count' => _('Member count'),
'member_count' => _('Member count'),
'uniqueMember_count' => _('Member count'),
'owner_count' => _('Owner count'),
'roleOccupant_count' => _('Member count')
));
if ($this->getType() != null) {
$modules = $this->getType()->getModules();
if (in_array('organizationalRole', $modules)) {
@ -279,8 +284,9 @@ class lamGroupList extends lamList {
parent::listGetParams();
// generate list primary group memebers
// after parent::listGetParams is $this->refresh set to correct value
if ($this->include_primary && !$this->refresh && ($this->refresh_primary || (sizeof($this->primary_hash) == 0)))
if ($this->include_primary && !$this->refresh && ($this->refresh_primary || (sizeof($this->primary_hash) == 0))) {
$this->groupRefreshPrimary();
}
}
/**
@ -288,6 +294,7 @@ class lamGroupList extends lamList {
* @see lamList::getTableCellContent()
*/
protected function getTableCellContent(&$entry, &$attribute) {
$countAttributes = array('memberuid_count', 'member_count', 'uniqueMember_count', 'owner_count', 'roleOccupant_count');
if ($attribute == "memberuid") {
// $gid is used for linking primary group memebers
$gid = -1;
@ -360,12 +367,10 @@ class lamGroupList extends lamList {
for ($i = 0; $i < $count; $i++) {
$replaced = false;
foreach ($this->suffixList as $suffix => $type) {
if (stripos($values[$i], $suffix) > 0) {
if (!isAccountTypeHidden($type)) {
$values[$i] = '<a href="../account/edit.php?type=' . $type . '&amp;DN=\'' . $values[$i] . '\'">' . getAbstractDN($values[$i]) . '</a>';
$replaced = true;
break;
}
if ((stripos($values[$i], $suffix) > 0) && !isAccountTypeHidden($type)) {
$values[$i] = '<a href="../account/edit.php?type=' . $type . '&amp;DN=\'' . $values[$i] . '\'">' . getAbstractDN($values[$i]) . '</a>';
$replaced = true;
break;
}
}
if (!$replaced) {
@ -374,6 +379,15 @@ class lamGroupList extends lamList {
}
return new htmlDiv(null, new htmlOutputText(implode('<br>', $values), false), array('rightToLeftText'));
}
elseif (in_array_ignore_case($attribute, $countAttributes)) {
$count = 0;
$realAttributeName = str_replace('_count', '', $attribute);
$values = &$entry[$realAttributeName];
if (!empty($values)) {
$count = sizeof($values);
}
return new htmlOutputText($count);
}
// print all other attributes
else {
return parent::getTableCellContent($entry, $attribute);