From: Roland Mas Date: Wed, 18 Jul 2012 14:43:40 +0000 (+0000) Subject: Patch [#441] to make role names case-insensitively-unique X-Git-Tag: v5_2_rc2~52 X-Git-Url: https://scm.fusionforge.org/anonscm/gitweb?p=fusionforge%2Ffusionforge.git;a=commitdiff_plain;h=d308e5551894a16145062b2dcfd89aebb7c6aa49;hp=e5ca600e7401eaca6d9552f039a504ce7168e183 Patch [#441] to make role names case-insensitively-unique --- diff --git a/src/common/include/Role.class.php b/src/common/include/Role.class.php index b3c346aa23..63ea01b848 100644 --- a/src/common/include/Role.class.php +++ b/src/common/include/Role.class.php @@ -173,7 +173,7 @@ class Role extends RoleExplicit implements PFO_RoleExplicit { db_begin(); if ($this->Group == NULL) { - $res = db_query_params('SELECT role_name FROM pfo_role WHERE home_group_id IS NULL AND role_name=$1', + $res = db_query_params('SELECT role_name FROM pfo_role WHERE home_group_id IS NULL AND LOWER(role_name)=LOWER($1)', array (htmlspecialchars($role_name))); if (db_numrows($res)) { $this->setError('Cannot create a role with this name (already used)'); @@ -181,7 +181,7 @@ class Role extends RoleExplicit implements PFO_RoleExplicit { return false; } } else { - $res = db_query_params('SELECT role_name FROM pfo_role WHERE home_group_id=$1 AND role_name=$2', + $res = db_query_params('SELECT role_name FROM pfo_role WHERE home_group_id=$1 AND LOWER(role_name)=LOWER($2)', array ($this->Group->getID(), htmlspecialchars($role_name))); if (db_numrows($res)) { $this->setError('Cannot create a role with this name (already used)');