2007-03-29 18:10:14 +02:00
|
|
|
<?php
|
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (C) 2007 Easter-eggs
|
|
|
|
* http://ldapsaisie.labs.libre-entreprise.org
|
|
|
|
*
|
|
|
|
* Author: See AUTHORS file in top-level directory.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License version 2
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
2009-01-24 18:45:14 +01:00
|
|
|
LSsession :: loadLSclass('LSattribute');
|
2007-03-29 18:10:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Base d'un objet ldap
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette classe définis la base de tout objet ldap géré par LdapSaisie
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*/
|
|
|
|
class LSldapObject {
|
2008-02-08 18:39:24 +01:00
|
|
|
|
2008-04-25 15:48:12 +02:00
|
|
|
var $config = array();
|
2008-02-08 18:39:24 +01:00
|
|
|
var $type_name;
|
2008-04-25 15:48:12 +02:00
|
|
|
var $attrs = array();
|
2007-03-29 18:10:14 +02:00
|
|
|
var $forms;
|
2008-02-08 18:39:24 +01:00
|
|
|
var $view;
|
2007-03-29 18:10:14 +02:00
|
|
|
var $dn=false;
|
2009-03-09 13:42:03 +01:00
|
|
|
var $oldDn=false;
|
2007-03-29 18:10:14 +02:00
|
|
|
var $other_values=array();
|
2008-02-08 18:39:24 +01:00
|
|
|
var $_whoami=NULL;
|
2009-01-08 00:06:05 +01:00
|
|
|
var $_LSrelationsCache=array();
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
var $_events=array();
|
|
|
|
var $_objectEvents=array();
|
2007-03-29 18:10:14 +02:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
var $cache=array();
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
/**
|
|
|
|
* Constructeur
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette methode construit l'objet et définis la configuration.
|
|
|
|
* Elle lance la construction du tableau d'attributs représentés par un objet LSattribute.
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si l'objet a été construit, false sinon.
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2009-03-22 14:20:22 +01:00
|
|
|
function LSldapObject() {
|
|
|
|
$this -> type_name = get_class($this);
|
2009-03-25 18:46:48 +01:00
|
|
|
$config = LSconfig :: get('LSobjects.'.$this -> type_name);
|
|
|
|
if(is_array($config)) {
|
|
|
|
$this -> config = $config;
|
2009-03-22 14:20:22 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_01');
|
|
|
|
return;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
2009-03-22 14:20:22 +01:00
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
foreach($this -> config['attrs'] as $attr_name => $attr_config) {
|
|
|
|
if(!$this -> attrs[$attr_name]=new LSattribute($attr_name,$attr_config,$this)) {
|
2007-03-29 18:10:14 +02:00
|
|
|
return;
|
2007-11-15 19:07:24 +01:00
|
|
|
}
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
return true;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Charge les données de l'objet
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette methode définis le DN de l'objet et charge les valeurs de attributs de l'objet
|
|
|
|
* Ã partir de l'annuaire.
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $dn string Le DN de l'objet.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si la chargement a réussi, false sinon.
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-03-29 18:10:14 +02:00
|
|
|
function loadData($dn) {
|
2008-02-12 18:59:44 +01:00
|
|
|
$this -> dn = $dn;
|
2009-01-25 15:37:03 +01:00
|
|
|
$data = LSldap :: getAttrs($dn);
|
2008-02-12 18:59:44 +01:00
|
|
|
if(!empty($data)) {
|
2008-02-08 18:39:24 +01:00
|
|
|
foreach($this -> attrs as $attr_name => $attr) {
|
2010-11-08 17:04:14 +01:00
|
|
|
if( !$this -> attrs[$attr_name] -> loadData( (isset($data[$attr_name])?$data[$attr_name]:NULL) ) )
|
2008-02-08 18:39:24 +01:00
|
|
|
return;
|
|
|
|
}
|
2010-04-26 14:08:56 +02:00
|
|
|
$this->cache=array();
|
2008-02-08 18:39:24 +01:00
|
|
|
return true;
|
2008-02-12 18:59:44 +01:00
|
|
|
}
|
|
|
|
return;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
|
2007-11-15 19:07:24 +01:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Recharge les données de l'objet
|
2007-11-15 19:07:24 +01:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si la rechargement a réussi, false sinon.
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-11-15 19:07:24 +01:00
|
|
|
function reloadData() {
|
2009-01-25 15:37:03 +01:00
|
|
|
$data = LSldap :: getAttrs($this -> dn);
|
2007-11-15 19:07:24 +01:00
|
|
|
foreach($this -> attrs as $attr_name => $attr) {
|
2010-11-25 12:23:56 +01:00
|
|
|
if(!$this -> attrs[$attr_name] -> reloadData( (isset($data[$attr_name])?$data[$attr_name]:NULL) ))
|
2007-11-15 19:07:24 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
/**
|
|
|
|
* Retourne le format d'affichage de l'objet
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @retval string Format d'affichage de l'objet.
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2009-01-07 20:24:14 +01:00
|
|
|
function getDisplayNameFormat() {
|
|
|
|
return $this -> config['display_name_format'];
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2007-03-29 18:10:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne la valeur descriptive d'affichage de l'objet
|
|
|
|
*
|
|
|
|
* Cette fonction retourne la valeur descriptive d'affichage de l'objet en fonction
|
2008-10-14 13:58:00 +02:00
|
|
|
* du format défini dans la configuration de l'objet ou spécifié en paramètre.
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $spe [<i>optionnel</i>] string Format d'affichage de l'objet
|
2008-07-05 22:28:49 +02:00
|
|
|
* @param[in] $full [<i>optionnel</i>] boolean True pour afficher en plus le
|
|
|
|
* subDnName
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @retval string Valeur descriptive d'affichage de l'objet
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2009-01-07 20:24:14 +01:00
|
|
|
function getDisplayName($spe='',$full=false) {
|
2007-03-29 18:10:14 +02:00
|
|
|
if ($spe=='') {
|
2009-01-07 20:24:14 +01:00
|
|
|
$spe = $this -> getDisplayNameFormat();
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
2012-09-02 19:56:22 +02:00
|
|
|
$val = $this -> getFData($spe,$this -> attrs,'getDisplayValue');
|
2009-01-24 18:45:14 +01:00
|
|
|
if (LSsession :: haveSubDn() && $full) {
|
2009-10-30 01:03:17 +01:00
|
|
|
$val.=' ('.$this -> subDnName.')';
|
2008-07-05 22:28:49 +02:00
|
|
|
}
|
|
|
|
return $val;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Chaine formatée
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette fonction retourne la valeur d'une chaine formatée en prennant les valeurs
|
2007-03-29 18:10:14 +02:00
|
|
|
* de l'objet.
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $format string Format de la chaine
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval string Valeur d'une chaine formatée
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-03-29 18:10:14 +02:00
|
|
|
function getFData($format) {
|
|
|
|
$format=getFData($format,$this,'getValue');
|
|
|
|
return $format;
|
|
|
|
}
|
2011-01-20 10:32:26 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Chaine formatee
|
|
|
|
*
|
2011-01-20 12:12:05 +01:00
|
|
|
* Cette fonction retourne la valeur d'une chaine formatee en prennant les valeurs
|
2011-01-20 10:32:26 +01:00
|
|
|
* d'affichage de l'objet.
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $format string Format de la chaine
|
|
|
|
*
|
|
|
|
* @retval string Valeur d'une chaine formatee
|
|
|
|
*/
|
|
|
|
function getDisplayFData($format) {
|
2011-01-20 12:12:05 +01:00
|
|
|
return getFData($format,$this,'getDisplayValue');
|
2011-01-20 10:32:26 +01:00
|
|
|
}
|
2007-03-29 18:10:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construit un formulaire de l'objet
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode construit un formulaire LSform à partir de la configuration de l'objet
|
2007-03-29 18:10:14 +02:00
|
|
|
* et de chaque attribut.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $idForm [<b>required</b>] Identifiant du formulaire a créer
|
|
|
|
* @param[in] $load DN d'un objet similaire dont la valeur des attribut doit être chargé dans le formulaire.
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval LSform Le formulaire crée
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2008-02-12 18:59:44 +01:00
|
|
|
function getForm($idForm,$load=NULL) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSsession :: loadLSclass('LSform');
|
2007-11-15 19:07:24 +01:00
|
|
|
$LSform = new LSform($this,$idForm);
|
2008-02-12 18:59:44 +01:00
|
|
|
$this -> forms[$idForm] = array($LSform,$load);
|
|
|
|
|
|
|
|
if ($load) {
|
|
|
|
$type = $this -> getType();
|
|
|
|
$loadObject = new $type();
|
|
|
|
if (!$loadObject -> loadData($load)) {
|
|
|
|
$load=false;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
}
|
2008-02-12 18:59:44 +01:00
|
|
|
|
|
|
|
if ($load) {
|
|
|
|
foreach($this -> attrs as $attr_name => $attr) {
|
2008-11-10 00:55:17 +01:00
|
|
|
if(!$this -> attrs[$attr_name] -> addToForm($LSform,$idForm,$this,$loadObject -> attrs[$attr_name] -> getFormVal())) {
|
2008-02-12 18:59:44 +01:00
|
|
|
$LSform -> can_validate = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
foreach($this -> attrs as $attr_name => $attr) {
|
|
|
|
if(!$this -> attrs[$attr_name] -> addToForm($LSform,$idForm,$this)) {
|
|
|
|
$LSform -> can_validate = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-03-29 18:10:14 +02:00
|
|
|
return $LSform;
|
|
|
|
}
|
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
/**
|
|
|
|
* Construit un formulaire de l'objet
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode construit un formulaire LSform à partir de la configuration de l'objet
|
2008-02-08 18:39:24 +01:00
|
|
|
* et de chaque attribut.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $idForm [<b>required</b>] Identifiant du formulaire a créer
|
|
|
|
* @param[in] $config Configuration spécifique pour le formulaire
|
2008-02-08 18:39:24 +01:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval LSform Le formulaire crée
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
|
|
|
function getView() {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSsession :: loadLSclass('LSform');
|
2008-02-08 18:39:24 +01:00
|
|
|
$this -> view = new LSform($this,'view');
|
|
|
|
foreach($this -> attrs as $attr_name => $attr) {
|
|
|
|
$this -> attrs[$attr_name] -> addToView($this -> view);
|
|
|
|
}
|
|
|
|
$this -> view -> can_validate = false;
|
|
|
|
return $this -> view;
|
|
|
|
}
|
|
|
|
|
2007-11-15 19:07:24 +01:00
|
|
|
/**
|
|
|
|
* Rafraichis le formulaire de l'objet
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode recharge les données d'un formulaire LSform.
|
2007-11-15 19:07:24 +01:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $idForm [<b>required</b>] Identifiant du formulaire a créer
|
2007-11-15 19:07:24 +01:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true sile formulaire a été rafraichis, false sinon
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-11-15 19:07:24 +01:00
|
|
|
function refreshForm($idForm) {
|
|
|
|
$LSform = $this -> forms[$idForm][0];
|
|
|
|
foreach($this -> attrs as $attr_name => $attr) {
|
|
|
|
if(!$this -> attrs[$attr_name] -> refreshForm($LSform,$idForm)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Met à jour les données de l'objet à partir d'un retour d'un formulaire.
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @param[in] $idForm Identifiant du formulaire d'origine
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si la mise à jour a réussi, false sinon
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2010-03-15 16:42:57 +01:00
|
|
|
public function updateData($idForm=NULL) {
|
2007-03-29 18:10:14 +02:00
|
|
|
if($idForm!=NULL) {
|
|
|
|
if(isset($this -> forms[$idForm]))
|
|
|
|
$LSform = $this -> forms[$idForm][0];
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_02',$this -> getType());
|
2007-03-29 18:10:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(count($this -> forms) > 0) {
|
|
|
|
reset($this -> forms);
|
|
|
|
$idForm = key($this -> forms);
|
|
|
|
$LSform = current($this -> forms);
|
|
|
|
$config = $LSform[1];
|
|
|
|
$LSform = $LSform[0];
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_03',$this -> getType());
|
2008-02-12 18:59:44 +01:00
|
|
|
return;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
}
|
2007-11-15 19:07:24 +01:00
|
|
|
$new_data = $LSform -> exportValues();
|
2010-03-16 15:23:29 +01:00
|
|
|
return $this -> _updateData($new_data,$idForm);
|
2010-03-15 16:42:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Met à jour les données de l'objet et de l'entré de l'annuaire
|
|
|
|
*
|
|
|
|
* @param[in] $new_data Tableau des données de modification de l'objet
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @retval boolean true si la mise à jour a réussi, false sinon
|
|
|
|
*
|
|
|
|
* @see validateAttrsData()
|
|
|
|
* @see submitChange()
|
|
|
|
*/
|
2010-03-16 14:54:39 +01:00
|
|
|
private function _updateData($new_data,$idForm=null) {
|
2008-07-18 16:02:46 +02:00
|
|
|
if(!is_array($new_data)) {
|
|
|
|
return;
|
|
|
|
}
|
2007-03-29 18:10:14 +02:00
|
|
|
foreach($new_data as $attr_name => $attr_val) {
|
|
|
|
if(isset($this -> attrs[$attr_name])) {
|
|
|
|
$this -> attrs[$attr_name] -> setUpdateData($attr_val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($this -> validateAttrsData($idForm)) {
|
2008-09-26 20:03:56 +02:00
|
|
|
LSdebug("les données sont validées");
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
if (!$this -> fireEvent('before_modify')) {
|
|
|
|
return;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
// $this -> attrs[ {inNewData} ] -> fireEvent('before_modify')
|
2008-10-14 13:58:00 +02:00
|
|
|
foreach($new_data as $attr_name => $attr_val) {
|
2012-03-22 19:51:27 +01:00
|
|
|
if ($this -> attrs[$attr_name] -> isUpdate() && !$this -> attrs[$attr_name] -> fireEvent('before_modify')) {
|
2009-01-21 18:08:09 +01:00
|
|
|
return;
|
|
|
|
}
|
2008-10-14 13:58:00 +02:00
|
|
|
}
|
|
|
|
|
2007-11-15 19:07:24 +01:00
|
|
|
if ($this -> submitChange($idForm)) {
|
2008-10-14 13:58:00 +02:00
|
|
|
LSdebug('Les modifications sont submitées');
|
2012-03-22 19:51:27 +01:00
|
|
|
// Event After Modify
|
2014-04-08 12:14:22 +02:00
|
|
|
$this -> fireEvent('after_modify');
|
2012-03-22 19:51:27 +01:00
|
|
|
|
|
|
|
// $this -> attrs[*] => After Modify
|
|
|
|
foreach($new_data as $attr_name => $attr_val) {
|
|
|
|
if ($this -> attrs[$attr_name] -> isUpdate()) {
|
|
|
|
$this -> attrs[$attr_name] -> fireEvent('after_modify');
|
|
|
|
}
|
|
|
|
}
|
2007-11-15 19:07:24 +01:00
|
|
|
$this -> reloadData();
|
|
|
|
$this -> refreshForm($idForm);
|
|
|
|
}
|
2008-02-12 18:59:44 +01:00
|
|
|
else {
|
|
|
|
return;
|
|
|
|
}
|
2012-03-22 19:51:27 +01:00
|
|
|
|
2008-02-12 18:59:44 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Valide les données retournées par un formulaire
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @param[in] $idForm Identifiant du formulaire d'origine
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si les données sont valides, false sinon
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2010-03-16 14:54:39 +01:00
|
|
|
function validateAttrsData($idForm=null) {
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = true;
|
2010-03-16 14:54:39 +01:00
|
|
|
if ($idForm) {
|
|
|
|
$LSform=$this -> forms[$idForm][0];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$LSform=false;
|
|
|
|
}
|
2007-03-29 18:10:14 +02:00
|
|
|
foreach($this -> attrs as $attr) {
|
2008-07-31 11:16:25 +02:00
|
|
|
$attr_values = $attr -> getValue();
|
2008-02-08 18:39:24 +01:00
|
|
|
if (!$attr -> isValidate()) {
|
|
|
|
if($attr -> isUpdate()) {
|
|
|
|
if (!$this -> validateAttrData($LSform, $attr)) {
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
2008-07-31 11:16:25 +02:00
|
|
|
else if( (empty($attr_values)) && ($attr -> isRequired()) ) {
|
2008-02-08 18:39:24 +01:00
|
|
|
if ( $attr -> canBeGenerated()) {
|
|
|
|
if ($attr -> generateValue()) {
|
|
|
|
if (!$this -> validateAttrData($LSform, $attr)) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSattribute_08',$attr -> getLabel());
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSattribute_07',$attr -> getLabel());
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSattribute_06',$attr -> getLabel());
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-11-10 16:32:56 +01:00
|
|
|
return $retval;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
2007-11-15 19:07:24 +01:00
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Valide les données d'un attribut
|
2007-11-15 19:07:24 +01:00
|
|
|
*
|
|
|
|
* @param[in] $LSForm Formulaire d'origine
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] &$attr Attribut à valider
|
2007-11-15 19:07:24 +01:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si les données sont valides, false sinon
|
2007-11-15 19:07:24 +01:00
|
|
|
*/
|
2008-02-08 18:39:24 +01:00
|
|
|
function validateAttrData(&$LSform,&$attr) {
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = true;
|
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
$vconfig=$attr -> getValidateConfig();
|
2007-11-15 19:07:24 +01:00
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
$data=$attr -> getUpdateData();
|
|
|
|
if(!is_array($data)) {
|
|
|
|
$data=array($data);
|
|
|
|
}
|
2007-11-15 19:07:24 +01:00
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
// Validation des valeurs de l'attribut
|
2007-11-15 19:07:24 +01:00
|
|
|
if(is_array($vconfig)) {
|
2008-02-08 18:39:24 +01:00
|
|
|
foreach($vconfig as $test) {
|
2008-10-14 13:58:00 +02:00
|
|
|
// Définition du basedn par défaut
|
2008-02-08 18:39:24 +01:00
|
|
|
if (!isset($test['basedn'])) {
|
2009-01-24 18:45:14 +01:00
|
|
|
$test['basedn']=LSsession :: getTopDn();
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2008-10-14 13:58:00 +02:00
|
|
|
// Définition du message d'erreur
|
2008-02-08 18:39:24 +01:00
|
|
|
if (!empty($test['msg'])) {
|
2010-08-03 19:23:20 +02:00
|
|
|
$msg_error=getFData(__($test['msg']),$this,'getValue');
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
else {
|
2009-02-12 13:38:56 +01:00
|
|
|
$msg_error=getFData(_("The attribute %{attr} is not valid."),$attr -> getLabel());
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
foreach($data as $val) {
|
|
|
|
// validation par check LDAP
|
|
|
|
if((isset($test['filter'])||isset($test['basedn']))&&(isset($test['result']))) {
|
|
|
|
$sparams=(isset($test['scope']))?array('scope' => $test['scope']):array();
|
|
|
|
$this -> other_values['val']=$val;
|
2014-11-28 16:19:01 +01:00
|
|
|
// Filter from test configuration
|
|
|
|
if (isset($test['filter']) && !empty($test['filter'])) {
|
|
|
|
$sfilter_user=getFData($test['filter'],$this,'getValue');
|
|
|
|
if ($sfilter_user[0]!='(') $sfilter_user="(".$sfilter_user.")";
|
|
|
|
$sfilter_user=Net_LDAP2_Filter::parse($sfilter_user);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$sfilter_user=NULL;
|
|
|
|
}
|
|
|
|
if(isset($test['object_type']) && LSsession :: loadLSobject($test['object_type']) ) {
|
|
|
|
$sfilter=self :: getObjectFilter($test['object_type']);
|
|
|
|
|
|
|
|
if ($sfilter_user) {
|
|
|
|
$sfilter=LSldap::combineFilters('and',array($sfilter_user,$sfilter));
|
|
|
|
}
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$sfilter=$sfilter_user;
|
|
|
|
}
|
|
|
|
$sbasedn=(isset($test['basedn']))?getFData($test['basedn'],$this,'getValue'):NULL;
|
2009-01-25 15:37:03 +01:00
|
|
|
$ret=LSldap :: getNumberResult ($sfilter,$sbasedn,$sparams);
|
2008-02-08 18:39:24 +01:00
|
|
|
if($test['result']==0) {
|
|
|
|
if($ret!=0) {
|
2010-03-16 14:54:39 +01:00
|
|
|
if ($LSform) $LSform -> setElementError($attr,$msg_error);
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2008-07-29 15:45:02 +02:00
|
|
|
if($ret<0) {
|
2010-03-16 14:54:39 +01:00
|
|
|
if ($LSform) $LSform -> setElementError($attr,$msg_error);
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Validation par fonction externe
|
|
|
|
else if(isset($test['function'])) {
|
|
|
|
if (function_exists($test['function'])) {
|
|
|
|
if(!$test['function']($this)) {
|
2010-03-16 14:54:39 +01:00
|
|
|
if ($LSform) $LSform -> setElementError($attr,$msg_error);
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_04',array('attr' => $attr->name,'obj' => $this->getType(),'func' => $test['function']));
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_05',array('attr' => $attr->name,'obj' => $this->getType()));
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-10-14 13:58:00 +02:00
|
|
|
// Génération des valeurs des attributs dépendants
|
2008-02-08 18:39:24 +01:00
|
|
|
$dependsAttrs=$attr->getDependsAttrs();
|
|
|
|
if (!empty($dependsAttrs)) {
|
|
|
|
foreach($dependsAttrs as $dependAttr) {
|
|
|
|
if(!isset($this -> attrs[$dependAttr])){
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_14',array('attr_depend' => $dependAttr, 'attr' => $attr -> getLabel()));
|
2008-02-08 18:39:24 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if($this -> attrs[$dependAttr] -> canBeGenerated()) {
|
|
|
|
if (!$this -> attrs[$dependAttr] -> generateValue()) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSattribute_07',$this -> attrs[$dependAttr] -> getLabel());
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2011-09-22 11:35:27 +02:00
|
|
|
elseif (!$this -> validateAttrData($LSform,$this -> attrs[$dependAttr])) {
|
|
|
|
LSerror :: addErrorCode('LSattribute_08',$this -> attrs[$dependAttr] -> getLabel());
|
|
|
|
$retval = false;
|
|
|
|
}
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSattribute_06',$this -> attrs[$dependAttr] -> getLabel());
|
2008-11-10 16:32:56 +01:00
|
|
|
$retval = false;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-11-15 19:07:24 +01:00
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
$attr -> validate();
|
2007-11-15 19:07:24 +01:00
|
|
|
unset($this -> other_values['val']);
|
2008-11-10 16:32:56 +01:00
|
|
|
return $retval;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2007-11-15 19:07:24 +01:00
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Met à jour les données modifiés dans l'annuaire
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
|
|
|
* @param[in] $idForm Identifiant du formulaire d'origine
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si la mise à jour a réussi, false sinon
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-03-29 18:10:14 +02:00
|
|
|
function submitChange($idForm) {
|
2007-11-15 19:07:24 +01:00
|
|
|
$submitData=array();
|
2008-08-06 19:04:03 +02:00
|
|
|
$new = $this -> isNew();
|
2007-03-29 18:10:14 +02:00
|
|
|
foreach($this -> attrs as $attr) {
|
|
|
|
if(($attr -> isUpdate())&&($attr -> isValidate())) {
|
2008-08-06 19:04:03 +02:00
|
|
|
if(($attr -> name == $this -> config['rdn'])&&(!$new)) {
|
|
|
|
$new = true;
|
2008-09-26 20:03:56 +02:00
|
|
|
LSdebug('Rename');
|
2009-03-09 13:42:03 +01:00
|
|
|
if (!$this -> fireEvent('before_rename')) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_16');
|
2008-07-29 15:45:02 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
$oldDn = $this -> getDn();
|
|
|
|
$this -> dn = false;
|
|
|
|
$newDn = $this -> getDn();
|
|
|
|
if ($newDn) {
|
2009-01-25 15:37:03 +01:00
|
|
|
if (!LSldap :: move($oldDn,$newDn)) {
|
2008-07-29 15:45:02 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-10-09 11:50:38 +02:00
|
|
|
$this -> dn = $newDn;
|
2009-03-09 13:42:03 +01:00
|
|
|
$this -> oldDn = $oldDn;
|
|
|
|
if (!$this -> fireEvent('after_rename')) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_17');
|
2008-07-29 15:45:02 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$submitData[$attr -> name] = $attr -> getUpdateData();
|
|
|
|
}
|
2007-11-15 19:07:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!empty($submitData)) {
|
|
|
|
$dn=$this -> getDn();
|
|
|
|
if($dn) {
|
2008-02-12 18:59:44 +01:00
|
|
|
$this -> dn=$dn;
|
2008-09-26 20:03:56 +02:00
|
|
|
LSdebug($submitData);
|
2009-03-09 17:33:43 +01:00
|
|
|
if ($new) {
|
|
|
|
if (!$this -> fireEvent('before_create')) {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_20');
|
|
|
|
return;
|
|
|
|
}
|
2009-03-10 10:22:41 +01:00
|
|
|
foreach ($submitData as $attr_name => $attr) {
|
|
|
|
if (!$this -> attrs[$attr_name] -> fireEvent('before_create')) {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_20');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-03-09 17:33:43 +01:00
|
|
|
}
|
2009-01-25 15:37:03 +01:00
|
|
|
if (!LSldap :: update($this -> getType(),$dn, $submitData)) {
|
2008-08-06 19:04:03 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ($new) {
|
2009-03-09 13:42:03 +01:00
|
|
|
if (!$this -> fireEvent('after_create')) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_21');
|
2008-08-06 19:04:03 +02:00
|
|
|
return;
|
|
|
|
}
|
2009-03-10 10:22:41 +01:00
|
|
|
foreach ($submitData as $attr_name => $attr) {
|
|
|
|
if (!$this -> attrs[$attr_name] -> fireEvent('after_create')) {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_21');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2008-08-06 19:04:03 +02:00
|
|
|
}
|
|
|
|
return true;
|
2007-11-15 19:07:24 +01:00
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_13');
|
2008-02-08 18:39:24 +01:00
|
|
|
return;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
}
|
2008-02-12 18:59:44 +01:00
|
|
|
else {
|
|
|
|
return true;
|
|
|
|
}
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne les informations issus d'un DN
|
|
|
|
*
|
|
|
|
* @param[in] $dn Un DN.
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @retval array Tableau :
|
2008-10-14 13:58:00 +02:00
|
|
|
* - [0] : le premier paramètre
|
|
|
|
* - [1] : les paramètres suivants
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-03-29 18:10:14 +02:00
|
|
|
function getDnInfos($dn) {
|
|
|
|
$infos=ldap_explode_dn($dn,0);
|
|
|
|
if(!$infos)
|
|
|
|
return;
|
|
|
|
$first=true;
|
|
|
|
for($i=1;$i<$infos['count'];$i++)
|
|
|
|
if($first) {
|
|
|
|
$basedn.=$infos[$i];
|
|
|
|
$first=false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
$basedn.=','.$infos[$i];
|
|
|
|
return array($infos[0],$basedn);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne le filtre correpondants aux objetcClass de l'objet
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2014-11-28 16:19:01 +01:00
|
|
|
* @retval Net_LDAP2_Filter le filtre ldap correspondant au type de l'objet
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2009-10-30 01:03:17 +01:00
|
|
|
function getObjectFilter($type=null) {
|
|
|
|
if (is_null($type)) {
|
|
|
|
$type = $this -> type_name;
|
|
|
|
}
|
|
|
|
$oc=LSconfig::get("LSobjects.$type.objectclass");
|
|
|
|
if(!is_array($oc)) return;
|
|
|
|
$filters=array();
|
|
|
|
foreach ($oc as $class) {
|
|
|
|
$filters[]=Net_LDAP2_Filter::create('objectClass','equals',$class);
|
2008-12-05 17:15:10 +01:00
|
|
|
}
|
2009-10-30 01:03:17 +01:00
|
|
|
|
|
|
|
$filter=LSconfig::get("LSobjects.$type.filter");
|
|
|
|
if ($filter) {
|
2014-11-28 16:19:01 +01:00
|
|
|
$filters[]=Net_LDAP2_Filter::parse($filter);
|
2008-12-05 17:15:10 +01:00
|
|
|
}
|
2009-10-30 01:03:17 +01:00
|
|
|
|
2014-11-28 16:19:01 +01:00
|
|
|
$filter = LSldap::combineFilters('and',$filters);
|
2009-10-30 01:03:17 +01:00
|
|
|
if ($filter)
|
|
|
|
return $filter;
|
|
|
|
LSerror :: addErrorCode('LSldapObject_30',$type);
|
|
|
|
return;
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
|
2009-01-25 18:43:30 +01:00
|
|
|
/**
|
|
|
|
* Retourne le filtre correpondants au pattern passé
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $pattern string Le mot clé recherché
|
|
|
|
* @param[in] $approx booléen Booléen activant ou non la recherche approximative
|
|
|
|
*
|
|
|
|
* @retval string le filtre ldap correspondant
|
|
|
|
*/
|
|
|
|
function getPatternFilter($pattern=null,$approx=null) {
|
|
|
|
if ($pattern!=NULL) {
|
2013-06-28 09:44:02 +02:00
|
|
|
$attrs=array();
|
2009-03-25 18:46:48 +01:00
|
|
|
if (is_array($this -> config['LSsearch']['attrs'])) {
|
2013-06-28 09:44:02 +02:00
|
|
|
foreach ($this -> config['LSsearch']['attrs'] as $key => $val) {
|
|
|
|
if (is_int($key)) {
|
|
|
|
$attrs[$val]=array();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$attrs[$key]=$val;
|
|
|
|
}
|
|
|
|
}
|
2009-01-25 18:43:30 +01:00
|
|
|
}
|
|
|
|
else {
|
2013-06-28 09:44:02 +02:00
|
|
|
$attrs=array($this -> config['rdn'] => array());
|
2009-01-25 18:43:30 +01:00
|
|
|
}
|
|
|
|
$pfilter='(|';
|
|
|
|
if ($approx) {
|
2013-06-28 09:44:02 +02:00
|
|
|
foreach ($attrs as $attr_name => $attr_opts) {
|
|
|
|
if (isset($attr_opts['approxLSformat'])) {
|
|
|
|
$pfilter.=getFData($attr_opts['approxLSformat'],array('name' => $attr_name, 'pattern' => $pattern));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$pfilter.='('.$attr_name.'~='.$pattern.')';
|
|
|
|
}
|
2009-01-25 18:43:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2013-06-28 09:44:02 +02:00
|
|
|
foreach ($attrs as $attr_name => $attr_opts) {
|
|
|
|
if (isset($attr_opts['searchLSformat'])) {
|
|
|
|
$pfilter.=getFData($attr_opts['searchLSformat'],array('name' => $attr_name, 'pattern' => $pattern));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$pfilter.='('.$attr_name.'=*'.$pattern.'*)';
|
|
|
|
}
|
2009-01-25 18:43:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$pfilter.=')';
|
|
|
|
return $pfilter;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Retourne une liste d'objet du même type.
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Effectue une recherche en fonction des paramètres passé et retourne un
|
2007-03-29 18:10:14 +02:00
|
|
|
* tableau d'objet correspond au resultat de la recherche.
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $filter array (ou string) Filtre de recherche Ldap / Tableau de filtres de recherche
|
|
|
|
* @param[in] $basedn string DN de base pour la recherche
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $params array Paramètres de recherche au format Net_LDAP2::search()
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
2008-06-19 16:07:57 +02:00
|
|
|
* @retval array Tableau d'objets correspondant au resultat de la recherche
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2008-11-09 17:47:55 +01:00
|
|
|
function listObjects($filter=NULL,$basedn=NULL,$params=array()) {
|
2009-10-30 01:03:17 +01:00
|
|
|
if (!LSsession :: loadLSclass('LSsearch')) {
|
|
|
|
LSerror::addErrorCode('LSsession_05','LSsearch');
|
|
|
|
return;
|
|
|
|
}
|
2008-11-09 17:47:55 +01:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
$sparams = array(
|
|
|
|
'basedn' => $basedn,
|
2013-11-19 11:44:16 +01:00
|
|
|
'filter' => $filter
|
2009-10-30 01:03:17 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
if (is_array($params)) {
|
|
|
|
$sparams=array_merge($sparams,$params);
|
|
|
|
}
|
|
|
|
$LSsearch = new LSsearch($this -> type_name,'LSldapObjet::listObjects',$sparams,true);
|
|
|
|
|
|
|
|
$LSsearch -> run();
|
|
|
|
|
|
|
|
return $LSsearch -> listObjects();
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
2008-11-09 01:57:50 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne une liste d'objet du même type et retourne leur noms
|
|
|
|
*
|
|
|
|
* Effectue une recherche en fonction des paramètres passé et retourne un
|
|
|
|
* tableau (dn => nom) correspondant au resultat de la recherche.
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $filter string Filtre de recherche Ldap
|
|
|
|
* @param[in] $basedn string DN de base pour la recherche
|
|
|
|
* @param[in] $params array Paramètres de recherche au format Net_LDAP2::search()
|
|
|
|
* @param[in] $displayFormat string Format d'affichage du nom des objets
|
|
|
|
*
|
|
|
|
* @retval array Tableau dn => name correspondant au resultat de la recherche
|
|
|
|
*/
|
2009-10-30 01:03:17 +01:00
|
|
|
function listObjectsName($filter=NULL,$sbasedn=NULL,$sparams=array(),$displayFormat=false,$cache=true) {
|
|
|
|
if (!LSsession :: loadLSclass('LSsearch')) {
|
|
|
|
LSerror::addErrorCode('LSsession_05','LSsearch');
|
|
|
|
return;
|
|
|
|
}
|
2008-11-09 01:57:50 +01:00
|
|
|
|
|
|
|
if (!$displayFormat) {
|
2009-01-07 20:24:14 +01:00
|
|
|
$displayFormat = $this -> getDisplayNameFormat();
|
2008-11-09 01:57:50 +01:00
|
|
|
}
|
2009-10-30 01:03:17 +01:00
|
|
|
|
|
|
|
$params = array(
|
|
|
|
'displayFormat' => $displayFormat,
|
|
|
|
'basedn' => $sbasedn,
|
|
|
|
'filter' => $filter
|
|
|
|
);
|
|
|
|
|
|
|
|
if (is_array($sparams)) {
|
|
|
|
$params=array_merge($sparams,$params);
|
2008-11-09 01:57:50 +01:00
|
|
|
}
|
2008-11-09 17:47:55 +01:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
$LSsearch = new LSsearch($this -> type_name,'LSldapObject::listObjectsName',$params,true);
|
2009-03-22 14:20:22 +01:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
$LSsearch -> run($cache);
|
2008-11-09 01:57:50 +01:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
return $LSsearch -> listObjectsName();
|
2008-11-09 01:57:50 +01:00
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2008-06-19 16:07:57 +02:00
|
|
|
|
|
|
|
/**
|
2009-03-09 14:14:37 +01:00
|
|
|
* Recherche un objet à partir de la valeur exact de son RDN ou d'un filtre de
|
|
|
|
* recherche LDAP sous la forme d'un LSformat qui sera construit avec la valeur
|
|
|
|
* de $name.
|
2008-06-19 16:07:57 +02:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2009-03-09 14:14:37 +01:00
|
|
|
* @param[in] $name string Valeur de son RDN ou de la valeur pour composer le filtre
|
2008-06-19 16:07:57 +02:00
|
|
|
* @param[in] $basedn string Le DN de base de la recherche
|
2009-03-09 14:14:37 +01:00
|
|
|
* @param[in] $filter string Le filtre de recherche de l'objet
|
2009-10-30 01:03:17 +01:00
|
|
|
* @param[in] $params array Tableau de paramètres
|
2008-06-19 16:07:57 +02:00
|
|
|
*
|
|
|
|
* @retval array Tableau d'objets correspondant au resultat de la recherche
|
|
|
|
*/
|
2009-10-30 01:03:17 +01:00
|
|
|
function searchObject($name,$basedn=NULL,$filter=NULL,$params=NULL) {
|
2009-03-09 14:14:37 +01:00
|
|
|
if (!$filter) {
|
2009-10-30 01:03:17 +01:00
|
|
|
$filter = '('.$this -> config['rdn'].'='.$name.')';
|
2009-03-09 14:14:37 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
$filter = getFData($filter,$name);
|
|
|
|
}
|
2009-10-30 01:03:17 +01:00
|
|
|
return $this -> listObjects($filter,$basedn,$params);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
/**
|
|
|
|
* Retourne une valeur de l'objet
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Retourne une valeur en fonction du paramètre. Si la valeur est inconnue, la valeur retourné est ' '.
|
2007-03-29 18:10:14 +02:00
|
|
|
* tableau d'objet correspond au resultat de la recherche.
|
|
|
|
*
|
|
|
|
* Valeurs possibles :
|
|
|
|
* - 'dn' ou '%{dn} : DN de l'objet
|
|
|
|
* - [nom d'un attribut] : valeur de l'attribut
|
|
|
|
* - [clef de $this -> other_values] : valeur de $this -> other_values
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $val string Le nom de la valeur demandée
|
2007-03-29 18:10:14 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval mixed la valeur demandé ou ' ' si celle-ci est inconnue.
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-03-29 18:10:14 +02:00
|
|
|
function getValue($val) {
|
|
|
|
if(($val=='dn')||($val=='%{dn}')) {
|
|
|
|
return $this -> dn;
|
|
|
|
}
|
2008-02-08 18:39:24 +01:00
|
|
|
else if(($val=='rdn')||($val=='%{rdn}')) {
|
|
|
|
return $this -> attrs[ $this -> config['rdn'] ] -> getValue();
|
|
|
|
}
|
2008-07-18 17:20:52 +02:00
|
|
|
else if(($val=='subDn')||($val=='%{subDn}')) {
|
2009-10-30 01:03:17 +01:00
|
|
|
return $this -> subDnValue;
|
2008-07-18 17:20:52 +02:00
|
|
|
}
|
|
|
|
else if(($val=='subDnName')||($val=='%{subDnName}')) {
|
2009-10-30 01:03:17 +01:00
|
|
|
return $this -> subDnName;
|
2008-07-18 17:20:52 +02:00
|
|
|
}
|
2007-03-29 18:10:14 +02:00
|
|
|
else if(isset($this -> attrs[$val])){
|
|
|
|
if (method_exists($this -> attrs[$val],'getValue'))
|
|
|
|
return $this -> attrs[$val] -> getValue();
|
|
|
|
else
|
|
|
|
return ' ';
|
|
|
|
}
|
|
|
|
else if(isset($this -> other_values[$val])){
|
|
|
|
return $this -> other_values[$val];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return ' ';
|
|
|
|
}
|
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2011-01-20 12:13:46 +01:00
|
|
|
/**
|
|
|
|
* Retourne une valeur d'affichage de l'objet
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @param[in] $val string Le nom de la valeur demandee
|
|
|
|
*
|
|
|
|
* @retval mixed la valeur demandee ou ' ' si celle-ci est inconnue.
|
|
|
|
*/
|
|
|
|
function getDisplayValue($val) {
|
|
|
|
if(isset($this -> attrs[$val])){
|
|
|
|
if (method_exists($this -> attrs[$val],'getDisplayValue'))
|
|
|
|
return $this -> attrs[$val] -> getDisplayValue();
|
|
|
|
else
|
|
|
|
return ' ';
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return $this -> getValue($val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-18 15:33:32 +01:00
|
|
|
/**
|
|
|
|
* Ajoute une valeur dans le tableau $this -> other_values
|
|
|
|
*
|
|
|
|
* @param[in] $name string Le nom de la valeur
|
|
|
|
* @param[in] $value mixed La valeur
|
|
|
|
*
|
|
|
|
* @retval void
|
|
|
|
**/
|
|
|
|
function registerOtherValue($name,$value) {
|
|
|
|
$this -> other_values[$name]=$value;
|
|
|
|
}
|
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Retourn un tableau pour un select d'un objet du même type
|
2008-02-08 18:39:24 +01:00
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-04-25 15:48:12 +02:00
|
|
|
* @retval array('dn' => 'display')
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2013-11-15 18:57:52 +01:00
|
|
|
function getSelectArray($pattern=NULL,$topDn=NULL,$displayFormat=NULL,$approx=false,$cache=true,$filter=NULL) {
|
|
|
|
return $this -> listObjectsName($filter,$topDn,array('pattern' => $pattern),$displayFormat,$cache);
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2007-11-15 19:07:24 +01:00
|
|
|
/**
|
|
|
|
* Retourne le DN de l'objet
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette methode retourne le DN de l'objet. Si celui-ci n'existe pas, il le construit à partir de la
|
2007-11-15 19:07:24 +01:00
|
|
|
* configuration de l'objet et la valeur de son attribut rdn.
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @retval string Le DN de l'objet
|
2008-02-08 18:39:24 +01:00
|
|
|
*/
|
2007-11-15 19:07:24 +01:00
|
|
|
function getDn() {
|
|
|
|
if($this -> dn) {
|
|
|
|
return $this -> dn;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$rdn_attr=$this -> config['rdn'];
|
2009-01-24 18:45:14 +01:00
|
|
|
$topDn = LSsession :: getTopDn();
|
|
|
|
if( (isset($this -> config['rdn'])) && (isset($this -> attrs[$rdn_attr])) && (isset($this -> config['container_dn'])) && ($topDn) ) {
|
2007-11-15 19:07:24 +01:00
|
|
|
$rdn_val=$this -> attrs[$rdn_attr] -> getUpdateData();
|
|
|
|
if (!empty($rdn_val)) {
|
2009-01-24 18:45:14 +01:00
|
|
|
return $rdn_attr.'='.$rdn_val[0].','.$this -> config['container_dn'].','.$topDn;
|
2007-11-15 19:07:24 +01:00
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_12',$this -> config['rdn']);
|
2007-11-15 19:07:24 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_11',$this -> getType());
|
2007-11-15 19:07:24 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-02-05 17:11:21 +01:00
|
|
|
|
2008-02-08 18:39:24 +01:00
|
|
|
/**
|
|
|
|
* Retourne le type de l'objet
|
|
|
|
*
|
2008-06-19 16:07:57 +02:00
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-02-08 18:39:24 +01:00
|
|
|
* @retval string Le type de l'objet ($this -> type_name)
|
|
|
|
*/
|
|
|
|
function getType() {
|
|
|
|
return $this -> type_name;
|
|
|
|
}
|
|
|
|
|
2008-02-12 18:59:44 +01:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Retourne qui est l'utilisateur par rapport à cet object
|
2008-02-12 18:59:44 +01:00
|
|
|
*
|
2008-06-19 16:07:57 +02:00
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval string 'admin'/'self'/'user' pour Admin , l'utilisateur lui même ou un simple utilisateur
|
2008-02-12 18:59:44 +01:00
|
|
|
*/
|
2008-02-08 18:39:24 +01:00
|
|
|
function whoami() {
|
|
|
|
if (!$this -> _whoami)
|
2009-01-24 18:45:14 +01:00
|
|
|
$this -> _whoami = LSsession :: whoami($this -> dn);
|
2008-02-08 18:39:24 +01:00
|
|
|
return $this -> _whoami;
|
|
|
|
}
|
|
|
|
|
2008-02-12 18:59:44 +01:00
|
|
|
/**
|
|
|
|
* Retourne le label de l'objet
|
|
|
|
*
|
2008-06-19 16:07:57 +02:00
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-02-12 18:59:44 +01:00
|
|
|
* @retval string Le label de l'objet ($this -> config['label'])
|
|
|
|
*/
|
2009-10-30 01:03:17 +01:00
|
|
|
function getLabel($type=null) {
|
|
|
|
if (is_null($type)) {
|
|
|
|
$type = $this -> type_name;
|
|
|
|
}
|
|
|
|
return __(LSconfig::get("LSobjects.$type.label"));
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
|
|
|
|
2008-02-12 18:59:44 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Supprime l'objet dans l'annuaire
|
|
|
|
*
|
2008-06-19 16:07:57 +02:00
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean True si l'objet à été supprimé, false sinon
|
2008-02-12 18:59:44 +01:00
|
|
|
*/
|
|
|
|
function remove() {
|
2009-03-09 13:42:03 +01:00
|
|
|
if ($this -> fireEvent('before_delete')) {
|
2009-01-25 15:37:03 +01:00
|
|
|
if (LSldap :: remove($this -> getDn())) {
|
2009-03-09 13:42:03 +01:00
|
|
|
if ($this -> fireEvent('after_delete')) {
|
2008-08-06 19:04:03 +02:00
|
|
|
return true;
|
|
|
|
}
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_19');
|
2008-08-06 19:04:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSldapObject_18');
|
2008-08-06 19:04:03 +02:00
|
|
|
}
|
|
|
|
return;
|
2008-02-08 18:39:24 +01:00
|
|
|
}
|
2008-06-19 16:07:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* L'objet est-il nouveau
|
|
|
|
*
|
|
|
|
* @author Benjamin Renard <brenard@easter-eggs.com>
|
|
|
|
*
|
|
|
|
* @retval boolean True si l'objet est nouveau, false sinon
|
|
|
|
*/
|
|
|
|
function isNew() {
|
|
|
|
return (!$this -> dn);
|
|
|
|
}
|
2008-06-21 18:16:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne la valeur (DN) du subDn de l'objet
|
|
|
|
*
|
2008-11-09 01:57:50 +01:00
|
|
|
* @parram[in] $dn string Un DN
|
|
|
|
*
|
2008-06-21 18:16:15 +02:00
|
|
|
* @return string La valeur du subDn de l'object
|
|
|
|
*/
|
2009-10-30 01:03:17 +01:00
|
|
|
public static function getSubDnValue($dn) {
|
2008-06-21 18:16:15 +02:00
|
|
|
$subDn_value='';
|
2009-01-24 18:45:14 +01:00
|
|
|
$subDnLdapServer = LSsession :: getSortSubDnLdapServer();
|
2008-06-21 18:16:15 +02:00
|
|
|
foreach ($subDnLdapServer as $subDn => $subDn_name) {
|
|
|
|
if (isCompatibleDNs($subDn,$dn)&&($subDn!=$dn)) {
|
|
|
|
$subDn_value=$subDn;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $subDn_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Retourne la nom du subDn de l'objet
|
|
|
|
*
|
2008-11-09 01:57:50 +01:00
|
|
|
* @parram[in] $dn string Un DN
|
|
|
|
*
|
2008-06-21 18:16:15 +02:00
|
|
|
* @return string Le nom du subDn de l'object
|
|
|
|
*/
|
2009-10-30 01:03:17 +01:00
|
|
|
public static function getSubDnName($dn) {
|
2009-01-24 18:45:14 +01:00
|
|
|
$subDnLdapServer = LSsession :: getSortSubDnLdapServer();
|
2009-10-30 01:03:17 +01:00
|
|
|
return $subDnLdapServer[self :: getSubDnValue($dn)];
|
2008-06-21 18:16:15 +02:00
|
|
|
}
|
2008-07-29 15:45:02 +02:00
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Methode créant la liste des objets en relations avec l'objet courant et qui
|
2009-01-08 00:06:05 +01:00
|
|
|
* la met en cache ($this -> _LSrelationsCache)
|
2008-07-29 15:45:02 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval True en cas de cas ce succès, False sinon.
|
2008-07-29 15:45:02 +02:00
|
|
|
*/
|
2009-01-08 00:06:05 +01:00
|
|
|
function updateLSrelationsCache() {
|
|
|
|
$this -> _LSrelationsCache=array();
|
|
|
|
if (is_array($this->config['LSrelation'])) {
|
2008-10-09 12:19:07 +02:00
|
|
|
$type = $this -> getType();
|
|
|
|
$me = new $type();
|
|
|
|
$me -> loadData($this -> getDn());
|
2009-01-08 00:06:05 +01:00
|
|
|
foreach($this->config['LSrelation'] as $relation_name => $relation_conf) {
|
2008-08-06 19:04:03 +02:00
|
|
|
if ( isset($relation_conf['list_function']) ) {
|
2009-01-24 18:45:14 +01:00
|
|
|
if (LSsession :: loadLSobject($relation_conf['LSobject'])) {
|
2008-07-29 15:45:02 +02:00
|
|
|
$obj = new $relation_conf['LSobject']();
|
2008-10-09 11:50:38 +02:00
|
|
|
if ((method_exists($obj,$relation_conf['list_function']))&&(method_exists($obj,$relation_conf['getkeyvalue_function']))) {
|
2008-10-09 12:19:07 +02:00
|
|
|
$list = $obj -> $relation_conf['list_function']($me);
|
2008-07-29 15:45:02 +02:00
|
|
|
if (is_array($list)) {
|
2008-10-09 11:50:38 +02:00
|
|
|
// Key Value
|
2008-10-09 12:19:07 +02:00
|
|
|
$key = $obj -> $relation_conf['getkeyvalue_function']($me);
|
2008-10-09 11:50:38 +02:00
|
|
|
|
2009-01-08 00:06:05 +01:00
|
|
|
$this -> _LSrelationsCache[$relation_name] = array(
|
2008-10-09 11:50:38 +02:00
|
|
|
'list' => $list,
|
|
|
|
'keyvalue' => $key
|
|
|
|
);
|
2008-07-29 15:45:02 +02:00
|
|
|
}
|
|
|
|
else {
|
2008-10-14 13:58:00 +02:00
|
|
|
LSdebug('Problème durant la mise en cache de la relation '.$relation_name);
|
2008-07-29 15:45:02 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2008-10-14 13:58:00 +02:00
|
|
|
LSdebug('Les méthodes de mise en cache de la relation '.$relation_name. ' ne sont pas toutes disponibles.');
|
2008-07-29 15:45:02 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2008-08-06 19:04:03 +02:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Methode executant les actions nécéssaires avant le changement du DN de
|
2008-08-06 19:04:03 +02:00
|
|
|
* l'objet.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode n'est qu'un exemple et elle doit être certainement réécrite
|
2008-08-06 19:04:03 +02:00
|
|
|
* pour les objets plus complexe.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval True en cas de cas ce succès, False sinon.
|
2008-08-06 19:04:03 +02:00
|
|
|
*/
|
|
|
|
function beforeRename() {
|
2009-03-09 13:42:03 +01:00
|
|
|
// LSrelations
|
2009-01-08 00:06:05 +01:00
|
|
|
return $this -> updateLSrelationsCache();
|
2008-08-06 19:04:03 +02:00
|
|
|
}
|
|
|
|
|
2008-07-29 15:45:02 +02:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Methode executant les actions nécéssaires après le changement du DN de
|
2008-07-29 15:45:02 +02:00
|
|
|
* l'objet.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode n'est qu'un exemple et elle doit être certainement réécrite
|
2008-07-29 15:45:02 +02:00
|
|
|
* pour les objets plus complexe.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval True en cas de cas ce succès, False sinon.
|
2008-07-29 15:45:02 +02:00
|
|
|
*/
|
2009-03-09 13:42:03 +01:00
|
|
|
function afterRename() {
|
2008-07-29 15:45:02 +02:00
|
|
|
$error = 0;
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
// Change LSsession -> userObject Dn
|
|
|
|
if(LSsession :: getLSuserObjectDn() == $this -> oldDn) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSsession :: changeAuthUser($this);
|
2008-07-29 15:45:02 +02:00
|
|
|
}
|
|
|
|
|
2009-03-09 13:42:03 +01:00
|
|
|
// LSrelations
|
2009-01-08 00:06:05 +01:00
|
|
|
foreach($this -> _LSrelationsCache as $relation_name => $objInfos) {
|
|
|
|
if ((isset($this->config['LSrelation'][$relation_name]['rename_function']))&&(is_array($objInfos['list']))) {
|
2008-10-09 11:50:38 +02:00
|
|
|
foreach($objInfos['list'] as $obj) {
|
2009-01-08 00:06:05 +01:00
|
|
|
$meth = $this->config['LSrelation'][$relation_name]['rename_function'];
|
2008-08-06 19:04:03 +02:00
|
|
|
if (method_exists($obj,$meth)) {
|
2008-10-09 11:50:38 +02:00
|
|
|
if (!($obj -> $meth($this,$objInfos['keyvalue']))) {
|
2008-08-06 19:04:03 +02:00
|
|
|
$error=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2008-07-29 15:45:02 +02:00
|
|
|
$error=1;
|
|
|
|
}
|
|
|
|
}
|
2008-08-06 19:04:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return !$error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Methode executant les actions nécéssaires avant la suppression de
|
2008-08-06 19:04:03 +02:00
|
|
|
* l'objet.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode n'est qu'un exemple et elle doit être certainement réécrite
|
2008-08-06 19:04:03 +02:00
|
|
|
* pour les objets plus complexe.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval True en cas de cas ce succès, False sinon.
|
2008-08-06 19:04:03 +02:00
|
|
|
*/
|
|
|
|
function beforeDelete() {
|
2009-01-22 16:35:37 +01:00
|
|
|
$return = $this -> updateLSrelationsCache();
|
|
|
|
|
|
|
|
foreach(array_keys($this -> attrs) as $attr_name) {
|
|
|
|
if (!$this -> attrs[$attr_name] -> fireEvent('before_delete')) {
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $return;
|
2008-08-06 19:04:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Methode executant les actions nécéssaires après la suppression de
|
2008-08-06 19:04:03 +02:00
|
|
|
* l'objet.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode n'est qu'un exemple et elle doit être certainement réécrite
|
2008-08-06 19:04:03 +02:00
|
|
|
* pour les objets plus complexe.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval True en cas de cas ce succès, False sinon.
|
2008-08-06 19:04:03 +02:00
|
|
|
*/
|
|
|
|
function afterDelete() {
|
|
|
|
$error = 0;
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
// LSrelations
|
2009-01-08 00:06:05 +01:00
|
|
|
foreach($this -> _LSrelationsCache as $relation_name => $objInfos) {
|
|
|
|
if ((isset($this->config['LSrelation'][$relation_name]['remove_function']))&&(is_array($objInfos['list']))) {
|
2008-10-09 11:50:38 +02:00
|
|
|
foreach($objInfos['list'] as $obj) {
|
2009-01-08 00:06:05 +01:00
|
|
|
$meth = $this->config['LSrelation'][$relation_name]['remove_function'];
|
2008-08-06 19:04:03 +02:00
|
|
|
if (method_exists($obj,$meth)) {
|
|
|
|
if (!($obj -> $meth($this))) {
|
|
|
|
$error=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$error=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-09-09 17:48:07 +02:00
|
|
|
|
2009-03-09 13:42:03 +01:00
|
|
|
// Binding LSattributes
|
2009-01-22 16:35:37 +01:00
|
|
|
foreach(array_keys($this -> attrs) as $attr_name) {
|
|
|
|
if (!$this -> attrs[$attr_name] -> fireEvent('after_delete')) {
|
|
|
|
$error = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
// LSsearch : Purge LSobject cache
|
|
|
|
if (LSsession :: loadLSclass('LSsearch')) {
|
|
|
|
LSsearch :: purgeCache($this -> type_name);
|
|
|
|
}
|
|
|
|
|
2008-08-06 19:04:03 +02:00
|
|
|
return !$error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Methode executant les actions nécéssaires après la création de
|
2008-08-06 19:04:03 +02:00
|
|
|
* l'objet.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Cette méthode n'est qu'un exemple et elle doit être certainement réécrite
|
2008-08-06 19:04:03 +02:00
|
|
|
* pour les objets plus complexe.
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval True en cas de cas ce succès, False sinon.
|
2008-08-06 19:04:03 +02:00
|
|
|
*/
|
|
|
|
function afterCreate() {
|
2008-09-26 20:03:56 +02:00
|
|
|
LSdebug('after');
|
2008-08-06 19:04:03 +02:00
|
|
|
$error = 0;
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
// container_auto_create
|
2009-01-24 18:45:14 +01:00
|
|
|
if (LSsession :: isSubDnLSobject($this -> getType())) {
|
|
|
|
if (is_array(LSsession :: $ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'])) {
|
|
|
|
foreach(LSsession :: $ldapServer['subDn']['LSobject'][$this -> getType()]['LSobjects'] as $type) {
|
|
|
|
if (LSsession :: loadLSobject($type)) {
|
2009-03-25 18:46:48 +01:00
|
|
|
$conf_type=LSconfig :: get("LSobjects.$type");
|
|
|
|
if (isset($conf_type['container_auto_create'])&&isset($conf_type['container_dn'])) {
|
|
|
|
$dn = $conf_type['container_dn'].','.$this -> getDn();
|
|
|
|
if(!LSldap :: getNewEntry($dn,$conf_type['container_auto_create']['objectclass'],$conf_type['container_auto_create']['attrs'],true)) {
|
2008-10-14 13:58:00 +02:00
|
|
|
LSdebug("Impossible de créer l'entrée fille : ".print_r(
|
2008-08-06 19:04:03 +02:00
|
|
|
array(
|
|
|
|
'dn' => $dn,
|
2009-03-25 18:46:48 +01:00
|
|
|
'objectClass' => $conf_type['container_auto_create']['objectclass'],
|
|
|
|
'attrs' => $conf_type['container_auto_create']['attrs']
|
2008-08-06 19:04:03 +02:00
|
|
|
)
|
|
|
|
,true));
|
|
|
|
$error=1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$error=1;
|
|
|
|
}
|
2008-07-29 15:45:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-09-09 17:48:07 +02:00
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
// LSsearch : Purge LSobject cache
|
|
|
|
if (LSsession :: loadLSclass('LSsearch')) {
|
|
|
|
LSsearch :: purgeCache($this -> type_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return !$error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Methode executant les actions nécéssaires après la modification de
|
|
|
|
* l'objet.
|
|
|
|
*
|
|
|
|
* Cette méthode n'est qu'un exemple et elle doit être certainement réécrite
|
|
|
|
* pour les objets plus complexe.
|
|
|
|
*
|
|
|
|
* @retval True en cas de cas ce succès, False sinon.
|
|
|
|
*/
|
|
|
|
function afterModify() {
|
|
|
|
$error = 0;
|
|
|
|
|
|
|
|
// LSsearch : Purge LSobject cache
|
|
|
|
if (LSsession :: loadLSclass('LSsearch')) {
|
|
|
|
LSsearch :: purgeCache($this -> type_name);
|
|
|
|
}
|
|
|
|
|
2008-07-29 15:45:02 +02:00
|
|
|
return !$error;
|
|
|
|
}
|
2008-08-06 19:04:03 +02:00
|
|
|
|
2008-10-09 11:50:38 +02:00
|
|
|
/**
|
|
|
|
* Retourne la valeur clef d'un objet en relation
|
|
|
|
*
|
|
|
|
* @param[in] $object Un object de type $objectType
|
|
|
|
* @param[in] $objectType Le type d'objet en relation
|
|
|
|
* @param[in] $value La valeur que doit avoir l'attribut :
|
|
|
|
* - soit le dn (par defaut)
|
|
|
|
* - soit la valeur [0] d'un attribut
|
|
|
|
*
|
|
|
|
* @retval Mixed La valeur clef d'un objet en relation
|
|
|
|
**/
|
2010-03-16 16:01:14 +01:00
|
|
|
function getObjectKeyValueInRelation($object,$objectType,$attrValue='dn') {
|
|
|
|
if (!$objectType) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSrelations_05','getObjectKeyValueInRelation');
|
2008-10-09 11:50:38 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ($attrValue=='dn') {
|
|
|
|
$val = $object -> getDn();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$val = $object -> getValue($attrValue);
|
|
|
|
$val = $val[0];
|
|
|
|
}
|
|
|
|
return $val;
|
|
|
|
}
|
|
|
|
|
2008-10-08 15:24:18 +02:00
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Retourne la liste des relations pour l'objet en fonction de sa présence
|
2008-10-08 15:24:18 +02:00
|
|
|
* dans un des attributs
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* Retourne un tableau de d'objet (type : $objectType) correspondant à la
|
2008-10-08 15:24:18 +02:00
|
|
|
* relation entre l'objet $object et les objets de type $objectType. Cette relation
|
2008-10-14 13:58:00 +02:00
|
|
|
* est établis par la présence de la valeur de référence à l'objet dans
|
2008-10-08 19:06:36 +02:00
|
|
|
* l'attribut des objets de type $objectType.
|
2008-10-08 15:24:18 +02:00
|
|
|
*
|
|
|
|
* @param[in] $object Un object de type $objectType
|
|
|
|
* @param[in] $attr L'attribut dans lequel l'objet doit apparaitre
|
|
|
|
* @param[in] $objectType Le type d'objet en relation
|
2008-10-08 18:49:18 +02:00
|
|
|
* @param[in] $value La valeur que doit avoir l'attribut :
|
|
|
|
* - soit le dn (par defaut)
|
|
|
|
* - soit la valeur [0] d'un attribut
|
2008-10-08 15:24:18 +02:00
|
|
|
*
|
|
|
|
* @retval Array of $objectType Les objets en relations
|
|
|
|
**/
|
2008-10-08 18:49:18 +02:00
|
|
|
function listObjectsInRelation($object,$attr,$objectType,$attrValue='dn') {
|
2008-10-08 15:24:18 +02:00
|
|
|
if ((!$attr)||(!$objectType)) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSrelations_05','listObjectsInRelation');
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($attrValue=='dn') {
|
|
|
|
$val = $object -> getDn();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$val = $object -> getValue($attrValue);
|
|
|
|
$val = $val[0];
|
|
|
|
}
|
|
|
|
if ($val) {
|
2009-10-30 01:03:17 +01:00
|
|
|
$filter = Net_LDAP2_Filter::create($attr,'equals',$val);
|
|
|
|
return $this -> listObjects($filter,LSsession :: getRootDn(),array('scope' => 'sub','recursive' => true,'withoutCache'=>true));
|
2008-10-08 18:49:18 +02:00
|
|
|
}
|
|
|
|
return;
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ajoute un objet en relation dans l'attribut $attr de $this
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $object Un objet de type $objectType à ajouter
|
|
|
|
* @param[in] $attr L'attribut dans lequel l'objet doit être ajouté
|
2008-10-08 15:24:18 +02:00
|
|
|
* @param[in] $objectType Le type d'objet en relation
|
2008-10-08 18:49:18 +02:00
|
|
|
* @param[in] $attrValue La valeur que doit avoir l'attribut :
|
|
|
|
* - soit le dn (par defaut)
|
|
|
|
* - soit la valeur [0] d'un attribut
|
2009-11-11 21:00:59 +01:00
|
|
|
* @param[in] $canEditFunction Le nom de la fonction pour vérifier que la
|
|
|
|
* relation avec l'objet est éditable par le user
|
2008-10-08 15:24:18 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si l'objet à été ajouté, False sinon
|
2008-10-08 15:24:18 +02:00
|
|
|
**/
|
2009-11-11 21:00:59 +01:00
|
|
|
function addOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL) {
|
2008-10-08 15:24:18 +02:00
|
|
|
if ((!$attr)||(!$objectType)) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSrelations_05','addOneObjectInRelation');
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ($object instanceof $objectType) {
|
2009-11-11 21:00:59 +01:00
|
|
|
if ($canEditFunction) {
|
|
|
|
if (!$this -> $canEditFunction()) {
|
|
|
|
LSerror :: addErrorCode('LSsession_11');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2008-10-08 15:24:18 +02:00
|
|
|
if ($this -> attrs[$attr] instanceof LSattribute) {
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($attrValue=='dn') {
|
|
|
|
$val = $object -> getDn();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$val = $object -> getValue($attrValue);
|
|
|
|
$val = $val[0];
|
|
|
|
}
|
2008-10-08 15:24:18 +02:00
|
|
|
$values = $this -> attrs[$attr] -> getValue();
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($this -> attrs[$attr] -> config['multiple']) {
|
|
|
|
if (!is_array($values)) {
|
|
|
|
$updateData = array($val);
|
|
|
|
}
|
|
|
|
else if (!in_array($val,$values)) {
|
|
|
|
$values[]=$val;
|
|
|
|
$updateData = $values;
|
|
|
|
}
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
2008-10-08 18:49:18 +02:00
|
|
|
else {
|
|
|
|
if (($values[0]!=$val)&&($values!=$val)) {
|
|
|
|
$updateData = array($val);
|
|
|
|
}
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
|
|
|
if (isset($updateData)) {
|
2010-03-15 17:31:05 +01:00
|
|
|
return $this -> _updateData(array($attr => $updateData));
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Supprime un objet en relation dans l'attribut $attr de $this
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $object Un objet de type $objectType à supprimer
|
|
|
|
* @param[in] $attr L'attribut dans lequel l'objet doit être supprimé
|
2008-10-08 15:24:18 +02:00
|
|
|
* @param[in] $objectType Le type d'objet en relation
|
2008-10-08 18:49:18 +02:00
|
|
|
* @param[in] $attrValue La valeur que doit avoir l'attribut :
|
|
|
|
* - soit le dn (par defaut)
|
|
|
|
* - soit la valeur [0] d'un attribut
|
2009-11-11 21:00:59 +01:00
|
|
|
* @param[in] $canEditFunction Le nom de la fonction pour vérifier que la
|
|
|
|
* relation avec l'objet est éditable par le user
|
2008-10-08 15:24:18 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si l'objet à été supprimé, False sinon
|
2008-10-08 15:24:18 +02:00
|
|
|
**/
|
2009-11-11 21:00:59 +01:00
|
|
|
function deleteOneObjectInRelation($object,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL) {
|
2008-10-08 15:24:18 +02:00
|
|
|
if ((!$attr)||(!$objectType)) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSrelations_05','deleteOneObjectInRelation');
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ($object instanceof $objectType) {
|
2009-11-11 21:00:59 +01:00
|
|
|
if ($canEditFunction) {
|
|
|
|
if (!$this -> $canEditFunction()) {
|
|
|
|
LSerror :: addErrorCode('LSsession_11');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2008-10-08 15:24:18 +02:00
|
|
|
if ($this -> attrs[$attr] instanceof LSattribute) {
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($attrValue=='dn') {
|
|
|
|
$val = $object -> getDn();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$val = $object -> getValue($attrValue);
|
|
|
|
$val = $val[0];
|
|
|
|
}
|
2008-10-08 15:24:18 +02:00
|
|
|
$values = $this -> attrs[$attr] -> getValue();
|
|
|
|
if ((!is_array($values)) && (!empty($values))) {
|
|
|
|
$values = array($values);
|
|
|
|
}
|
|
|
|
if (is_array($values)) {
|
|
|
|
$updateData=array();
|
|
|
|
foreach($values as $value) {
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($value!=$val) {
|
2008-10-08 15:24:18 +02:00
|
|
|
$updateData[]=$value;
|
|
|
|
}
|
|
|
|
}
|
2010-03-15 17:31:05 +01:00
|
|
|
return $this -> _updateData(array($attr => $updateData));
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renome un objet en relation dans l'attribut $attr de $this
|
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @param[in] $object Un objet de type $objectType à renomer
|
|
|
|
* @param[in] $oldValue string L'ancienne valeur faisant référence à l'objet
|
|
|
|
* @param[in] $attr L'attribut dans lequel l'objet doit être supprimé
|
2008-10-08 15:24:18 +02:00
|
|
|
* @param[in] $objectType Le type d'objet en relation
|
2008-10-08 18:49:18 +02:00
|
|
|
* @param[in] $attrValue La valeur que doit avoir l'attribut :
|
|
|
|
* - soit le dn (par defaut)
|
|
|
|
* - soit la valeur [0] d'un attribut
|
2008-10-08 15:24:18 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean True en cas de succès, False sinon
|
2008-10-08 15:24:18 +02:00
|
|
|
*/
|
2008-10-08 18:49:18 +02:00
|
|
|
function renameOneObjectInRelation($object,$oldValue,$attr,$objectType,$attrValue='dn') {
|
2008-10-08 15:24:18 +02:00
|
|
|
if ((!$attr)||(!$objectType)) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSrelations_05','renameOneObjectInRelation');
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if ($object instanceof $objectType) {
|
|
|
|
if ($this -> attrs[$attr] instanceof LSattribute) {
|
|
|
|
$values = $this -> attrs[$attr] -> getValue();
|
|
|
|
if ((!is_array($values)) && (!empty($values))) {
|
|
|
|
$values = array($values);
|
|
|
|
}
|
|
|
|
if (is_array($values)) {
|
|
|
|
$updateData=array();
|
|
|
|
foreach($values as $value) {
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($value!=$oldValue) {
|
2008-10-08 15:24:18 +02:00
|
|
|
$updateData[] = $value;
|
|
|
|
}
|
|
|
|
else {
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($attrValue=='dn') {
|
|
|
|
$val = $object -> getDn();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$val = $object -> getValue($attrValue);
|
|
|
|
$val = $val[0];
|
|
|
|
}
|
|
|
|
$updateData[] = $val;
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
2010-03-15 17:31:05 +01:00
|
|
|
return $this -> _updateData(array($attr => $updateData));
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2008-10-14 13:58:00 +02:00
|
|
|
* Met à jour les objets du meme type que $this en relation avec l'objet $object
|
2008-10-08 15:24:18 +02:00
|
|
|
* de type $objectType en modifiant la valeur de leur attribut $attr des objets
|
|
|
|
* en relation
|
|
|
|
*
|
|
|
|
* @param[in] $object Mixed Un object (type : $this -> userObjectType) : l'utilisateur
|
2008-10-08 18:49:18 +02:00
|
|
|
* @param[in] $listDns Array(string) Un tableau des DNs des objets en relation
|
2008-10-08 15:24:18 +02:00
|
|
|
* @param[in] $attr L'attribut dans lequel l'utilisateur doit apparaitre
|
2008-10-08 18:49:18 +02:00
|
|
|
* @param[in] $objectType Le type d'objet en relation
|
|
|
|
* @param[in] $attrValue La valeur que doit avoir l'attribut :
|
|
|
|
* - soit le dn (par defaut)
|
|
|
|
* - soit la valeur [0] d'un attribut
|
2009-11-11 21:00:59 +01:00
|
|
|
* @param[in] $canEditFunction Le nom de la fonction pour vérifier que la
|
|
|
|
* relation avec l'objet est éditable par le user
|
2008-10-08 15:24:18 +02:00
|
|
|
*
|
2008-10-14 13:58:00 +02:00
|
|
|
* @retval boolean true si tout c'est bien passé, False sinon
|
2008-10-08 15:24:18 +02:00
|
|
|
**/
|
2009-11-11 21:00:59 +01:00
|
|
|
function updateObjectsInRelation($object,$listDns,$attr,$objectType,$attrValue='dn',$canEditFunction=NULL) {
|
2008-10-08 15:24:18 +02:00
|
|
|
if ((!$attr)||(!$objectType)) {
|
2009-01-24 18:45:14 +01:00
|
|
|
LSerror :: addErrorCode('LSrelations_05','updateObjectsInRelation');
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
2008-10-08 19:06:36 +02:00
|
|
|
$currentObjects = $this -> listObjectsInRelation($object,$attr,$objectType,$attrValue);
|
2008-10-08 15:24:18 +02:00
|
|
|
$type=$this -> getType();
|
|
|
|
if(is_array($currentObjects)) {
|
|
|
|
if (is_array($listDns)) {
|
2008-10-08 18:49:18 +02:00
|
|
|
$values=array();
|
|
|
|
if ($attrValue!='dn') {
|
|
|
|
$obj=new $objectType();
|
|
|
|
foreach ($listDns as $dn) {
|
|
|
|
$obj -> loadData($dn);
|
|
|
|
$val = $obj -> getValue($attrValue);
|
|
|
|
$values[$dn] = $val[0];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
foreach($listDns as $dn) {
|
|
|
|
$values[$dn] = $dn;
|
|
|
|
}
|
|
|
|
}
|
2008-10-08 15:24:18 +02:00
|
|
|
$dontDelete=array();
|
|
|
|
$dontAdd=array();
|
|
|
|
for ($i=0;$i<count($currentObjects);$i++) {
|
2008-10-08 18:49:18 +02:00
|
|
|
if ($attrValue=='dn') {
|
|
|
|
$val = $currentObjects[$i] -> getDn();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$val = $currentObjects[$i] -> getValue($attrValue);
|
|
|
|
$val = $val[0];
|
|
|
|
}
|
|
|
|
if (in_array($val, $listDns)) {
|
2008-10-08 15:24:18 +02:00
|
|
|
$dontDelete[$i]=true;
|
2008-10-08 18:49:18 +02:00
|
|
|
$dontAdd[]=$val;
|
2008-10-08 15:24:18 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for($i=0;$i<count($currentObjects);$i++) {
|
|
|
|
if ($dontDelete[$i]) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else {
|
2009-11-11 21:00:59 +01:00
|
|
|
if (!$currentObjects[$i] -> deleteOneObjectInRelation($object,$attr,$objectType,$attrValue,$canEditFunction)) {
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-08 18:49:18 +02:00
|
|
|
foreach($values as $dn => $val) {
|
|
|
|
if (in_array($val,$dontAdd)) {
|
2008-10-08 15:24:18 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$obj = new $type();
|
|
|
|
if ($obj -> loadData($dn)) {
|
2009-11-11 21:00:59 +01:00
|
|
|
if (!$obj -> addOneObjectInRelation($object,$attr,$objectType,$attrValue,$canEditFunction)) {
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(!is_array($listDns)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
foreach($listDns as $dn) {
|
|
|
|
$obj = new $type();
|
|
|
|
if ($obj -> loadData($dn)) {
|
2009-11-11 21:00:59 +01:00
|
|
|
if (!$obj -> addOneObjectInRelation($object,$attr,$objectType,$attrValue,$canEditFunction)) {
|
2008-10-08 15:24:18 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-09 13:42:03 +01:00
|
|
|
/**
|
|
|
|
* Ajouter une action lors d'un événement
|
|
|
|
*
|
|
|
|
* @param[in] $event string Le nom de l'événement
|
|
|
|
* @param[in] $fct string Le nom de la fonction à exectuer
|
|
|
|
* @param[in] $param mixed Paramètre pour le lancement de la fonction
|
|
|
|
* @param[in] $class Nom de la classe possèdant la méthode $fct à executer
|
|
|
|
*
|
|
|
|
* @retval void
|
|
|
|
*/
|
|
|
|
function addEvent($event,$fct,$param=NULL,$class=NULL) {
|
|
|
|
$this -> _events[$event][] = array(
|
|
|
|
'function' => $fct,
|
|
|
|
'param' => $param,
|
|
|
|
'class' => $class
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ajouter une action sur un objet lors d'un événement
|
|
|
|
*
|
|
|
|
* @param[in] $event string Le nom de l'événement
|
|
|
|
* @param[in] $obj object L'objet dont la méthode doit être executé
|
|
|
|
* @param[in] $meth string Le nom de la méthode
|
|
|
|
* @param[in] $param mixed Paramètre d'execution de la méthode
|
|
|
|
*
|
|
|
|
* @retval void
|
|
|
|
*/
|
|
|
|
function addObjectEvent($event,&$obj,$meth,$param=NULL) {
|
|
|
|
$this -> _objectEvents[$event][] = array(
|
|
|
|
'obj' => $obj,
|
|
|
|
'meth' => $meth,
|
|
|
|
'param' => $param
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lance les actions à executer lors d'un événement
|
|
|
|
*
|
|
|
|
* @param[in] $event string Le nom de l'événement
|
|
|
|
*
|
|
|
|
* @retval boolean True si tout c'est bien passé, false sinon
|
|
|
|
*/
|
|
|
|
function fireEvent($event) {
|
|
|
|
|
|
|
|
// Object event
|
|
|
|
$return = $this -> fireObjectEvent($event);
|
|
|
|
|
|
|
|
// Config
|
|
|
|
if(isset($this -> config[$event])) {
|
|
|
|
if (!is_array($this -> config[$event])) {
|
|
|
|
$funcs = array($this -> config[$event]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$funcs = $this -> config[$event];
|
|
|
|
}
|
|
|
|
foreach($funcs as $func) {
|
|
|
|
if(function_exists($func)) {
|
|
|
|
if(!$func($this)) {
|
|
|
|
$return = false;
|
|
|
|
LSerror :: addErrorCode('LSldapObject_07',array('func' => $func,'event' => $event));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$return = false;
|
|
|
|
LSerror :: addErrorCode('LSldapObject_06',array('func' => $func,'event' => $event));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Binding via addEvent
|
2010-11-25 12:25:05 +01:00
|
|
|
if (isset($this -> _events[$event]) && is_array($this -> _events[$event])) {
|
2009-03-09 13:42:03 +01:00
|
|
|
foreach ($this -> _events[$event] as $e) {
|
|
|
|
if ($e['class']) {
|
|
|
|
if (class_exists($e['class'])) {
|
|
|
|
$obj = new $e['class']();
|
|
|
|
if (method_exists($obj,$e['fct'])) {
|
|
|
|
try {
|
|
|
|
$obj -> $e['fct']($e['param']);
|
|
|
|
}
|
|
|
|
catch(Exception $er) {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_10',array('class' => $e['class'],'meth' => $e['fct'],'event' => $event));
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_09',array('class' => $e['class'],'meth' => $e['fct'],'event' => $event));
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_08',array('class' => $e['class'],'meth' => $e['fct'],'event' => $event));
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (function_exists($e['fct'])) {
|
|
|
|
try {
|
|
|
|
$e['fct']($e['param']);
|
|
|
|
}
|
|
|
|
catch(Exception $er) {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_27',array('func' => $e['fct'],'event' => $event));
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_26',array('func' => $e['fct'],'event' => $event));
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Binding via addObjectEvent
|
2010-11-25 12:25:05 +01:00
|
|
|
if (isset($this -> _objectEvents[$event]) && is_array($this -> _objectEvents[$event])) {
|
2009-03-09 13:42:03 +01:00
|
|
|
foreach ($this -> _objectEvents[$event] as $e) {
|
|
|
|
if (method_exists($e['obj'],$e['meth'])) {
|
|
|
|
try {
|
|
|
|
$e['obj'] -> $e['meth']($e['param']);
|
|
|
|
}
|
|
|
|
catch(Exception $er) {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_29',array('meth' => $e['meth'],'event' => $event));
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LSerror :: addErrorCode('LSldapObject_28',array('meth' => $e['meth'],'event' => $event));
|
|
|
|
$return = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lance les actions à executer lors d'un événement sur l'objet lui-même
|
|
|
|
*
|
|
|
|
* @param[in] $event string Le nom de l'événement
|
|
|
|
*
|
|
|
|
* @retval boolean True si tout c'est bien passé, false sinon
|
2009-10-30 01:03:17 +01:00
|
|
|
**/
|
2009-03-09 13:42:03 +01:00
|
|
|
function fireObjectEvent($event) {
|
|
|
|
switch($event) {
|
|
|
|
case 'after_create':
|
|
|
|
return $this -> afterCreate();
|
|
|
|
case 'after_delete':
|
|
|
|
return $this -> afterDelete();
|
|
|
|
case 'after_rename':
|
|
|
|
return $this -> afterRename();
|
|
|
|
case 'after_modify':
|
|
|
|
return $this -> afterModify();
|
|
|
|
/*
|
|
|
|
case 'before_create':
|
|
|
|
return $this -> beforeCreate();
|
|
|
|
*/
|
|
|
|
case 'before_delete':
|
|
|
|
return $this -> beforeDelete();
|
|
|
|
case 'before_rename':
|
|
|
|
return $this -> beforeRename();
|
|
|
|
/*
|
|
|
|
case 'before_modify':
|
|
|
|
return $this -> beforeModify();
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
/**
|
|
|
|
* Access to infos of the object
|
|
|
|
*
|
|
|
|
* @param[in] $key string The name of the value
|
|
|
|
*
|
|
|
|
* @retval mixed The value
|
|
|
|
**/
|
|
|
|
function __get($key) {
|
|
|
|
if ($key=='subDnValue') {
|
2010-11-25 12:25:44 +01:00
|
|
|
if (isset($this -> cache['subDnValue'])) {
|
2009-10-30 01:03:17 +01:00
|
|
|
return $this -> cache['subDnValue'];
|
|
|
|
}
|
|
|
|
$this -> cache['subDnValue'] = self :: getSubDnValue($this -> dn);
|
|
|
|
return $this -> cache['subDnValue'];
|
|
|
|
}
|
|
|
|
if ($key=='subDnName') {
|
|
|
|
if ($this -> cache['subDnName']) {
|
|
|
|
return $this -> cache['subDnName'];
|
|
|
|
}
|
|
|
|
$this -> cache['subDnName'] = self :: getSubDnName($this -> dn);
|
|
|
|
return $this -> cache['subDnName'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-29 18:10:14 +02:00
|
|
|
}
|
|
|
|
|
2009-01-02 17:00:25 +01:00
|
|
|
/**
|
|
|
|
* Error Codes
|
|
|
|
**/
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_01',
|
2009-02-12 13:38:56 +01:00
|
|
|
_("LSldapObject : Object type unknown.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_02',
|
|
|
|
_("LSldapObject : Update form is not defined for the object %{obj}.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_03',
|
2009-02-12 13:38:56 +01:00
|
|
|
_("LSldapObject : No form exists for the object %{obj}.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_04',
|
|
|
|
_("LSldapObject : The function %{func} to validate the attribute %{attr} the object %{obj} is unknow.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_05',
|
|
|
|
_("LSldapObject : Configuration data are missing to validate the attribute %{attr} of the object %{obj}.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
LSerror :: defineError('LSldapObject_06',
|
|
|
|
_("LSldapObject : The function %{func} to be executed on the object event %{event} doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_07',
|
2009-03-09 14:21:33 +01:00
|
|
|
_("LSldapObject : The %{func} execution on the object event %{event} failed.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_08',
|
2009-03-09 14:21:33 +01:00
|
|
|
_("LSldapObject : Class %{class}, which method %{meth} to be executed on the object event %{event}, doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_09',
|
2009-03-16 11:48:42 +01:00
|
|
|
_("LSldapObject : Method %{meth} within %{class} class to be executed on object event %{event}, doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_10',
|
2009-03-13 22:32:08 +01:00
|
|
|
_("LSldapObject : Error during execute %{meth} method within %{class} class, to be executed on object event %{event}.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_11',
|
|
|
|
_("LSldapObject : Some configuration data of the object type %{obj} are missing to generate the DN of the new object.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_12',
|
2009-03-16 11:48:42 +01:00
|
|
|
_("LSldapObject : The attibute %{attr} of the object is not yet defined. Can't generate DN.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_13',
|
|
|
|
_("LSldapObject : Without DN, the object could not be changed.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_14',
|
|
|
|
_("LSldapObject : The attribute %{attr_depend} depending on the attribute %{attr} doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_15',
|
|
|
|
_("LSldapObject : Error during deleting the object %{objectname}.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_16',
|
|
|
|
_("LSldapObject : Error during actions to be executed before renaming the objet.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_17',
|
|
|
|
_("LSldapObject : Error during actions to be executed after renaming the objet.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_18',
|
|
|
|
_("LSldapObject : Error during actions to be executed before deleting the objet.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_19',
|
|
|
|
_("LSldapObject : Error during actions to be executed after deleting the objet.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2009-03-09 17:33:43 +01:00
|
|
|
LSerror :: defineError('LSldapObject_20',
|
|
|
|
_("LSldapObject : Error during the actions to be executed before creating the object.")
|
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_21',
|
|
|
|
_("LSldapObject : Error during the actions to be executed after creating the object. It was created anyway.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_22',
|
2009-03-16 11:48:42 +01:00
|
|
|
_("LSldapObject : The function %{func} to be executed before creating the object doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_23',
|
2009-03-16 11:48:42 +01:00
|
|
|
_("LSldapObject : Error executing the function %{func} to be execute after deleting the object.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_24',
|
2009-03-16 11:48:42 +01:00
|
|
|
_("LSldapObject : The function %{func} to be executed after deleting the object doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-01-25 15:37:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_25',
|
2009-03-16 11:48:42 +01:00
|
|
|
_("LSldapObject : Error executing the function %{func} to be execute after creating the object.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
LSerror :: defineError('LSldapObject_26',
|
2009-03-09 14:21:33 +01:00
|
|
|
_("LSldapObject : %{func} function, to be executed on object event %{event}, doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_27',
|
2009-03-09 14:21:33 +01:00
|
|
|
_("LSldapObject : Error during the execution of %{func} function on object event %{event}.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
|
|
|
LSerror :: defineError('LSldapObject_28',
|
2009-03-09 14:26:26 +01:00
|
|
|
_("LSldapObject : %{meth} method, to be executed on object event %{event}, doesn't exist.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
LSerror :: defineError('LSldapObject_29',
|
2009-03-09 14:21:33 +01:00
|
|
|
_("LSldapObject : Error during execution of %{meth} method on object event %{event}.")
|
2009-01-02 17:00:25 +01:00
|
|
|
);
|
2009-10-30 01:03:17 +01:00
|
|
|
LSerror :: defineError('LSldapObject_30',
|
|
|
|
_("LSldapObject : Error during generate LDAP filter for %{LSobject}.")
|
|
|
|
);
|
|
|
|
|
2011-04-07 19:31:56 +02:00
|
|
|
LSerror :: defineError('LSldapObject_31',
|
|
|
|
_("LSldapObject : Error during execution of the custom action %{customAction} on %{objectname}.")
|
|
|
|
);
|
|
|
|
|
2009-10-30 01:03:17 +01:00
|
|
|
// LSrelation
|
|
|
|
LSerror :: defineError('LSrelations_05',
|
|
|
|
_("LSrelation : Some parameters are missing in the call of methods to handle standard relations (Method : %{meth}).")
|
|
|
|
);
|
2009-03-09 13:42:03 +01:00
|
|
|
|
2007-11-15 19:07:24 +01:00
|
|
|
?>
|