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>... <citetitle>Structure</citetitle>...
<![CDATA['LSprofile' => array ( <![CDATA['LSprofile' => array (
[nom d'un LSprofile] => array ( [nom d'un LSprofile] => array (
[label] => [label du LSprofile],
[basedn] => [dn utilisateur], [basedn] => [dn utilisateur],
[autre basedn] => array ( [autre basedn] => array (
[dn d'un utilisateur] => NULL, [dn d'un utilisateur] => NULL,
@ -282,6 +283,10 @@ objets retournés. Les paramètres de la recherche sont&nbsp;:
</itemizedlist> </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> </sect4>
<!-- Fin LSprofiles --> <!-- Fin LSprofiles -->

View file

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

View file

@ -63,7 +63,7 @@ function LSaccessRightsMatrixView() {
); );
if (isset(LSsession :: $ldapServer["LSprofiles"]) && is_array(LSsession :: $ldapServer["LSprofiles"])) if (isset(LSsession :: $ldapServer["LSprofiles"]) && is_array(LSsession :: $ldapServer["LSprofiles"]))
foreach(LSsession :: $ldapServer["LSprofiles"] as $LSprofile => $LSprofile_conf) foreach(LSsession :: $ldapServer["LSprofiles"] as $LSprofile => $LSprofile_conf)
$LSprofiles[$LSprofile] = $LSprofile; $LSprofiles[$LSprofile] = (isset($LSprofile_conf['label'])?__($LSprofile_conf['label']):$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))

View file

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