From 77182321ff3a20a228020b65ede30c3499066273 Mon Sep 17 00:00:00 2001 From: javi Date: Thu, 26 Jun 2014 15:50:56 +0200 Subject: [PATCH] added delete permission with write permission for organization --- scripts-available/CDB_Organizations.sql | 2 +- test/organization/test.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts-available/CDB_Organizations.sql b/scripts-available/CDB_Organizations.sql index 3f261b8..f15c085 100644 --- a/scripts-available/CDB_Organizations.sql +++ b/scripts-available/CDB_Organizations.sql @@ -54,7 +54,7 @@ FUNCTION cartodb.CDB_Organization_Add_Table_Read_Write_Permission(from_schema te AS $$ BEGIN EXECUTE 'GRANT USAGE ON SCHEMA ' || from_schema || ' TO "' || to_role_name || '"'; - EXECUTE 'GRANT SELECT, INSERT, UPDATE ON ' || from_schema || '.' || table_name || ' TO "' || to_role_name || '"'; + EXECUTE 'GRANT SELECT, INSERT, UPDATE, DELETE ON ' || from_schema || '.' || table_name || ' TO "' || to_role_name || '"'; END $$ LANGUAGE PLPGSQL VOLATILE; diff --git a/test/organization/test.sh b/test/organization/test.sh index c8f1057..081e221 100644 --- a/test/organization/test.sh +++ b/test/organization/test.sh @@ -252,6 +252,9 @@ function test_member_2_can_write_to_member_1_table_after_write_permission_is_add sql cdb_testmember_2 'INSERT INTO cdb_testmember_1.foo VALUES (5), (6), (7), (8), (9);' sql cdb_testmember_1 'SELECT count(*) FROM cdb_testmember_1.foo;' should 10 sql cdb_testmember_2 'SELECT count(*) FROM cdb_testmember_1.foo;' should 10 + sql cdb_testmember_2 'DELETE FROM cdb_testmember_1.foo where a = 9;' + sql cdb_testmember_1 'SELECT count(*) FROM cdb_testmember_1.foo;' should 9 + sql cdb_testmember_2 'SELECT count(*) FROM cdb_testmember_1.foo;' should 9 } function test_member_1_removes_access_and_member_2_can_no_longer_query_the_table() {