From 8f4be835329b7d2c78c8f55b8ecbf622040ccce9 Mon Sep 17 00:00:00 2001
From: Matthias Andreas Benkard <code@mail.matthias.benkard.de>
Date: Sat, 18 Aug 2012 18:19:10 +0200
Subject: Book Marx: Apply role-based access scheme.

---
 schema.sql | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index ea5110f..ad773af 100644
--- a/schema.sql
+++ b/schema.sql
@@ -129,10 +129,8 @@ CREATE TABLE bookmarks INHERITS posts (
   uri         VARCHAR   NOT NULL,
   title       VARCHAR,
   description VARCHAR,
-  visibility  VARCHAR,
   PRIMARY KEY(id),
-  FOREIGN KEY(owner) REFERENCES users,
-  CHECK (visibility IN ('private', 'protected', 'public'))
+  FOREIGN KEY(owner) REFERENCES users
 );
 
 CREATE TABLE bookmark_tags(
@@ -251,5 +249,10 @@ CREATE VIEW user_visible_lazychat_messages AS
     FROM user_visible_posts uvp
     INNER JOIN lazychat_messages lm ON lm.id = uvp.message;
 
+CREATE VIEW user_visible_bookmarks AS
+  SELECT uvp.user, uvp.message
+    FROM user_visible_posts uvp
+    INNER JOIN bookmarks bm ON bm.id = uvp.message;
+
 ROLLBACK;
 --COMMIT;
-- 
cgit v1.2.3

