2 /*******************************************************************************
3 * Copyright (C) 2007 Easter-eggs
4 * http://ldapsaisie.labs.libre-entreprise.org
6 * Author: See AUTHORS file in top-level directory.
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 ******************************************************************************/
26 * @author Benjamin Renard <brenard@easter-eggs.com>
28 class LSgroup extends LSldapObject {
30 var $userObjectType = 'LSpeople';
31 var $memberAttr = 'uniqueMember';
33 /* ========== Members ========== */
35 * Retourne la valeur clef d'un membre
37 * @param[in] $object Un object utilisateur
39 * @retval Mixed La valeur clef d'un membre
41 function getMemberKeyValue($object) {
42 return $this -> getObjectKeyValueInRelation($object,$this -> memberAttr,$this -> userObjectType);
46 * Retourne la liste des groupes pour utilisateur
48 * Retourne un tableau de LSgroup correspondant aux groupes
49 * auxquels appartient un utilisateur
51 * @param[in] $userObject Un object user (type : $this -> userObjectType)
53 * @retval Array of LSgroup Les groupes de l'utilisateur
55 function listUserGroups($userObject) {
56 return $this -> listObjectsInRelation($userObject,$this -> memberAttr,$this -> userObjectType);
60 * Ajoute un utilisateur au groupe
62 * @param[in] $object Un object user ($this -> userObjectType) : l'utilisateur à ajouter
64 * @retval boolean true si l'utilisateur à été ajouté, False sinon
66 function addOneMember($object) {
67 return $this -> addOneObjectInRelation($object,$this -> memberAttr, $this -> userObjectType,'dn','canEditGroupRelation');
71 * Supprime un utilisateur du groupe
73 * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à supprimer
75 * @retval boolean true si l'utilisateur à été supprimé, False sinon
77 function deleteOneMember($object) {
78 return $this -> deleteOneObjectInRelation($object,$this -> memberAttr,$this -> userObjectType,'dn','canEditGroupRelation');
82 * Renome un utilisateur du groupe
84 * @param[in] $object Un object (type : $this -> userObjectType) : l'utilisateur à renomer
85 * @param[in] $oldDn string L'ancien DN de l'utilisateur
87 * @retval boolean True en cas de succès, False sinon
89 function renameOneMember($object,$oldDn) {
90 return $this -> renameOneObjectInRelation($object,$oldDn,$this -> memberAttr,$this -> userObjectType);
94 * Met à jour les groupes d'un utilisateur
96 * @param[in] $object Mixed Un object (type : $this -> userObjectType) : l'utilisateur
97 * @param[in] $listDns Array(string) Un tableau des DNs des groupes de l'utilisateur
99 * @retval boolean true si tout c'est bien passé, False sinon
101 function updateUserGroups($object,$listDns) {
102 return $this -> updateObjectsInRelation($object,$listDns,$this -> memberAttr,$this -> userObjectType,'dn','canEditGroupRelation');
106 * Test si l'utilisateur peut d'editer la relation avec ce groupe
108 * @retval boolean true si tout l'utilisateur peut éditer la relation, False sinon
110 function canEditGroupRelation($dn=NULL) {
114 return LSsession :: canEdit($this -> type_name,$this -> dn,$this -> memberAttr);