From 28c046e169c5874ce066228e7f3658d02317c216 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 18 Aug 2012 17:49:46 +0200 Subject: Schema: Genericize access control. --- migrations/6_genericize_access_control.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 migrations/6_genericize_access_control.sql (limited to 'migrations') diff --git a/migrations/6_genericize_access_control.sql b/migrations/6_genericize_access_control.sql new file mode 100644 index 0000000..b415d5b --- /dev/null +++ b/migrations/6_genericize_access_control.sql @@ -0,0 +1,14 @@ +ALTER TABLE lazychat_targets RENAME TO post_targets; + +CREATE VIEW user_visible_posts AS + SELECT eur.user, t.message + FROM effective_user_roles eur, post_targets t + WHERE t.target = eur.role + UNION + SELECT m.owner, m.message + FROM posts m; + +CREATE OR REPLACE VIEW user_visible_lazychat_messages AS + SELECT uvp.user, uvp.message + FROM user_visible_posts uvp + INNER JOIN lazychat_messages lm ON lm.id = uvp.message; -- cgit v1.2.3