[Fusionforge-commits] r9263 - in trunk/gforge: common/include www/include

Christian Bayle cbayle at libremir.placard.fr.eu.org
Mon Mar 29 10:00:37 CEST 2010


Author: cbayle
Date: 2010-03-29 10:00:37 +0200 (Mon, 29 Mar 2010)
New Revision: 9263

Modified:
   trunk/gforge/common/include/User.class.php
   trunk/gforge/www/include/pre.php
   trunk/gforge/www/include/squal_pre.php
Log:
Add codendi glue


Modified: trunk/gforge/common/include/User.class.php
===================================================================
--- trunk/gforge/common/include/User.class.php	2010-03-29 08:00:28 UTC (rev 9262)
+++ trunk/gforge/common/include/User.class.php	2010-03-29 08:00:37 UTC (rev 9263)
@@ -795,6 +795,11 @@
 	function getMD5Passwd() {
 		return $this->data_array['user_pw'];
 	}
+	
+	//Added to be compatible with codendi getUserPw function
+	function getUserPw() {
+		return  $this->data_array['user_pw'];
+	}
 
 	/**
 	 *	getConfirmHash - the confirm hash in the db.
@@ -1516,6 +1521,59 @@
 		}
 		return $role;
 	}
+	
+	function isMember($group_id, $type=0) {
+		if (!session_loggedin()) {
+			return false;
+		}
+	
+		$project =& group_get_object($group_id);
+	
+		if (!$project || !is_object($project)) {
+				exit_no_group();
+		}
+	
+		$perm =& $project->getPermission( $this );
+		if (!$perm || !is_object($perm) || !$perm->isMember()) {
+			return false;
+		}
+	
+		$type=strtoupper($type);
+		
+		switch ($type) {
+			case 'P2' : {
+				//pm admin
+				return $perm->isPMAdmin();
+				break; 
+			}
+			case 'F2' : {
+				//forum admin
+				return $perm->isForumAdmin();
+				break; 
+			}
+			case '0' : {
+				//just in this group
+				return $perm->isMember();
+				break;
+			}
+			case 'A' : {
+				//admin for this group
+				return $perm->isAdmin();
+				break;
+			}
+			case 'D1' : {
+				//document editor
+				return $perm->isDocEditor();
+				break;
+			}
+			default : {
+				//fubar request
+				return false;
+			}
+		}
+		return false;
+		
+	}
 }
 
 /*

Modified: trunk/gforge/www/include/pre.php
===================================================================
--- trunk/gforge/www/include/pre.php	2010-03-29 08:00:28 UTC (rev 9262)
+++ trunk/gforge/www/include/pre.php	2010-03-29 08:00:37 UTC (rev 9263)
@@ -56,6 +56,9 @@
 //library to determine browser settings
 require_once $gfwww.'include/browser.php';
 
+//Codendi class for httpRequest
+require_once $gfcommon.'include/HTTPRequest.class.php';
+
 //base error library for new objects
 require_once $gfcommon.'include/Error.class.php';
 
@@ -82,10 +85,14 @@
 
 //user functions like get_name, logged_in, etc
 require_once $gfcommon.'include/User.class.php';
+require_once $gfcommon.'include/UserManager.class.php';
 
 //group functions like get_name, etc
 require_once $gfcommon.'include/Group.class.php';
 
+//ProjectManager from Codendi
+require_once $gfcommon.'include/ProjectManager.class.php';
+
 //permission functions
 require_once $gfcommon.'include/Permission.class.php';
 

Modified: trunk/gforge/www/include/squal_pre.php
===================================================================
--- trunk/gforge/www/include/squal_pre.php	2010-03-29 08:00:28 UTC (rev 9262)
+++ trunk/gforge/www/include/squal_pre.php	2010-03-29 08:00:37 UTC (rev 9263)
@@ -25,9 +25,11 @@
 require_once $gfcommon.'include/session.php';
 require_once $gfcommon.'include/Error.class.php';
 require_once $gfcommon.'include/User.class.php';
+require_once $gfcommon.'include/UserManager.class.php';
 require_once $gfcommon.'include/Permission.class.php';
 require_once $gfcommon.'include/utils.php';
 require_once $gfcommon.'include/Group.class.php';
+require_once $gfcommon.'include/ProjectManager.class.php';
 require_once $gfcommon.'include/escapingUtils.php';
 require_once $gfcommon.'include/gettext.php';
 




More information about the Fusionforge-commits mailing list