From 2e6475548117f953ae72b9f38a9950816a941b5d Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 22 Feb 2016 15:53:19 +0000 Subject: [PATCH] authzgroups : add the groupmembers by ID git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2528 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- authzgroups.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/authzgroups.php b/authzgroups.php index 50c80b7..0439a2a 100644 --- a/authzgroups.php +++ b/authzgroups.php @@ -681,6 +681,30 @@ class authzgroups return $res; } + /** Return an array with all the groups where the user is in and in the module + */ + public function groupmemberReadUserByID ($module, $idgroupmember) + { + if ($this->dbGroupMember == null) + throw new Exception (dgettext ("domframework", + "DB for GroupMember is not connected"), + 500); + $idgrouptmps = $this->groupRead ($module); + // Create an array with idgroup=>group + $idgroups = array (); + foreach ($idgrouptmps as $val) + $idgroups[$val["idgroup"]] = $val["group"]; + $select = array (); + $select[] = array ("idgroupmember", $idgroupmember); + $idgroupmembers = $this->dbGroupMember->read ($select); + $res = array (); + foreach ($idgroupmembers as $idmembers) + { + $res[$idmembers["idgroup"]] = $idgroups[$idmembers["idgroup"]]; + } + return $res; + } + /** Return an array with all the available users in the group and in the module */ public function groupmemberReadGroup ($module, $group)