Group name validation delegated to role creation

This commit is contained in:
Juan Ignacio Sánchez Lara 2015-08-14 15:40:36 +02:00
parent db89bf1a94
commit e11f4ef169
2 changed files with 0 additions and 14 deletions

View File

@ -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

View File

@ -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();"
}