[evolvis-commits] r15985: Check for empty names when creating a role

mirabilos at evolvis.org mirabilos at evolvis.org
Tue Mar 1 00:42:37 CET 2011


Author: mirabilos
Date: 2011-03-01 00:42:37 +0100 (Tue, 01 Mar 2011)
New Revision: 15985

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/include/Role.class.php
Log:
Check for empty names when creating a role

Modified: trunk/gforge_base/evolvisforge-5.1/src/common/include/Role.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/include/Role.class.php	2011-02-28 23:42:34 UTC (rev 15984)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/include/Role.class.php	2011-02-28 23:42:37 UTC (rev 15985)
@@ -82,6 +82,10 @@
 	 *      @return boolean True if updated OK
 	 */
 	function setName ($role_name) { // From the PFO spec
+		if ($role_name == '') {
+			$this->setError('Cannot set a role name to empty');
+			return false;
+		}
 		if ($this->getName() != stripslashes($role_name)) {
 			if (USE_PFO_RBAC) {
 				db_begin();
@@ -181,6 +185,10 @@
 				$this->setPermissionDeniedError();
 				return false;
 			}			
+			if ($role_name == '') {
+				$this->setError('Cannot create a role with an empty name');
+				return false;
+			}
 			
 			db_begin();
 			if ($this->Group == NULL) {



More information about the evolvis-commits mailing list