diff --git a/doc/conf/LSaddon.docbook b/doc/conf/LSaddon.docbook index 8cdac298..f896ede0 100644 --- a/doc/conf/LSaddon.docbook +++ b/doc/conf/LSaddon.docbook @@ -11,6 +11,7 @@ &conf-LSaddon_asterisk; &conf-LSaddon_exportSearchResultAsCSV; + &conf-LSaddon_LSaccessRightsMatrixView; &conf-LSaddon_mail; &conf-LSaddon_maildir; &conf-LSaddon_mailquota; diff --git a/doc/conf/LSaddon/LSaddon.entities.xml b/doc/conf/LSaddon/LSaddon.entities.xml index 605791bf..f5f3aa2a 100644 --- a/doc/conf/LSaddon/LSaddon.entities.xml +++ b/doc/conf/LSaddon/LSaddon.entities.xml @@ -1,6 +1,7 @@ + diff --git a/doc/conf/LSaddon/LSaddon_LSaccessRightsMatrixView.docbook b/doc/conf/LSaddon/LSaddon_LSaccessRightsMatrixView.docbook new file mode 100644 index 00000000..35ec334f --- /dev/null +++ b/doc/conf/LSaddon/LSaddon_LSaccessRightsMatrixView.docbook @@ -0,0 +1,11 @@ + + LSaddon_LSaccessRightsMatrixView + Cet &LSaddon; offre une interface de visualisation des droits d'accès + des différents &LSprofiles; configurés. Pour chaque type d'objet, la matrice + des droits d'accès par attribut et par profil est affiché sous la forme d'un + tableau. + + Le fichier de configuration permet de définir au travers la variable + $GLOBALS['LSaccessRightsMatrixView_allowed_LSprofiles'] + la liste des &LSprofiles; autorisés à accéder à cette interface. + diff --git a/public_html/conf/LSaddons/config.LSaddons.LSaccessRightsMatrixView.php b/public_html/conf/LSaddons/config.LSaddons.LSaccessRightsMatrixView.php new file mode 100644 index 00000000..761b8de1 --- /dev/null +++ b/public_html/conf/LSaddons/config.LSaddons.LSaccessRightsMatrixView.php @@ -0,0 +1,32 @@ + + * + * @retval boolean true if LSaccessRightsMatrixView addon is totally supported, false in other case + */ +function LSaddon_LSaccessRightsMatrixView_support() { + $retval = True; + $MUST_DEFINE_ARRAY= array( + 'LSaccessRightsMatrixView_allowed_LSprofiles', + ); + foreach($MUST_DEFINE_ARRAY as $array) { + if ( !isset($GLOBALS[$array]) || !is_array($GLOBALS[$array])) { + LSerror :: addErrorCode('LSACCESSRIGHTSMATRIXVIEW_SUPPORT_01',$array); + $retval=false; + } + } + + if ($retval) + $retval = LSsession :: registerLSaddonView( + 'LSaccessRightsMatrixView', + 'accessRightsMatrix', + _('Access rights matrix'), + 'LSaccessRightsMatrixView', + $GLOBALS['LSaccessRightsMatrixView_allowed_LSprofiles'] + ); + + return $retval; +} + +function LSaccessRightsMatrixView() { + $LSprofiles = LSsession :: $ldapServer["LSprofiles"]; + $LSobjects = array(); + foreach (LSsession :: $ldapServer["LSaccess"] as $LSobject) { + if (!LSsession :: loadLSobject($LSobject)) + continue; + $attrs = array(); + foreach(LSconfig :: get("LSobjects.$LSobject.attrs", array()) as $attr_name => $attr_config) { + $raw_attr_rights = LSconfig :: get('rights', array(), 'array', $attr_config); + $attr_rights = array(); + foreach(array_keys($LSprofiles) as $LSprofile) { + $attr_rights[$LSprofile] = LSconfig :: get($LSprofile, False, null, $raw_attr_rights); + } + $attrs[$attr_name] = array ( + 'label' => __(LSconfig :: get('label', $attr_name, 'string', $attr_config)), + 'rights' => $attr_rights, + ); + } + $LSobjects[$LSobject] = array ( + 'label' => __(LSconfig :: get("LSobjects.$LSobject.label", $LSobject, 'string')), + 'attrs' => $attrs, + ); + } + + // Determine current LSobject + reset($LSobjects); + $LSobject = (isset($_REQUEST['LSobject']) && array_key_exists($_REQUEST['LSobject'], $LSobjects)?$_REQUEST['LSobject']:key($LSobjects)); + + LStemplate :: assign('pagetitle', _('Access rights matrix')); + LStemplate :: assign('LSprofiles', $LSprofiles); + LStemplate :: assign('LSobjects', $LSobjects); + LStemplate :: assign('LSobject', $LSobject); + + LSsession :: addCssFile('LSaccessRightsMatrixView.css'); + LSsession :: setTemplate('LSaccessRightsMatrixView.tpl'); +} diff --git a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo index 7c6fd047..0df0c30b 100644 Binary files a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo and b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.mo differ diff --git a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po index d6a43325..50a40364 100644 --- a/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po +++ b/public_html/lang/fr_FR.UTF8/LC_MESSAGES/ldapsaisie.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: LdapSaisie\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2019-07-02 14:20+0200\n" +"PO-Revision-Date: 2019-10-10 18:16+0200\n" "Last-Translator: Benjamin Renard \n" "Language-Team: LdapSaisie \n" @@ -329,6 +329,17 @@ msgstr "Entité %{id} (non-reconnue)" msgid "%{value} (unrecognized value)" msgstr "%{value} (valeur non-reconnue)" +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:26 +msgid "Access Right Matrix Support : The global array %{array} is not defined." +msgstr "" +"Support Matrice des droits d'accès : Le tableau global %{array} n'est pas " +"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 +msgid "Access rights matrix" +msgstr "Matrice des droits d'accès" + #: /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é." @@ -1765,39 +1776,39 @@ msgstr "Étape" msgid "Pedagogical element" msgstr "Élement pédagogique" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1055 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1087 msgid "Actions" msgstr "Actions" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1058 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1090 #: templates/default/global_search.tpl:25 msgid "This search didn't get any result." msgstr "Cette recherche n'a retournée aucun résultat" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1310 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1342 msgid "LSsearch : Invalid filter : %{filter}." msgstr "LSsearch : Filtre invalide : %{filter}." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1313 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1345 msgid "LSsearch : Invalid basedn : %{basedn}." msgstr "LSsearch : Base DN invalide." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1316 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1348 msgid "LSsearch : Invalid value for %{param} parameter." msgstr "LSsearch : La valeur du paramètre %{param} est incorrecte." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1319 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1351 msgid "" "LSsearch : Invalid size limit. Must be an integer greater or equal to 0." msgstr "" "LSsearch : Limite de taille de recherche invalide. Elle doit être un entier " "supérieur ou égal à 0." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1322 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1354 msgid "LSsearch : Invalid parameter %{attr}. Must be an boolean." msgstr "LSsearch : Paramètre %{param} invalide. Il doit être un booléen." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1325 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1357 msgid "" "LSsearch : Invalid parameter attributes. Must be an string or an array of " "strings." @@ -1805,13 +1816,13 @@ msgstr "" "LSsearch : Paramètre 'attributes' invalide. Il doit être une chaîne de " "caractères ou un tableau de chaînes de caractères." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1328 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1360 msgid "LSsearch : Can't build attributes list for make filter." msgstr "" "LSsearch : Impossible de construire la liste des attributs pour faire le " "filtre." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1331 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1363 msgid "" "LSsearch : Error building filter with attribute '%{attr}' and pattern " "'%{pattern}'" @@ -1819,34 +1830,34 @@ msgstr "" "LSsearch : Problème en construisant le filtre avec l'attribut '%{attr}' et " "le mot clé '%{pattern}'" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1334 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1366 msgid "LSsearch : Error combining filters." msgstr "LSsearch : Problème en combinant les filtres." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1337 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1369 msgid "LSsearch : Invalid pattern." msgstr "LSsearch : Mot clé invalide." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1340 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1372 msgid "LSsearch : Invalid attribute %{attr} in parameters." msgstr "LSsearch : Attribut %{attr} incorrect dans les paramètres." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1343 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1375 msgid "LSsearch : Error during the search." msgstr "LSsearch : Erreur pendant la recherche." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1346 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1378 msgid "LSsearch : Error sorting the search." msgstr "LSsearch : Erreur pendant le trie de la recherche." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1349 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1381 msgid "" "LSsearch : The function of the custum information %{name} is not callable." msgstr "" "LSsearch : La fonction de l'information personnalisée %{name} n'est pas " "exécutable." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1352 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1384 msgid "" "LSsearch : Invalid predefinedFilter for LSobject type %{type} : %{label} " "(filter : %{filter})." @@ -1854,13 +1865,13 @@ msgstr "" "LSsearch : PredefinedFilter invalide pour le type d'LSobject %{type} : " "%{label} (filtre : %{filter})." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1355 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1387 msgid "LSsearch : Error during execution of the custom action %{customAction}." msgstr "" "LSldapObject : Erreur durant l'exécution de l'action personnalisée " "%{customAction}." -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1358 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1390 msgid "LSsearch : Invalid search pattern." msgstr "LSsearch : Mot clé de recherche invalide" @@ -2049,6 +2060,10 @@ msgstr "" "Une erreur irrécupérable est survenue. Si le problème persiste, merci de " "contacter le support." +#: templates/default/LSaccessRightsMatrixView.tpl:15 +msgid "Attributes / Profiles" +msgstr "Attributs / Profils" + #: templates/default/fatal_error.tpl:23 msgid "Details" msgstr "Détails" @@ -2070,6 +2085,10 @@ msgstr "Recherche globale" msgid "Imported objects" msgstr "Objets importés" +#: templates/default/viewSearch.tpl:120 +msgid "Nb / page :" +msgstr "Nb / page :" + #: templates/default/import.tpl:74 msgid "No imported object" msgstr "Aucun objet importé" @@ -2082,6 +2101,14 @@ msgstr "Aucune valeur" msgid "Only validate data" msgstr "Validation des données uniquement" +#: templates/default/LSaccessRightsMatrixView.tpl:27 +msgid "Readable" +msgstr "Lecture" + +#: templates/default/LSaccessRightsMatrixView.tpl:29 +msgid "Readable / Writable" +msgstr "Lecture / Écriture" + #: templates/default/top.tpl:62 msgid "Refresh my access rights" msgstr "Rafraîchir mes droits d'accès" diff --git a/public_html/lang/ldapsaisie.pot b/public_html/lang/ldapsaisie.pot index 6ea2c240..1f6ca8d8 100644 --- a/public_html/lang/ldapsaisie.pot +++ b/public_html/lang/ldapsaisie.pot @@ -275,6 +275,15 @@ msgstr "" msgid "%{value} (unrecognized value)" msgstr "" +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.LSaccessRightsMatrixView.php:26 +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 +msgid "Access rights matrix" +msgstr "" + #: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/addons/LSaddons.ftp.php:27 msgid "FTP Support : Pear::Net_FTP is missing." msgstr "" @@ -1498,88 +1507,88 @@ msgstr "" msgid "Pedagogical element" msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1055 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1087 msgid "Actions" msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1058 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1090 #: templates/default/global_search.tpl:25 msgid "This search didn't get any result." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1310 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1342 msgid "LSsearch : Invalid filter : %{filter}." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1313 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1345 msgid "LSsearch : Invalid basedn : %{basedn}." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1316 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1348 msgid "LSsearch : Invalid value for %{param} parameter." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1319 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1351 msgid "" "LSsearch : Invalid size limit. Must be an integer greater or equal to 0." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1322 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1354 msgid "LSsearch : Invalid parameter %{attr}. Must be an boolean." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1325 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1357 msgid "" "LSsearch : Invalid parameter attributes. Must be an string or an array of " "strings." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1328 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1360 msgid "LSsearch : Can't build attributes list for make filter." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1331 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1363 msgid "" "LSsearch : Error building filter with attribute '%{attr}' and pattern " "'%{pattern}'" msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1334 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1366 msgid "LSsearch : Error combining filters." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1337 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1369 msgid "LSsearch : Invalid pattern." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1340 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1372 msgid "LSsearch : Invalid attribute %{attr} in parameters." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1343 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1375 msgid "LSsearch : Error during the search." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1346 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1378 msgid "LSsearch : Error sorting the search." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1349 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1381 msgid "" "LSsearch : The function of the custum information %{name} is not callable." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1352 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1384 msgid "" "LSsearch : Invalid predefinedFilter for LSobject type %{type} : %{label} " "(filter : %{filter})." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1355 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1387 msgid "LSsearch : Error during execution of the custom action %{customAction}." msgstr "" -#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1358 +#: /home/brenard/dev/ldapsaisie_clean3/public_html/includes/class/class.LSsearch.php:1390 msgid "LSsearch : Invalid search pattern." msgstr "" @@ -1748,6 +1757,10 @@ msgstr "" msgid "A fatal error occured. If problem persist, please contact support." msgstr "" +#: templates/default/LSaccessRightsMatrixView.tpl:15 +msgid "Attributes / Profiles" +msgstr "" + #: templates/default/fatal_error.tpl:23 msgid "Details" msgstr "" @@ -1769,6 +1782,10 @@ msgstr "" msgid "Imported objects" msgstr "" +#: templates/default/viewSearch.tpl:120 +msgid "Nb / page :" +msgstr "" + #: templates/default/import.tpl:74 msgid "No imported object" msgstr "" @@ -1781,6 +1798,14 @@ msgstr "" msgid "Only validate data" msgstr "" +#: templates/default/LSaccessRightsMatrixView.tpl:27 +msgid "Readable" +msgstr "" + +#: templates/default/LSaccessRightsMatrixView.tpl:29 +msgid "Readable / Writable" +msgstr "" + #: templates/default/top.tpl:62 msgid "Refresh my access rights" msgstr "" diff --git a/public_html/templates/default/LSaccessRightsMatrixView.tpl b/public_html/templates/default/LSaccessRightsMatrixView.tpl new file mode 100644 index 00000000..f322c19a --- /dev/null +++ b/public_html/templates/default/LSaccessRightsMatrixView.tpl @@ -0,0 +1,39 @@ +{include file='ls:top.tpl'} +
+

{$pagetitle}

+ + +
+

{$LSobjects[$LSobject]['label']}

+ + + + + {foreach $LSprofiles as $name => $conf} + + {/foreach} + + + {foreach $LSobjects[$LSobject]['attrs'] as $name => $conf} + + + {foreach $LSprofiles as $profil => $profil_conf} + + {/foreach} + + {/foreach} + +
{tr msg="Attributes / Profiles"}{$name}
{$conf.label} + {if $conf.rights[$profil] == 'r'} + {tr msg="Readable"} + {elseif $conf.rights[$profil] == 'w'} + {tr msg="Readable / Writable"} + {/if} +
+
+
+{include file='ls:bottom.tpl'}