[Fusionforge-commits] r9848 - trunk/gforge/common/include
Roland Mas
lolando at libremir.placard.fr.eu.org
Fri May 21 09:59:08 CEST 2010
Author: lolando
Date: 2010-05-21 09:59:08 +0200 (Fri, 21 May 2010)
New Revision: 9848
Modified:
trunk/gforge/common/include/RBAC.php
Log:
Implemented BaseRole::getLinkedProjects()
Modified: trunk/gforge/common/include/RBAC.php
===================================================================
--- trunk/gforge/common/include/RBAC.php 2010-05-21 07:58:55 UTC (rev 9847)
+++ trunk/gforge/common/include/RBAC.php 2010-05-21 07:59:08 UTC (rev 9848)
@@ -45,9 +45,6 @@
public function setSettings($data) {
throw new Exception ("Not implemented") ;
}
- public function getLinkedProjects () {
- throw new Exception ("Not implemented") ;
- }
public function linkProject ($project) {
throw new Exception ("Not implemented") ;
}
@@ -59,6 +56,32 @@
}
/**
+ * getLinkedProjects - List of projects referencing that role
+ *
+ * Includes the home project (for roles that have one)
+ *
+ * @return array Array of Group objects
+ */
+ public function getLinkedProjects () {
+ $ids = array () ;
+
+ $hp = $this->getHomeProject () ;
+ if ($hp != NULL) {
+ $ids[] = $hp->getID() ;
+ }
+
+ $res = db_query_params ('SELECT group_id FROM pfo_role_project_refs WHERE role_id=$1',
+ array ($this->getID())) ;
+ if ($res) {
+ while ($arr = db_fetch_array ($res)) {
+ $ids[] = $arr['group_id'] ;
+ }
+ }
+
+ return group_get_objects (array_unique ($ids)) ;
+ }
+
+ /**
* fetchData - May need to refresh database fields.
*
* If an update occurred and you need to access the updated info.
More information about the Fusionforge-commits
mailing list