[Fusionforge-commits] r9838 - in trunk/gforge: common/pm common/tracker www/tracker

Roland Mas lolando at libremir.placard.fr.eu.org
Fri May 21 09:56:57 CEST 2010


Author: lolando
Date: 2010-05-21 09:56:56 +0200 (Fri, 21 May 2010)
New Revision: 9838

Modified:
   trunk/gforge/common/pm/ProjectGroup.class.php
   trunk/gforge/common/tracker/Artifact.class.php
   trunk/gforge/common/tracker/ArtifactFile.class.php
   trunk/gforge/common/tracker/ArtifactType.class.php
   trunk/gforge/www/tracker/tracker.php
Log:
Removed userIsTechnician() methods

Modified: trunk/gforge/common/pm/ProjectGroup.class.php
===================================================================
--- trunk/gforge/common/pm/ProjectGroup.class.php	2010-05-21 07:56:44 UTC (rev 9837)
+++ trunk/gforge/common/pm/ProjectGroup.class.php	2010-05-21 07:56:56 UTC (rev 9838)
@@ -559,15 +559,6 @@
 		return forge_check_perm ('pm', $this->getID(), 'manager') ;
 	}
 
-	/**
-	 *  userIsTechnician - see if the logged-in user's perms are >= 1 or Group PMAdmin.
-	 *
-	 *  @return boolean user_is_technician.
-	 */
-	function userIsTechnician() {
-		return forge_check_perm ('pm', $this->getID(), 'tech') ;
-	}
-
 }
 
 // Local Variables:

Modified: trunk/gforge/common/tracker/Artifact.class.php
===================================================================
--- trunk/gforge/common/tracker/Artifact.class.php	2010-05-21 07:56:44 UTC (rev 9837)
+++ trunk/gforge/common/tracker/Artifact.class.php	2010-05-21 07:56:56 UTC (rev 9838)
@@ -808,10 +808,8 @@
 		/*
 			Field-level permission checking
 		*/
-		if ($this->ArtifactType->userIsAdmin()) {
-			//admin can do everything
-		} else {
-			//everyone else cannot modify these fields
+		if (!forge_check_perm ('tracker', $this->ArtifactType->getID(), 'manager')) {
+			// Non-managers cannot modify these fields
 			$priority=$this->getPriority();
 			$summary=htmlspecialchars_decode($this->getSummary());
 			$description=htmlspecialchars_decode($this->getDetails());
@@ -819,15 +817,10 @@
 			$new_artifact_type_id=$this->ArtifactType->getID();
 			$assigned_to=$this->getAssignedTo();
 
-			if ($this->ArtifactType->userIsTechnician()) {
-				//technician can update only certain fields
-				//which were not overridden above
-			} else {
-				//submitter can no longer call this function
+			if (!forge_check_perm ('tracker', $this->ArtifactType->getID(), 'tech')) {
 				$this->setPermissionDeniedError();
 				return false;
 			}
-
 		}
 		//
 		//	They may be using an extra field "status" box so we have to remap

Modified: trunk/gforge/common/tracker/ArtifactFile.class.php
===================================================================
--- trunk/gforge/common/tracker/ArtifactFile.class.php	2010-05-21 07:56:44 UTC (rev 9837)
+++ trunk/gforge/common/tracker/ArtifactFile.class.php	2010-05-21 07:56:56 UTC (rev 9838)
@@ -191,7 +191,7 @@
 	 *	@return	boolean	success.
 	 */
 	function delete() {
-		if (!$this->Artifact->ArtifactType->userIsTechnician()) {
+		if (!forge_check_perm ('tracker', $this->Artifact->ArtifactType->getID(), 'tech')) {
 			$this->setPermissionDeniedError();
 			return false;
 		}

Modified: trunk/gforge/common/tracker/ArtifactType.class.php
===================================================================
--- trunk/gforge/common/tracker/ArtifactType.class.php	2010-05-21 07:56:44 UTC (rev 9837)
+++ trunk/gforge/common/tracker/ArtifactType.class.php	2010-05-21 07:56:56 UTC (rev 9838)
@@ -978,15 +978,6 @@
 	}
 
 	/**
-	 *	userIsTechnician - see if the logged-in user's perms are >= 1 or Group ArtifactAdmin.
-	 *
-	 *	@return boolean	user_is_technician.
-	 */
-	function userIsTechnician() { 
-		return forge_check_perm ('tracker', $this->getID(), 'tech') ;
-	}
-
-	/**
 	 *  update - use this to update this ArtifactType in the database.
 	 *
 	 *  @param	string	The item name.

Modified: trunk/gforge/www/tracker/tracker.php
===================================================================
--- trunk/gforge/www/tracker/tracker.php	2010-05-21 07:56:44 UTC (rev 9837)
+++ trunk/gforge/www/tracker/tracker.php	2010-05-21 07:56:56 UTC (rev 9838)
@@ -266,8 +266,8 @@
 				in the event that someone tampered with the HTML form
 
 			*/
-			if ($ath->userIsAdmin() || $ath->userIsTechnician()) {
-
+			if (forge_check_perm ('tracker', $ath->getID(), 'tech')
+					|| forge_check_perm ('tracker', $ath->getID(), 'manager')) {
 				//admin and techs can do everything
 				//techs will have certain fields overridden inside the update() function call
 				if (!$ah->update($priority,$status_id,
@@ -311,8 +311,9 @@
 			}
 
 			// Admin, Techs and Submitter can add files.
-			if ($ath->userIsAdmin() || $ath->userIsTechnician() || 
-				(session_loggedin() && ($ah->getSubmittedBy() == user_getid()))) {
+			if (forge_check_perm ('tracker', $ath->getID(), 'tech')
+					|| forge_check_perm ('tracker', $ath->getID(), 'manager')
+					|| (session_loggedin() && ($ah->getSubmittedBy() == user_getid()))) {
 				//
 				//	  Attach files to this Artifact.
 				//
@@ -362,7 +363,8 @@
 				}
 					
 				// Admin and Techs can delete files.
-				if ($ath->userIsAdmin() || $ath->userIsTechnician()) {
+				if (forge_check_perm ('tracker', $ath->getID(), 'tech')
+						|| forge_check_perm ('tracker', $ath->getID(), 'manager')) {
 					//
 					//	Delete list of files from this artifact
 					//
@@ -537,9 +539,9 @@
 			} else if ($ah->isError()) {
 				exit_error('ERROR',$ah->getErrorMessage());
 			} else {
-				if ($ath->userIsAdmin()) {
+				if (forge_check_perm ('tracker', $ath->getID(), 'manager')) {
 					include $gfwww.'tracker/mod.php';
-				} elseif ($ath->userIsTechnician()) {
+				} elseif (forge_check_perm ('tracker', $ath->getID(), 'tech')) {
 					include $gfwww.'tracker/mod-limited.php';
 				} else {
 					include $gfwww.'tracker/detail.php';




More information about the Fusionforge-commits mailing list