LSprofiles : add possibility to configure them a label

This commit is contained in:
Benjamin Renard 2019-10-14 12:59:37 +02:00
parent b1252ea0bf
commit e5ad1dfd44
4 changed files with 13 additions and 2 deletions

View file

@ -16,6 +16,7 @@
<citetitle>Structure</citetitle>...
<![CDATA['LSprofile' => array (
[nom d'un LSprofile] => array (
[label] => [label du LSprofile],
[basedn] => [dn utilisateur],
[autre basedn] => array (
[dn d'un utilisateur] => NULL,
@ -282,6 +283,10 @@ objets retournés. Les paramètres de la recherche sont&nbsp;:
</itemizedlist>
<para>Par ailleurs, il est possible d'attribuer un label plus explicite à chaque
<emphasis>LSprofile</emphasis> à l'aide de la clé <literal>label</literal>. Ce
label sera utilisé pour faire référence au <emphasis>LSprofile</emphasis> lorsque
nécéssaire. <emphasis>(Paramètre facultatif)</emphasis></para>
</sect4>
<!-- Fin LSprofiles -->

View file

@ -52,6 +52,7 @@ $GLOBALS['LSconfig'] = array(
*/
'LSprofiles' => array (
'admin' => array (
'label' => 'Administrator',
'o=ls' => array (
'uid=eeggs,ou=people,o=ls' => NULL
),
@ -63,6 +64,7 @@ $GLOBALS['LSconfig'] = array(
)
),
'godfather' => array (
'label' => 'Godfather',
'LSobjects' => array (
'LSpeople' => array (
'attr' => 'lsGodfatherDn',

View file

@ -63,7 +63,7 @@ function LSaccessRightsMatrixView() {
);
if (isset(LSsession :: $ldapServer["LSprofiles"]) && is_array(LSsession :: $ldapServer["LSprofiles"]))
foreach(LSsession :: $ldapServer["LSprofiles"] as $LSprofile => $LSprofile_conf)
$LSprofiles[$LSprofile] = $LSprofile;
$LSprofiles[$LSprofile] = (isset($LSprofile_conf['label'])?__($LSprofile_conf['label']):$LSprofile);
$LSobjects = array();
foreach (LSsession :: $ldapServer["LSaccess"] as $LSobject) {
if (!LSsession :: loadLSobject($LSobject))

View file

@ -1659,11 +1659,15 @@ class LSsession {
foreach (self :: $ldapServer['LSprofiles'] as $profile => $profileInfos) {
if (is_array($profileInfos)) {
foreach ($profileInfos as $topDn => $rightsInfos) {
// Do not handle 'label' key as a topDn
if ($topDn == 'label') {
continue;
}
/*
* If $topDn == 'LSobject', we search for each LSobject type to find
* all items on witch the user will have powers.
*/
if ($topDn == 'LSobjects') {
elseif ($topDn == 'LSobjects') {
if (is_array($rightsInfos)) {
foreach ($rightsInfos as $LSobject => $listInfos) {
LSdebug('loading LSprofile ' . $profile . ' for LSobject ' . $LSobject . ' with params ' . var_export($listInfos, true));