LSaccessRightsMatrixView : show rigths on LSrelations

This commit is contained in:
Benjamin Renard 2019-10-14 12:34:42 +02:00
parent 90399ecdfb
commit b1252ea0bf
5 changed files with 99 additions and 3 deletions

View file

@ -68,6 +68,8 @@ function LSaccessRightsMatrixView() {
foreach (LSsession :: $ldapServer["LSaccess"] as $LSobject) {
if (!LSsession :: loadLSobject($LSobject))
continue;
// List attributes and rigths on their
$attrs = array();
foreach(LSconfig :: get("LSobjects.$LSobject.attrs", array()) as $attr_name => $attr_config) {
$raw_attr_rights = LSconfig :: get('rights', array(), 'array', $attr_config);
@ -82,9 +84,27 @@ function LSaccessRightsMatrixView() {
'rights' => $attr_rights,
);
}
// List relations and rigths on their
$relations = array();
foreach(LSconfig :: get("LSobjects.$LSobject.LSrelation", array()) as $relation_name => $relation_config) {
$raw_relation_rights = LSconfig :: get('rights', array(), 'array', $relation_config);
$relation_rights = array();
if ($LSobject == LSsession :: $ldapServer["authObjectType"])
$relation_rights['self'] = LSconfig :: get('self', False, null, $raw_relation_rights);
foreach(array_keys($LSprofiles) as $LSprofile) {
$relation_rights[$LSprofile] = LSconfig :: get($LSprofile, False, null, $raw_relation_rights);
}
$relations[$relation_name] = array (
'label' => __(LSconfig :: get('label', $relation_name, 'string', $relation_config)),
'rights' => $relation_rights,
);
}
$LSobjects[$LSobject] = array (
'label' => __(LSconfig :: get("LSobjects.$LSobject.label", $LSobject, 'string')),
'attrs' => $attrs,
'relations' => $relations,
);
}
@ -95,6 +115,8 @@ function LSaccessRightsMatrixView() {
if ($LSobject == LSsession :: $ldapServer["authObjectType"])
$LSprofiles = array_merge(array('self' => _('The user him-self')), $LSprofiles);
LSdebug($LSobjects);
LStemplate :: assign('pagetitle', _('Access rights matrix'));
LStemplate :: assign('LSprofiles', $LSprofiles);
LStemplate :: assign('LSobjects', $LSobjects);

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: LdapSaisie\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2019-10-10 18:16+0200\n"
"PO-Revision-Date: 2019-10-14 12:33+0200\n"
"Last-Translator: Benjamin Renard <brenard@zionetrix.net>\n"
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
"org>\n"
@ -336,10 +336,18 @@ msgstr ""
"défini."
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:52
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:88
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:120
msgid "Access rights matrix"
msgstr "Matrice des droits d'accès"
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:62
msgid "All connected users"
msgstr "Tous les utilisateurs connectés"
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:116
msgid "The user him-self"
msgstr "L'utilisateur lui-même"
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.ftp.php:27
msgid "FTP Support : Pear::Net_FTP is missing."
msgstr "Support FTP : Pear::Net_FTP n'est pas installé."
@ -2102,10 +2110,12 @@ msgid "Only validate data"
msgstr "Validation des données uniquement"
#: templates/default/LSaccessRightsMatrixView.tpl:27
#: templates/default/LSaccessRightsMatrixView.tpl:54
msgid "Readable"
msgstr "Lecture"
#: templates/default/LSaccessRightsMatrixView.tpl:29
#: templates/default/LSaccessRightsMatrixView.tpl:56
msgid "Readable / Writable"
msgstr "Lecture / Écriture"
@ -2113,10 +2123,22 @@ msgstr "Lecture / Écriture"
msgid "Refresh my access rights"
msgstr "Rafraîchir mes droits d'accès"
#: templates/default/LSaccessRightsMatrixView.tpl:42
msgid "Relations / Profiles"
msgstr "Relations / Profils"
#: templates/default/import.tpl:25
msgid "Result"
msgstr "Résultat"
#: templates/default/LSaccessRightsMatrixView.tpl:38
msgid "Their relations with other objects"
msgstr "Leurs relations avec les autres objets"
#: templates/default/LSaccessRightsMatrixView.tpl:65
msgid "This object type has no configured relation."
msgstr "Ce type d'objet n'a aucune relation de configurée."
#: templates/default/import.tpl:14
msgid "Update objects if exists"
msgstr "Mise à jour des objets existants"

View file

@ -280,10 +280,18 @@ msgid "Access Right Matrix Support : The global array %{array} is not defined."
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:52
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:88
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:120
msgid "Access rights matrix"
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:62
msgid "All connected users"
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:116
msgid "The user him-self"
msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.ftp.php:27
msgid "FTP Support : Pear::Net_FTP is missing."
msgstr ""
@ -1799,10 +1807,12 @@ msgid "Only validate data"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:27
#: templates/default/LSaccessRightsMatrixView.tpl:54
msgid "Readable"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:29
#: templates/default/LSaccessRightsMatrixView.tpl:56
msgid "Readable / Writable"
msgstr ""
@ -1810,10 +1820,22 @@ msgstr ""
msgid "Refresh my access rights"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:42
msgid "Relations / Profiles"
msgstr ""
#: templates/default/import.tpl:25
msgid "Result"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:38
msgid "Their relations with other objects"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:65
msgid "This object type has no configured relation."
msgstr ""
#: templates/default/import.tpl:14
msgid "Update objects if exists"
msgstr ""

View file

@ -34,6 +34,36 @@
{/foreach}
</tbody>
</table>
<h3>{tr msg="Their relations with other objects"}</h3>
{if !empty($LSobjects[$LSobject]['relations'])}
<table>
<thead>
<th>{tr msg="Relations / Profiles"}</th>
{foreach $LSprofiles as $name => $label}
<th>{$label} {if $name != $label}<img class='LStips' src="{img name='help'}" alt='?' title='{$name|escape:'htmlall'}'/>{/if}</th>
{/foreach}
</thead>
<tbody>
{foreach $LSobjects[$LSobject]['relations'] as $name => $conf}
<tr>
<th>{$conf.label} <img class='LStips' src="{img name='help'}" alt='?' title='{$name|escape:'htmlall'}'/></th>
{foreach $LSprofiles as $profil => $profil_conf}
<td>
{if $conf.rights[$profil] == 'r'}
<span class='LSaccessRightsMatrixView_readable'>{tr msg="Readable"}</span>
{elseif $conf.rights[$profil] == 'w'}
<span class='LSaccessRightsMatrixView_writable'>{tr msg="Readable / Writable"}</span>
{/if}
</td>
{/foreach}
</tr>
{/foreach}
</tbody>
</table>
{else}
<p>{tr msg="This object type has no configured relation."}
{/if}
</div>
</div>
{include file='ls:bottom.tpl'}