Skip to content

Commit 179a826

Browse files
author
jarodaerts
committed
Adding the superset rls setup sql
1 parent b9d6721 commit 179a826

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

docker/pythonpath_dev/superset_config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ class CeleryConfig:
103103
"supports_credentials": True,
104104
"allow_headers": ["*"],
105105
"resources": ["*"],
106-
"origins": ["http://northwestern.localhost:3000"]
106+
"origins": ["http://northwestern.localhost:3000", "*"]
107+
}
108+
109+
GUEST_ROLE_NAME= 'embed_role'
110+
GUEST_TOKEN_JWT_EXP_SECONDS = 3600 # 1 hour
111+
X_FRAME_OPTIONS = 'ALLOWALL'
112+
CONTENT_SECURITY_POLICY = {
113+
'frame-ancestors': ["'self'", '*']
107114
}
108115

109116
FEATURE_FLAGS = {"ALERT_REPORTS": True, "EMBEDDED_SUPERSET": True}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-- Enable Row Level Security for all tables in the public schema
2+
DO $$
3+
DECLARE
4+
table_record RECORD;
5+
BEGIN
6+
FOR table_record IN
7+
SELECT tablename
8+
FROM pg_tables
9+
WHERE schemaname = 'public'
10+
LOOP
11+
BEGIN
12+
EXECUTE format('ALTER TABLE %I ENABLE ROW LEVEL SECURITY', table_record.tablename);
13+
14+
-- Create a basic policy that allows access to authenticated users
15+
EXECUTE format('
16+
CREATE POLICY "allow_authenticated_users" ON %I
17+
FOR ALL
18+
TO authenticated
19+
USING (true)
20+
WITH CHECK (true)
21+
', table_record.tablename);
22+
EXCEPTION
23+
WHEN duplicate_object THEN
24+
-- Policy already exists, skip
25+
NULL;
26+
END;
27+
END LOOP;
28+
END $$;

0 commit comments

Comments
 (0)