mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
- Uniformisation du nom LSrelation (relations -> LSrelation)
This commit is contained in:
parent
fc9ebc382a
commit
b2e585b7c2
5 changed files with 28 additions and 28 deletions
|
@ -49,7 +49,7 @@ $GLOBALS['LSobjects']['LSeepeople'] = array (
|
||||||
'label' => _('Utilisateurs'),
|
'label' => _('Utilisateurs'),
|
||||||
|
|
||||||
// LSrelation
|
// LSrelation
|
||||||
'relations' => array(
|
'LSrelation' => array(
|
||||||
'groups' => array(
|
'groups' => array(
|
||||||
'label' => _('Appartient aux groupes...'),
|
'label' => _('Appartient aux groupes...'),
|
||||||
'emptyText' => _("N'appartient à aucun groupe."),
|
'emptyText' => _("N'appartient à aucun groupe."),
|
||||||
|
|
|
@ -41,7 +41,7 @@ class LSldapObject {
|
||||||
var $submitError=true;
|
var $submitError=true;
|
||||||
var $_whoami=NULL;
|
var $_whoami=NULL;
|
||||||
var $_subDn_value=NULL;
|
var $_subDn_value=NULL;
|
||||||
var $_relationsCache=array();
|
var $_LSrelationsCache=array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur
|
* Constructeur
|
||||||
|
@ -1123,17 +1123,17 @@ class LSldapObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methode créant la liste des objets en relations avec l'objet courant et qui
|
* Methode créant la liste des objets en relations avec l'objet courant et qui
|
||||||
* la met en cache ($this -> _relationsCache)
|
* la met en cache ($this -> _LSrelationsCache)
|
||||||
*
|
*
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function updateRelationsCache() {
|
function updateLSrelationsCache() {
|
||||||
$this -> _relationsCache=array();
|
$this -> _LSrelationsCache=array();
|
||||||
if (is_array($this->config['relations'])) {
|
if (is_array($this->config['LSrelation'])) {
|
||||||
$type = $this -> getType();
|
$type = $this -> getType();
|
||||||
$me = new $type();
|
$me = new $type();
|
||||||
$me -> loadData($this -> getDn());
|
$me -> loadData($this -> getDn());
|
||||||
foreach($this->config['relations'] as $relation_name => $relation_conf) {
|
foreach($this->config['LSrelation'] as $relation_name => $relation_conf) {
|
||||||
if ( isset($relation_conf['list_function']) ) {
|
if ( isset($relation_conf['list_function']) ) {
|
||||||
if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) {
|
if ($GLOBALS['LSsession'] -> loadLSobject($relation_conf['LSobject'])) {
|
||||||
$obj = new $relation_conf['LSobject']();
|
$obj = new $relation_conf['LSobject']();
|
||||||
|
@ -1143,7 +1143,7 @@ class LSldapObject {
|
||||||
// Key Value
|
// Key Value
|
||||||
$key = $obj -> $relation_conf['getkeyvalue_function']($me);
|
$key = $obj -> $relation_conf['getkeyvalue_function']($me);
|
||||||
|
|
||||||
$this -> _relationsCache[$relation_name] = array(
|
$this -> _LSrelationsCache[$relation_name] = array(
|
||||||
'list' => $list,
|
'list' => $list,
|
||||||
'keyvalue' => $key
|
'keyvalue' => $key
|
||||||
);
|
);
|
||||||
|
@ -1177,7 +1177,7 @@ class LSldapObject {
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function beforeRename() {
|
function beforeRename() {
|
||||||
return $this -> updateRelationsCache();
|
return $this -> updateLSrelationsCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1198,10 +1198,10 @@ class LSldapObject {
|
||||||
$GLOBALS['LSsession'] -> changeAuthUser($this);
|
$GLOBALS['LSsession'] -> changeAuthUser($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this -> _relationsCache as $relation_name => $objInfos) {
|
foreach($this -> _LSrelationsCache as $relation_name => $objInfos) {
|
||||||
if ((isset($this->config['relations'][$relation_name]['rename_function']))&&(is_array($objInfos['list']))) {
|
if ((isset($this->config['LSrelation'][$relation_name]['rename_function']))&&(is_array($objInfos['list']))) {
|
||||||
foreach($objInfos['list'] as $obj) {
|
foreach($objInfos['list'] as $obj) {
|
||||||
$meth = $this->config['relations'][$relation_name]['rename_function'];
|
$meth = $this->config['LSrelation'][$relation_name]['rename_function'];
|
||||||
if (method_exists($obj,$meth)) {
|
if (method_exists($obj,$meth)) {
|
||||||
if (!($obj -> $meth($this,$objInfos['keyvalue']))) {
|
if (!($obj -> $meth($this,$objInfos['keyvalue']))) {
|
||||||
$error=1;
|
$error=1;
|
||||||
|
@ -1226,7 +1226,7 @@ class LSldapObject {
|
||||||
* @retval True en cas de cas ce succès, False sinon.
|
* @retval True en cas de cas ce succès, False sinon.
|
||||||
*/
|
*/
|
||||||
function beforeDelete() {
|
function beforeDelete() {
|
||||||
return $this -> updateRelationsCache();
|
return $this -> updateLSrelationsCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1240,10 +1240,10 @@ class LSldapObject {
|
||||||
*/
|
*/
|
||||||
function afterDelete() {
|
function afterDelete() {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
foreach($this -> _relationsCache as $relation_name => $objInfos) {
|
foreach($this -> _LSrelationsCache as $relation_name => $objInfos) {
|
||||||
if ((isset($this->config['relations'][$relation_name]['remove_function']))&&(is_array($objInfos['list']))) {
|
if ((isset($this->config['LSrelation'][$relation_name]['remove_function']))&&(is_array($objInfos['list']))) {
|
||||||
foreach($objInfos['list'] as $obj) {
|
foreach($objInfos['list'] as $obj) {
|
||||||
$meth = $this->config['relations'][$relation_name]['remove_function'];
|
$meth = $this->config['LSrelation'][$relation_name]['remove_function'];
|
||||||
if (method_exists($obj,$meth)) {
|
if (method_exists($obj,$meth)) {
|
||||||
if (!($obj -> $meth($this))) {
|
if (!($obj -> $meth($this))) {
|
||||||
$error=1;
|
$error=1;
|
||||||
|
|
|
@ -1363,14 +1363,14 @@ class LSsession {
|
||||||
* @retval boolean True si l'utilisateur a accès, false sinon
|
* @retval boolean True si l'utilisateur a accès, false sinon
|
||||||
*/
|
*/
|
||||||
function relationCanAccess($dn,$LSobject,$relationName,$right=NULL) {
|
function relationCanAccess($dn,$LSobject,$relationName,$right=NULL) {
|
||||||
if (!isset($GLOBALS['LSobjects'][$LSobject]['relations'][$relationName]))
|
if (!isset($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]))
|
||||||
return;
|
return;
|
||||||
$whoami = $this -> whoami($dn);
|
$whoami = $this -> whoami($dn);
|
||||||
|
|
||||||
if (($right=='w') || ($right=='r')) {
|
if (($right=='w') || ($right=='r')) {
|
||||||
$r = 'n';
|
$r = 'n';
|
||||||
foreach($whoami as $who) {
|
foreach($whoami as $who) {
|
||||||
$nr = $GLOBALS['LSobjects'][$LSobject]['relations'][$relationName]['rights'][$who];
|
$nr = $GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who];
|
||||||
if($nr == 'w') {
|
if($nr == 'w') {
|
||||||
$r = 'w';
|
$r = 'w';
|
||||||
}
|
}
|
||||||
|
@ -1387,7 +1387,7 @@ class LSsession {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach($whoami as $who) {
|
foreach($whoami as $who) {
|
||||||
if (($GLOBALS['LSobjects'][$LSobject]['relations'][$relationName]['rights'][$who] == 'w') || ($GLOBALS['LSobjects'][$LSobject]['relations'][$relationName]['rights'][$who] == 'r')) {
|
if (($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who] == 'w') || ($GLOBALS['LSobjects'][$LSobject]['LSrelation'][$relationName]['rights'][$who] == 'r')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,8 +138,8 @@ if (!isset($_ERRORS)) {
|
||||||
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
|
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
|
||||||
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) {
|
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) {
|
||||||
$object = new $conf['objectType']();
|
$object = new $conf['objectType']();
|
||||||
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) {
|
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
|
||||||
$relationConf = $object->config['relations'][$conf['relationName']];
|
$relationConf = $object->config['LSrelation'][$conf['relationName']];
|
||||||
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
||||||
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
|
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
|
||||||
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
|
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
|
||||||
|
@ -184,8 +184,8 @@ if (!isset($_ERRORS)) {
|
||||||
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
|
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
|
||||||
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) {
|
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) {
|
||||||
$object = new $conf['objectType']();
|
$object = new $conf['objectType']();
|
||||||
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) {
|
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
|
||||||
$relationConf = $object->config['relations'][$conf['relationName']];
|
$relationConf = $object->config['LSrelation'][$conf['relationName']];
|
||||||
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
||||||
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
|
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
|
||||||
if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) {
|
if (is_array($_SESSION['LSselect'][$relationConf['LSobject']])) {
|
||||||
|
@ -246,8 +246,8 @@ if (!isset($_ERRORS)) {
|
||||||
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
|
$conf = $_SESSION['LSrelation'][$_REQUEST['id']];
|
||||||
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) {
|
if ($GLOBALS['LSsession']->loadLSobject($conf['objectType'])) {
|
||||||
$object = new $conf['objectType']();
|
$object = new $conf['objectType']();
|
||||||
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['relations'][$conf['relationName']]))) {
|
if (($object -> loadData($conf['objectDn'])) && (isset($object->config['LSrelation'][$conf['relationName']]))) {
|
||||||
$relationConf = $object->config['relations'][$conf['relationName']];
|
$relationConf = $object->config['LSrelation'][$conf['relationName']];
|
||||||
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
if ($GLOBALS['LSsession'] -> loadLSobject($relationConf['LSobject'])) {
|
||||||
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
|
if ($GLOBALS['LSsession'] -> relationCanEdit($object -> getValue('dn'),$object -> getType(),$conf['relationName'])) {
|
||||||
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
|
if (method_exists($relationConf['LSobject'],$relationConf['list_function'])) {
|
||||||
|
|
|
@ -78,11 +78,11 @@ if($LSsession -> startLSsession()) {
|
||||||
$view = $object -> getView();
|
$view = $object -> getView();
|
||||||
$view -> displayView();
|
$view -> displayView();
|
||||||
|
|
||||||
// Relations
|
// LSrelations
|
||||||
if (is_array($object -> config['relations'])) {
|
if (is_array($object -> config['LSrelation'])) {
|
||||||
$LSrelations=array();
|
$LSrelations=array();
|
||||||
$LSrelations_JSparams=array();
|
$LSrelations_JSparams=array();
|
||||||
foreach($object -> config['relations'] as $relationName => $relationConf) {
|
foreach($object -> config['LSrelation'] as $relationName => $relationConf) {
|
||||||
if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$LSobject,$relationName)) {
|
if ($GLOBALS['LSsession'] -> relationCanAccess($object -> getValue('dn'),$LSobject,$relationName)) {
|
||||||
$return=array(
|
$return=array(
|
||||||
'label' => $relationConf['label'],
|
'label' => $relationConf['label'],
|
||||||
|
|
Loading…
Reference in a new issue