LSaccessRightsMatrixView : show rights of default LSprofiles self and user

This commit is contained in:
Benjamin Renard 2019-10-14 12:14:20 +02:00
parent c74f0cf4bd
commit 4b1c6a2acf
2 changed files with 13 additions and 3 deletions

View file

@ -58,7 +58,12 @@ function LSaddon_LSaccessRightsMatrixView_support() {
}
function LSaccessRightsMatrixView() {
$LSprofiles = LSsession :: $ldapServer["LSprofiles"];
$LSprofiles = array(
'user' => _('All connected users'),
);
if (isset(LSsession :: $ldapServer["LSprofiles"]) && is_array(LSsession :: $ldapServer["LSprofiles"]))
foreach(LSsession :: $ldapServer["LSprofiles"] as $LSprofile => $LSprofile_conf)
$LSprofiles[$LSprofile] = $LSprofile;
$LSobjects = array();
foreach (LSsession :: $ldapServer["LSaccess"] as $LSobject) {
if (!LSsession :: loadLSobject($LSobject))
@ -67,6 +72,8 @@ function LSaccessRightsMatrixView() {
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();
if ($LSobject == LSsession :: $ldapServer["authObjectType"])
$attr_rights['self'] = LSconfig :: get('self', False, null, $raw_attr_rights);
foreach(array_keys($LSprofiles) as $LSprofile) {
$attr_rights[$LSprofile] = LSconfig :: get($LSprofile, False, null, $raw_attr_rights);
}
@ -85,6 +92,9 @@ function LSaccessRightsMatrixView() {
reset($LSobjects);
$LSobject = (isset($_REQUEST['LSobject']) && array_key_exists($_REQUEST['LSobject'], $LSobjects)?$_REQUEST['LSobject']:key($LSobjects));
if ($LSobject == LSsession :: $ldapServer["authObjectType"])
$LSprofiles = array_merge(array('self' => _('The user him-self')), $LSprofiles);
LStemplate :: assign('pagetitle', _('Access rights matrix'));
LStemplate :: assign('LSprofiles', $LSprofiles);
LStemplate :: assign('LSobjects', $LSobjects);

View file

@ -13,8 +13,8 @@
<table>
<thead>
<th>{tr msg="Attributes / Profiles"}</th>
{foreach $LSprofiles as $name => $conf}
<th>{$name}</th>
{foreach $LSprofiles as $name => $label}
<th>{$label}</th>
{/foreach}
</thead>
<tbody>