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)