Compare commits

...

2 commits

Author SHA1 Message Date
Benjamin Renard
6646ca91f1
Update french translation 2024-06-19 18:01:22 +02:00
Benjamin Renard
41af4f9305
LSaddon::dyngroup: Add showDyngroupMembers view function 2024-06-19 17:56:29 +02:00
10 changed files with 279 additions and 28 deletions

View file

@ -29,6 +29,9 @@
// Dynamic group object type
define('DYNGROUP_OBJECT_TYPE', 'LSdyngroup');
// Dynamic group member object type
define('DYNGROUP_MEMBER_OBJECT_TYPE', 'LSpeople');
/*
* Members DN attributes
*/

View file

@ -40,6 +40,16 @@ $GLOBALS['LSobjects']['LSdyngroup'] = array (
'label' => 'Dynamic groups',
'customActions' => array (
'showDyngroupMembers' => array (
'label' => 'Show members',
'icon' => 'group',
'function' => 'showDyngroupMembers',
'noConfirmation' => true,
'disableOnSuccessMsg' => true,
'rights' => array (
'admin',
),
),
'showTechInfo' => array (
'function' => 'showTechInfo',
'label' => 'Show technical information',

View file

@ -0,0 +1,11 @@
#showDyngroupMembers {
margin-left: 1em;
}
#showDyngroupMembers table.LStable tr.error {
background-color: var(--error-color);
}
#showDyngroupMembers table.LStable .center {
text-align: center;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 B

View file

@ -361,6 +361,68 @@ function triggerUpdateDynGroupsMembersCacheOnUserChanges(&$user, &$changed_attrs
return !$error;
}
/**
* Show dyngroup members
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @param LSldapObject $ldapObject The LSldapObject
*
* @return array|false array of memberUid URI attribute values or false in case of error
*/
function showDyngroupMembers($ldapObject) {
$member_dns = ensureIsArray($ldapObject -> attrs[ DYNGROUP_MEMBER_DN_ATTRIBUTE ] -> getValue());
$cache_member_dns = ensureIsArray($ldapObject -> attrs[ DYNGROUP_MEMBER_DN_STATIC_ATTRIBUTE ] -> getValue());
$member_uids = ensureIsArray($ldapObject -> attrs[ DYNGROUP_MEMBER_UID_ATTRIBUTE ] -> getValue());
$cache_member_uids = ensureIsArray($ldapObject -> attrs[ DYNGROUP_MEMBER_UID_STATIC_ATTRIBUTE ] -> getValue());
sort($member_dns);
sort($cache_member_dns);
sort($member_uids);
sort($cache_member_uids);
LStemplate :: assign('member_dns', $member_dns);
LStemplate :: assign('cache_member_dns', $cache_member_dns);
LStemplate :: assign('member_uids', $member_uids);
LStemplate :: assign('cache_member_uids', $cache_member_uids);
if (
defined('DYNGROUP_MEMBER_OBJECT_TYPE')
&& LSsession :: loadLSobject(constant('DYNGROUP_MEMBER_OBJECT_TYPE'))
) {
$member_type = constant('DYNGROUP_MEMBER_OBJECT_TYPE');
$uid2dn = (
LSconfig :: get("LSobjects.$member_type.rdn")."=%{uid},".
LSconfig :: get("LSobjects.$member_type.container_dn").",".
LSsession :: getTopDn()
);
LStemplate :: assign('member_object_type', $member_type);
LStemplate :: assign('uid2dn', $uid2dn);
}
else {
LStemplate :: assign('member_object_type', null);
}
LStemplate :: assign('pagetitle', getFData(_('%{name}: members'), $ldapObject -> getDisplayName()));
$LSview_actions=array();
$LSview_actions['return'] = array (
'label' => _('Go back'),
'url' => 'object/'.$ldapObject->getType().'/'.urlencode($ldapObject->getDn()),
'action' => 'view'
);
LStemplate :: assign('LSview_actions', $LSview_actions);
if (LSsession :: loadLSclass('LSform')) {
LSform :: loadDependenciesDisplayView();
}
LStemplate :: addCssFile('showDyngroupMembers.css');
LSsession :: setTemplate('showDyngroupMembers.tpl');
// Display template
LSsession :: displayTemplate();
exit();
}
if (php_sapi_name() != 'cli')
return true;

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: LdapSaisie\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2024-06-05 12:29+0200\n"
"PO-Revision-Date: 2024-06-19 17:52+0200\n"
"Last-Translator: Benjamin Renard <brenard@easter-eggs.com>\n"
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
"org>\n"
@ -322,6 +322,7 @@ msgstr "Vos modifications ont été enregistrées."
#: includes/addons/LSaddons.mail.php:565
#: includes/addons/LSaddons.showSupportInfo.php:78
#: includes/addons/LSaddons.dyngroup.php:408
#: includes/addons/LSaddons.accesslog.php:248
#: includes/addons/LSaddons.showTechInfo.php:128
msgid "Go back"
@ -407,6 +408,10 @@ msgstr ""
"délai de quelques minutes pourra être nécessaire pour que vos modifications "
"soient prises en compte sur ces groupes."
#: includes/addons/LSaddons.dyngroup.php:404
msgid "%{name}: members"
msgstr "%{name} : membres"
#: includes/addons/LSaddons.posix.php:27
msgid "POSIX Support: The constant %{const} is not defined."
msgstr "Support POSIX : La constante %{const} n'est pas définie."
@ -3727,6 +3732,11 @@ msgstr "Identifiant"
msgid "Imported objects"
msgstr "Objets importés"
#: templates/default/showDyngroupMembers.tpl:12
#: templates/default/showDyngroupMembers.tpl:68
msgid "In cache"
msgstr "En cache"
#: templates/default/recoverpassword.tpl:13 templates/default/login.tpl:12
msgid "LDAP server"
msgstr "Serveur LDAP"
@ -3747,6 +3757,16 @@ msgstr "Légende :"
msgid "Logout"
msgstr "Déconnexion"
#: templates/default/showDyngroupMembers.tpl:63
#: templates/default/showDyngroupMembers.tpl:67
msgid "Members's DN"
msgstr "DNs des membres"
#: templates/default/showDyngroupMembers.tpl:7
#: templates/default/showDyngroupMembers.tpl:11
msgid "Members's UID"
msgstr "UID des membres"
#: templates/default/LSmail.tpl:28
msgid "Message"
msgstr "Message"
@ -3776,6 +3796,14 @@ msgstr "Aucun champ."
msgid "No imported object"
msgstr "Aucun objet importé"
#: templates/default/showDyngroupMembers.tpl:113
msgid "No member's DN."
msgstr "Aucun DN de membre."
#: templates/default/showDyngroupMembers.tpl:57
msgid "No member's UID."
msgstr "Aucun UID de membre."
#: templates/default/import.tpl:65
msgid "No value"
msgstr "Aucune valeur"

View file

@ -20,6 +20,10 @@ $GLOBALS['LSlang'] = array (
"<strong>Used with caution !</strong> The name of the OpenLDAP module to used to check the password quality." =>
"<strong>À utiliser avec vigilance !</strong> Nom du module pour OpenLDAP à utiliser pour vérifier la qualité du mot de passe.",
# ldap_servers.1.subDn
"== All ==" =>
"== Tout ==",
# LSobjects.LSpeople.attrs.lsGodfatherDn.label
# LSobjects.LSgroup.attrs.lsGodfatherDn.label
# LSobjects.LSdyngroup.attrs.lsGodfatherDn.label
@ -161,6 +165,7 @@ $GLOBALS['LSlang'] = array (
"Description",
# LSobjects.pwdPolicy.attrs.pwdCheckQuality.no_value_label
# LSobjects.pwdPolicy.attrs.pwdCheckQuality.html_options.possible_values.0
"Disabled (default)" =>
"Désactivé (par défaut)",
@ -201,6 +206,10 @@ $GLOBALS['LSlang'] = array (
"E-mail address" =>
"Adresse e-mail",
# LSobjects.LSpeople.ioFormat.enable_disable_shell.label
"Enable/disable commands shell" =>
"Activer/désactiver l'interpréteur de commandes",
# LSobjects.LSpeople.LSsearch.customActions.exportSearchResultAsCSV.label
"Export result as CSV" =>
"Exporter le résultat au format CSV",
@ -234,10 +243,6 @@ $GLOBALS['LSlang'] = array (
"Given email address is invalid." =>
"L'adresse mail saisie est invalide.",
# ldap_servers.0.LSprofiles.godfather.label
"Godfather" =>
"Parrain",
# LSobjects.LSpeople.LSrelation.godfather.label
"Godfather of ..." =>
"Parrain de ...",
@ -435,10 +440,6 @@ $GLOBALS['LSlang'] = array (
"Mrs" =>
"Mme",
# LSobjects.LSpeople.attrs.personalTitle.html_options.possible_values.Mlle
"Ms" =>
"Mlle",
# LSobjects.pwdPolicy.attrs.pwdInHistory.check_data.integer.msg
# LSobjects.pwdPolicy.attrs.pwdMinLength.check_data.integer.msg
# LSobjects.pwdPolicy.attrs.pwdMaxAge.check_data.integer.msg
@ -464,20 +465,6 @@ $GLOBALS['LSlang'] = array (
"Name must contain alphanumeric values only." =>
"Le nom doit contenir uniquement des valeurs alpha-numériques.",
# LSobjects.LSpeople.attrs.pwdChangedTime.no_value_label
# LSobjects.LSpeople.attrs.pwdGraceUseTime.no_value_label
# LSobjects.LSpeople.attrs.shadowLastChange.no_value_label
# LSobjects.LSpeople.attrs.sambaLogonTime.no_value_label
# LSobjects.LSpeople.attrs.sambaLogoffTime.no_value_label
# LSobjects.LSpeople.attrs.sambaKickoffTime.html_options.special_values.2147483647
# LSobjects.LSpeople.attrs.sambaPwdLastSet.no_value_label
# LSobjects.LSpeople.attrs.sambaPwdMustChange.html_options.special_values.2147483647
# LSobjects.LSpeople.attrs.sambaPwdCanChange.html_options.special_values.2147483647
# LSobjects.LSsysaccount.attrs.pwdChangedTime.no_value_label
# LSobjects.LSsysaccount.attrs.pwdGraceUseTime.no_value_label
"Never" =>
"Jamais",
# LSobjects.pwdPolicy.attrs.pwdSafeModify.no_value_label
# LSobjects.pwdPolicy.attrs.pwdLockout.no_value_label
# LSobjects.pwdPolicy.attrs.pwdMustChange.no_value_label
@ -493,6 +480,10 @@ $GLOBALS['LSlang'] = array (
"No grace delay (default)" =>
"Aucun délai de grâce (par défaut)",
# LSobjects.LSpeople.attrs.gidNumber.html_options.possible_values.0
"No group" =>
"Aucun groupe",
# LSobjects.pwdPolicy.attrs.pwdInHistory.no_value_label
"No history (default)" =>
"Pas d'historique (par défaut)",
@ -522,11 +513,6 @@ $GLOBALS['LSlang'] = array (
"Not locked" =>
"Non-bloqué",
# LSobjects.LSpeople.attrs.pwdReset.no_value_label
# LSobjects.LSsysaccount.attrs.pwdReset.no_value_label
"Not set" =>
"Non défini",
# LSobjects.pwdPolicy.attrs.pwdInHistory.label
"Number of old passwords kept in history" =>
"Nombre d'anciens mots de passe à conserver dans l'historique",
@ -684,6 +670,10 @@ $GLOBALS['LSlang'] = array (
"Set this attribute and delete <em>pwdAccountLockedTime</em> attribute value to unlock the account." =>
"Définissez cet attribut et supprimez l'attribut <em>pwdAccountLockedTime</em> pour débloquer le compte.",
# LSobjects.LSdyngroup.customActions.showDyngroupMembers.label
"Show members" =>
"Voir les membres",
# LSobjects.LSpeople.customActions.showTechInfo.label
# LSobjects.LSgroup.customActions.showTechInfo.label
# LSobjects.LSdyngroup.customActions.showTechInfo.label

View file

@ -250,6 +250,7 @@ msgstr ""
#: includes/addons/LSaddons.mail.php:565
#: includes/addons/LSaddons.showSupportInfo.php:78
#: includes/addons/LSaddons.dyngroup.php:408
#: includes/addons/LSaddons.accesslog.php:248
#: includes/addons/LSaddons.showTechInfo.php:128
msgid "Go back"
@ -320,6 +321,10 @@ msgid ""
"necessary to handle your changes on this groups."
msgstr ""
#: includes/addons/LSaddons.dyngroup.php:404
msgid "%{name}: members"
msgstr ""
#: includes/addons/LSaddons.posix.php:27
msgid "POSIX Support: The constant %{const} is not defined."
msgstr ""
@ -3203,6 +3208,11 @@ msgstr ""
msgid "Imported objects"
msgstr ""
#: templates/default/showDyngroupMembers.tpl:12
#: templates/default/showDyngroupMembers.tpl:68
msgid "In cache"
msgstr ""
#: templates/default/recoverpassword.tpl:13 templates/default/login.tpl:12
msgid "LDAP server"
msgstr ""
@ -3223,6 +3233,16 @@ msgstr ""
msgid "Logout"
msgstr ""
#: templates/default/showDyngroupMembers.tpl:63
#: templates/default/showDyngroupMembers.tpl:67
msgid "Members's DN"
msgstr ""
#: templates/default/showDyngroupMembers.tpl:7
#: templates/default/showDyngroupMembers.tpl:11
msgid "Members's UID"
msgstr ""
#: templates/default/LSmail.tpl:28
msgid "Message"
msgstr ""
@ -3252,6 +3272,14 @@ msgstr ""
msgid "No imported object"
msgstr ""
#: templates/default/showDyngroupMembers.tpl:113
msgid "No member's DN."
msgstr ""
#: templates/default/showDyngroupMembers.tpl:57
msgid "No member's UID."
msgstr ""
#: templates/default/import.tpl:65
msgid "No value"
msgstr ""

View file

@ -0,0 +1,119 @@
{extends file='ls:base_connected.tpl'}
{block name="content"}
<div id='showDyngroupMembers'>
<h1>{$pagetitle}</h1>
{include file='ls:LSview_actions.tpl'}
<h2>{tr msg="Members's UID"}</h2>
<table class="LStable">
<thead>
<tr>
<th>{tr msg="Members's UID"}</th>
<th>{tr msg="In cache"}</th>
</tr>
</thead>
<tbody>
{if $member_uids || $cache_member_uids}
{foreach $member_uids as $uid}
{if in_array($uid, $cache_member_uids)}
<tr>
<td>
{if $member_object_type}
<a href="object/{$member_object_type}/{getFData format=$uid2dn data=$uid|escape:'url'}">{$uid}</a>
{else}
{$uid}
{/if}
</td>
<td class="center">✓</td>
</tr>
{else}
<tr class="error">
<td>
{if $member_object_type}
<a href="object/{$member_object_type}/{getFData format=$uid2dn data=$uid|escape:'url'}">{$uid}</a>
{else}
{$uid}
{/if}
</td>
<td class="center">X</td>
</tr>
{/if}
{/foreach}
{foreach $cache_member_uids as $uid}
{if in_array($uid, $member_uids)}{continue}{/if}
<tr class="error">
<td class="center">X</td>
<td>
{if $member_object_type}
<a href="object/{$member_object_type}/{getFData format=$uid2dn data=$uid|escape:'url'}">{$uid}</a>
{else}
{$uid}
{/if}
</td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="2">{tr msg="No member's UID."}</td>
</tr>
{/if}
</tbody>
</table>
<h2>{tr msg="Members's DN"}</h2>
<table class="LStable">
<thead>
<tr>
<th>{tr msg="Members's DN"}</th>
<th>{tr msg="In cache"}</th>
</tr>
</thead>
<tbody>
{if $member_dns || $cache_member_dns}
{foreach $member_dns as $dn}
{if in_array($dn, $cache_member_dns)}
<tr>
<td>
{if $member_object_type}
<a href="object/{$member_object_type}/{$dn|escape:'url'}">{$dn}</a>
{else}
{$dn}
{/if}
</td>
<td class="center">✓</td>
</tr>
{else}
<tr class="error">
<td>
{if $member_object_type}
<a href="object/{$member_object_type}/{$dn|escape:'url'}">{$dn}</a>
{else}
{$dn}
{/if}
</td>
<td class="center">X</td>
</tr>
{/if}
{/foreach}
{foreach $cache_member_dns as $dn}
{if in_array($dn, $member_dns)}{continue}{/if}
<tr class="error">
<td class="center">X</td>
<td>
{if $member_object_type}
<a href="object/{$member_object_type}/{$dn|escape:'url'}">{$dn}</a>
{else}
{$dn}
{/if}
</td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="2">{tr msg="No member's DN."}</td>
</tr>
{/if}
</tbody>
</table>
</div>
{/block}