[Fusionforge-commits] r14039 - in branches/Branch_5_1: . src/www/project/admin

Roland Mas lolando at fusionforge.org
Tue Aug 2 16:22:42 CEST 2011


Author: lolando
Date: 2011-08-02 16:22:42 +0200 (Tue, 02 Aug 2011)
New Revision: 14039

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/www/project/admin/roledelete.php
   branches/Branch_5_1/src/www/project/admin/users.php
Log:
Added UI to delete a role from a project

Modified: branches/Branch_5_1/src/www/project/admin/roledelete.php
===================================================================
--- branches/Branch_5_1/src/www/project/admin/roledelete.php	2011-08-02 14:08:25 UTC (rev 14038)
+++ branches/Branch_5_1/src/www/project/admin/roledelete.php	2011-08-02 14:22:42 UTC (rev 14039)
@@ -39,13 +39,22 @@
 
 $group = group_get_object($group_id);
 
-$role = new Role($group,$role_id);
+$role = RBACEngine::getInstance()->getRoleById($role_id);
+
 if (!$role || !is_object($role)) {
 	exit_error(_('Could Not Get Role'),'admin');
 } elseif ($role->isError()) {
 	exit_error($role->getErrorMessage(),'admin');
 }
 
+if ($role->getHomeProject() == NULL) {
+	exit_error(_("You can't delete a global role from here."),'admin');
+}
+
+if ($role->getHomeProject()->getID() != $group_id) {
+	exit_error(_("You can't delete a role belonging to another project."),'admin');
+}
+
 if (getStringFromRequest('submit')) {
 	if (getIntFromRequest('sure')) {
 		if (!$role->delete()) {
@@ -57,11 +66,6 @@
 		$error_msg = _('Error: Please check "I\'m Sure" to confirm or return to previous page to cancel.');
 	}
 
-	//plugin webcal
-	//change assistant for webcal
-	$params = getIntFromRequest('group_id');
-	plugin_hook('change_cal_permission_auto',$params);
-	
 	if (!isset($error_msg)) {
 		session_redirect('/project/admin/users.php?group_id='.$group_id.'&error_msg='.urlencode($error_msg));
 	}

Modified: branches/Branch_5_1/src/www/project/admin/users.php
===================================================================
--- branches/Branch_5_1/src/www/project/admin/users.php	2011-08-02 14:08:25 UTC (rev 14038)
+++ branches/Branch_5_1/src/www/project/admin/users.php	2011-08-02 14:22:42 UTC (rev 14039)
@@ -416,8 +416,20 @@
 		<input type="hidden" name="role_id" value="'.$r->getID().'" />
 		<input type="submit" name="edit" value="'._("Edit Permissions").'" />
 	</div>
-	</form>
-</td></tr>';
+	</form>';
+	
+	if ($r->getHomeProject() != NULL && $r->getHomeProject()->getId() == $group_id) {
+		echo '<form action="roledelete.php?group_id='. $group_id .'" method="post">
+	<div style="float:left;">
+		'.$r->getDisplayableName($group).'
+	</div><div style="float:right;">
+		<input type="hidden" name="role_id" value="'.$r->getID().'" />
+		<input type="submit" name="delete" value="'._("Delete role").'" />
+	</div>
+	</form>';
+	}
+
+	echo '</td></tr>';
 }
 
 /* note: we cannot put the form outside of a td here */




More information about the Fusionforge-commits mailing list