LSobject/LSsession : Added feature to globally disable object creation with configuration parameter

This commit is contained in:
Benjamin Renard 2010-08-02 14:39:50 +02:00
parent 94e5697ab5
commit d5baeb10e4
2 changed files with 16 additions and 0 deletions

View file

@ -34,6 +34,8 @@
// lors de la création nouveau subDn // lors de la création nouveau subDn
), ),
'disable_creation' => [boolean]',
'before_modify' => 'function1', 'before_modify' => 'function1',
'after_modify' => 'function2', 'after_modify' => 'function2',
'after_create' => 'function3', 'after_create' => 'function3',
@ -119,6 +121,14 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>disable_creation</term>
<listitem>
<simpara>Booléen permetant de desactiver la creation de ce type d'objet de
manière globale.</simpara>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>before_modify</term> <term>before_modify</term>
<listitem> <listitem>

View file

@ -1844,6 +1844,12 @@ class LSsession {
* @retval boolean True si l'utilisateur a accès, false sinon * @retval boolean True si l'utilisateur a accès, false sinon
*/ */
public static function canCreate($LSobject) { public static function canCreate($LSobject) {
if (!self :: loadLSobject($LSobject)) {
return;
}
if (LSconfig :: get("LSobjects.$LSobject.disable_creation")) {
return;
}
return self :: canAccess($LSobject,NULL,'w','rdn'); return self :: canAccess($LSobject,NULL,'w','rdn');
} }