From e11f4ef169a933897d23b513067e485f548c0e11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Ignacio=20S=C3=A1nchez=20Lara?= Date: Fri, 14 Aug 2015 15:40:36 +0200 Subject: [PATCH] Group name validation delegated to role creation --- scripts-available/CDB_Groups.sql | 4 ---- test/organization/test.sh | 10 ---------- 2 files changed, 14 deletions(-) diff --git a/scripts-available/CDB_Groups.sql b/scripts-available/CDB_Groups.sql index eb35792..439431c 100644 --- a/scripts-available/CDB_Groups.sql +++ b/scripts-available/CDB_Groups.sql @@ -116,10 +116,6 @@ DECLARE prefix TEXT; max_length constant INTEGER := 63; BEGIN - IF group_name !~ '^[a-zA-Z_][a-zA-Z0-9_]*$' - THEN - RAISE EXCEPTION 'Group name (%) must be a valid identifier. See http://www.postgresql.org/docs/9.2/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS', group_name; - END IF; prefix = format('%s_g_', cartodb._CDB_Group_ShortDatabaseName()); group_role := format('%s%s', prefix, group_name); IF LENGTH(group_role) > max_length diff --git a/test/organization/test.sh b/test/organization/test.sh index 7a80484..abfc7a5 100644 --- a/test/organization/test.sh +++ b/test/organization/test.sh @@ -523,16 +523,6 @@ function test_valid_group_names() { sql postgres "select cartodb._CDB_Group_GroupRole('_group_1$_a');" } -function test_not_valid_group_names() { - sql postgres "select cartodb._CDB_Group_GroupRole('1$_a');" fails - sql postgres "select cartodb._CDB_Group_GroupRole(' group_1$_a');" fails - sql postgres "select cartodb._CDB_Group_GroupRole('group_1$_a ');" fails - sql postgres "select cartodb._CDB_Group_GroupRole(' group_1$_a ');" fails - sql postgres "select cartodb._CDB_Group_GroupRole('group _1$_a');" fails - sql postgres "select cartodb._CDB_Group_GroupRole('groupña');" fails - sql postgres "select cartodb._CDB_Group_GroupRole('a123456789012345678901234567890123456789012345678901234567890');" fails -} - function test_administrator_name_generation() { sql postgres "select cartodb._CDB_Organization_Admin_Role_Name();" }