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() { 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(); $LSobjects = array();
foreach (LSsession :: $ldapServer["LSaccess"] as $LSobject) { foreach (LSsession :: $ldapServer["LSaccess"] as $LSobject) {
if (!LSsession :: loadLSobject($LSobject)) if (!LSsession :: loadLSobject($LSobject))
@ -67,6 +72,8 @@ function LSaccessRightsMatrixView() {
foreach(LSconfig :: get("LSobjects.$LSobject.attrs", array()) as $attr_name => $attr_config) { foreach(LSconfig :: get("LSobjects.$LSobject.attrs", array()) as $attr_name => $attr_config) {
$raw_attr_rights = LSconfig :: get('rights', array(), 'array', $attr_config); $raw_attr_rights = LSconfig :: get('rights', array(), 'array', $attr_config);
$attr_rights = array(); $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) { foreach(array_keys($LSprofiles) as $LSprofile) {
$attr_rights[$LSprofile] = LSconfig :: get($LSprofile, False, null, $raw_attr_rights); $attr_rights[$LSprofile] = LSconfig :: get($LSprofile, False, null, $raw_attr_rights);
} }
@ -85,6 +92,9 @@ function LSaccessRightsMatrixView() {
reset($LSobjects); reset($LSobjects);
$LSobject = (isset($_REQUEST['LSobject']) && array_key_exists($_REQUEST['LSobject'], $LSobjects)?$_REQUEST['LSobject']:key($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('pagetitle', _('Access rights matrix'));
LStemplate :: assign('LSprofiles', $LSprofiles); LStemplate :: assign('LSprofiles', $LSprofiles);
LStemplate :: assign('LSobjects', $LSobjects); LStemplate :: assign('LSobjects', $LSobjects);

View file

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