LSaddon::LSaccessRightsMatrixView: handle customActions & customSearchActions

This commit is contained in:
Benjamin Renard 2020-09-23 14:10:50 +02:00
parent 85b74feb86
commit 3598e48c6e
6 changed files with 178 additions and 7 deletions

View file

@ -90,9 +90,9 @@
} }
/* /*
* Readable/Writable tips * Readable/Writable/Allowed tips
*/ */
span.LSaccessRightsMatrixView_readable, span.LSaccessRightsMatrixView_writable { span.LSaccessRightsMatrixView_readable, span.LSaccessRightsMatrixView_writable, span.LSaccessRightsMatrixView_allowed {
color: #fff; color: #fff;
border: 1px solid; border: 1px solid;
border-radius: 0.3em; border-radius: 0.3em;
@ -112,6 +112,11 @@ span.LSaccessRightsMatrixView_writable {
border-color: #ffc107; border-color: #ffc107;
} }
span.LSaccessRightsMatrixView_allowed {
background-color: #28a745;
border-color: #28a745;
}
/* /*
* Tabs * Tabs
*/ */
@ -165,6 +170,14 @@ div.LSaccessRightsMatrixView_tab_content h2 {
font-weight: normal; font-weight: normal;
} }
/*
* Subtitle
*/
#LSaccessRightsMatrixView h3 {
border-bottom: 1px solid #dddddd;
max-width: 60em;
}
@media (max-width: 1024px) { @media (max-width: 1024px) {
div.LSaccessRightsMatrixView_tab_content { div.LSaccessRightsMatrixView_tab_content {

View file

@ -136,10 +136,42 @@ function LSaccessRightsMatrixView() {
); );
} }
// List customActions and rigths on their
$customActions = array();
foreach(LSconfig :: get("LSobjects.$LSobject.customActions", array()) as $action_name => $action_config) {
$raw_action_rights = LSconfig :: get('rights', array(), 'array', $action_config);
$action_rights = array();
if (array_key_exists($LSobject, $authObjTypes))
$action_rights['self'] = in_array('self', $raw_action_rights);
foreach(array_keys($LSprofiles) as $LSprofile)
$action_rights[$LSprofile] = in_array($LSprofile, $raw_action_rights);
$customActions[$action_name] = array (
'label' => __(LSconfig :: get('label', $action_name, 'string', $action_config)),
'rights' => $action_rights,
);
}
// List customSearchActions and rigths on their
$customSearchActions = array();
foreach(LSconfig :: get("LSobjects.$LSobject.LSsearch.customActions", array()) as $action_name => $action_config) {
$raw_action_rights = LSconfig :: get('rights', array(), 'array', $action_config);
$action_rights = array();
if (array_key_exists($LSobject, $authObjTypes))
$action_rights['self'] = in_array('self', $raw_action_rights);
foreach(array_keys($LSprofiles) as $LSprofile)
$action_rights[$LSprofile] = in_array($LSprofile, $raw_action_rights);
$customSearchActions[$action_name] = array (
'label' => __(LSconfig :: get('label', $action_name, 'string', $action_config)),
'rights' => $action_rights,
);
}
$LSobjects[$LSobject] = array ( $LSobjects[$LSobject] = array (
'label' => __(LSconfig :: get("LSobjects.$LSobject.label", $LSobject, 'string')), 'label' => __(LSconfig :: get("LSobjects.$LSobject.label", $LSobject, 'string')),
'attrs' => $attrs, 'attrs' => $attrs,
'relations' => $relations, 'relations' => $relations,
'customActions' => $customActions,
'customSearchActions' => $customSearchActions,
); );
} }

View file

@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: LdapSaisie\n" "Project-Id-Version: LdapSaisie\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n" "POT-Creation-Date: \n"
"PO-Revision-Date: 2020-09-22 18:12+0200\n" "PO-Revision-Date: 2020-09-23 14:08+0200\n"
"Last-Translator: Benjamin Renard <brenard@zionetrix.net>\n" "Last-Translator: Benjamin Renard <brenard@zionetrix.net>\n"
"Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise." "Language-Team: LdapSaisie <ldapsaisie-users@lists.labs.libre-entreprise."
"org>\n" "org>\n"
@ -229,7 +229,7 @@ msgstr ""
"défini." "défini."
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:52 #: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:52
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:155 #: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:187
msgid "Access rights matrix" msgid "Access rights matrix"
msgstr "Matrice des droits d'accès" msgstr "Matrice des droits d'accès"
@ -237,7 +237,7 @@ msgstr "Matrice des droits d'accès"
msgid "All connected users" msgid "All connected users"
msgstr "Tous les utilisateurs connectés" msgstr "Tous les utilisateurs connectés"
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:151 #: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:183
msgid "The user him-self" msgid "The user him-self"
msgstr "L'utilisateur lui-même" msgstr "L'utilisateur lui-même"
@ -2406,6 +2406,11 @@ msgstr "Madame"
msgid "Mr." msgid "Mr."
msgstr "Monsieur" msgstr "Monsieur"
#: templates/default/LSaccessRightsMatrixView.tpl:95
#: templates/default/LSaccessRightsMatrixView.tpl:129
msgid "Allowed"
msgstr "Autorisé"
#: templates/default/LSaccessRightsMatrixView.tpl:18 #: templates/default/LSaccessRightsMatrixView.tpl:18
msgid "Attributes / Profiles" msgid "Attributes / Profiles"
msgstr "Attributs / Profils" msgstr "Attributs / Profils"
@ -2422,6 +2427,19 @@ msgstr "Se connecter"
msgid "Connected as" msgid "Connected as"
msgstr "Connecté en tant que" msgstr "Connecté en tant que"
#: templates/default/LSaccessRightsMatrixView.tpl:87
msgid "Custom actions"
msgstr "Actions personnalisées"
#: templates/default/LSaccessRightsMatrixView.tpl:92
#: templates/default/LSaccessRightsMatrixView.tpl:126
msgid "Custom actions / Profiles"
msgstr "Actions personnalisées / Profils"
#: templates/default/LSaccessRightsMatrixView.tpl:121
msgid "Custom search actions"
msgstr "Actions personnalisées sur les recherches"
#: templates/default/error.tpl:16 #: templates/default/error.tpl:16
msgid "Details" msgid "Details"
msgstr "Détails" msgstr "Détails"
@ -2467,6 +2485,8 @@ msgstr "Langue"
#: templates/default/LSaccessRightsMatrixView.tpl:20 #: templates/default/LSaccessRightsMatrixView.tpl:20
#: templates/default/LSaccessRightsMatrixView.tpl:56 #: templates/default/LSaccessRightsMatrixView.tpl:56
#: templates/default/LSaccessRightsMatrixView.tpl:94
#: templates/default/LSaccessRightsMatrixView.tpl:128
msgid "Legend:" msgid "Legend:"
msgstr "Légende :" msgstr "Légende :"
@ -2562,6 +2582,16 @@ msgstr "Sujet"
msgid "Their relations with other objects" msgid "Their relations with other objects"
msgstr "Leurs relations avec les autres objets" msgstr "Leurs relations avec les autres objets"
#: templates/default/LSaccessRightsMatrixView.tpl:118
msgid "This object type has no configured custom action."
msgstr "Ce type d'objet n'a aucune action personnalisée de configurée."
#: templates/default/LSaccessRightsMatrixView.tpl:152
msgid "This object type has no configured custom search action."
msgstr ""
"Ce type d'objet n'a aucune action personnalisée sur les recherches de "
"configurée."
#: templates/default/LSaccessRightsMatrixView.tpl:84 #: templates/default/LSaccessRightsMatrixView.tpl:84
msgid "This object type has no configured relation." msgid "This object type has no configured relation."
msgstr "Ce type d'objet n'a aucune relation de configurée." msgstr "Ce type d'objet n'a aucune relation de configurée."

View file

@ -176,7 +176,7 @@ msgid "Access Right Matrix Support : The global array %{array} is not defined."
msgstr "" msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:52 #: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:52
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:155 #: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:187
msgid "Access rights matrix" msgid "Access rights matrix"
msgstr "" msgstr ""
@ -184,7 +184,7 @@ msgstr ""
msgid "All connected users" msgid "All connected users"
msgstr "" msgstr ""
#: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:151 #: /home/brenard/dev/ldapsaisie_clean3/src/includes/addons/LSaddons.LSaccessRightsMatrixView.php:183
msgid "The user him-self" msgid "The user him-self"
msgstr "" msgstr ""
@ -2059,6 +2059,11 @@ msgstr ""
msgid "Mr." msgid "Mr."
msgstr "" msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:95
#: templates/default/LSaccessRightsMatrixView.tpl:129
msgid "Allowed"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:18 #: templates/default/LSaccessRightsMatrixView.tpl:18
msgid "Attributes / Profiles" msgid "Attributes / Profiles"
msgstr "" msgstr ""
@ -2075,6 +2080,19 @@ msgstr ""
msgid "Connected as" msgid "Connected as"
msgstr "" msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:87
msgid "Custom actions"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:92
#: templates/default/LSaccessRightsMatrixView.tpl:126
msgid "Custom actions / Profiles"
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:121
msgid "Custom search actions"
msgstr ""
#: templates/default/error.tpl:16 #: templates/default/error.tpl:16
msgid "Details" msgid "Details"
msgstr "" msgstr ""
@ -2120,6 +2138,8 @@ msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:20 #: templates/default/LSaccessRightsMatrixView.tpl:20
#: templates/default/LSaccessRightsMatrixView.tpl:56 #: templates/default/LSaccessRightsMatrixView.tpl:56
#: templates/default/LSaccessRightsMatrixView.tpl:94
#: templates/default/LSaccessRightsMatrixView.tpl:128
msgid "Legend:" msgid "Legend:"
msgstr "" msgstr ""
@ -2215,6 +2235,14 @@ msgstr ""
msgid "Their relations with other objects" msgid "Their relations with other objects"
msgstr "" msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:118
msgid "This object type has no configured custom action."
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:152
msgid "This object type has no configured custom search action."
msgstr ""
#: templates/default/LSaccessRightsMatrixView.tpl:84 #: templates/default/LSaccessRightsMatrixView.tpl:84
msgid "This object type has no configured relation." msgid "This object type has no configured relation."
msgstr "" msgstr ""

View file

@ -83,6 +83,74 @@
{else} {else}
<p>{tr msg="This object type has no configured relation."} <p>{tr msg="This object type has no configured relation."}
{/if} {/if}
<h3>{tr msg="Custom actions"}</h3>
{if !empty($LSobjects[$LSobject]['customActions'])}
<table class="table-header-rotated">
<thead>
<th>
{tr msg="Custom actions / Profiles"}
<div id="LSaccessRightsMatrixView_legend">
<label>{tr msg="Legend:"}</label>
<span class='LSaccessRightsMatrixView_allowed'>X</span> = {tr msg="Allowed"}
</div>
</th>
{foreach $LSprofiles as $name => $label}
<th class="rotate-45"><div><span>{if $name != $label}<img class='LStips' src="{img name='help'}" alt='?' title='{$name|escape:'htmlall'}'/>{/if} {$label}</span></div></th>
{/foreach}
</thead>
<tbody>
{foreach $LSobjects[$LSobject]['customActions'] as $name => $conf}
<tr>
<th class="row-header">{$conf.label} <img class='LStips' src="{img name='help'}" alt='?' title='{$name|escape:'htmlall'}'/></th>
{foreach $LSprofiles as $profil => $profil_label}
<td class='LStips' title="{if $profil != $profil_label}{$profil_label} ({$profil}){else}{$profil}{/if}">
{if $conf.rights[$profil]}
<span class='LSaccessRightsMatrixView_allowed'>X</span>
{/if}
</td>
{/foreach}
</tr>
{/foreach}
</tbody>
</table>
{else}
<p>{tr msg="This object type has no configured custom action."}
{/if}
<h3>{tr msg="Custom search actions"}</h3>
{if !empty($LSobjects[$LSobject]['customSearchActions'])}
<table class="table-header-rotated">
<thead>
<th>
{tr msg="Custom actions / Profiles"}
<div id="LSaccessRightsMatrixView_legend">
<label>{tr msg="Legend:"}</label>
<span class='LSaccessRightsMatrixView_allowed'>X</span> = {tr msg="Allowed"}
</div>
</th>
{foreach $LSprofiles as $name => $label}
<th class="rotate-45"><div><span>{if $name != $label}<img class='LStips' src="{img name='help'}" alt='?' title='{$name|escape:'htmlall'}'/>{/if} {$label}</span></div></th>
{/foreach}
</thead>
<tbody>
{foreach $LSobjects[$LSobject]['customSearchActions'] as $name => $conf}
<tr>
<th class="row-header">{$conf.label} <img class='LStips' src="{img name='help'}" alt='?' title='{$name|escape:'htmlall'}'/></th>
{foreach $LSprofiles as $profil => $profil_label}
<td class='LStips' title="{if $profil != $profil_label}{$profil_label} ({$profil}){else}{$profil}{/if}">
{if $conf.rights[$profil]}
<span class='LSaccessRightsMatrixView_allowed'>X</span>
{/if}
</td>
{/foreach}
</tr>
{/foreach}
</tbody>
</table>
{else}
<p>{tr msg="This object type has no configured custom search action."}
{/if}
</div> </div>
</div> </div>
{/block} {/block}