Skip to content

Commit 5dcaf28

Browse files
authored
Fix viewer cant view article (#664)
* Create 20240426101308_ALTER_select_changes_policy.sql * Update 20240426101308_ALTER_select_changes_policy.sql
1 parent d79ea63 commit 5dcaf28

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- Alter select_changes_policy to allow selects to changes by owners, editors, reviewers and viewers.
2+
ALTER POLICY select_changes_policy
3+
ON changes
4+
TO authenticated
5+
USING (
6+
-- Check if the authenticated user has appropriate permissions
7+
auth.uid() IN (
8+
SELECT user_id
9+
FROM private.get_all_permissions_by_article_id(article_id) p
10+
WHERE p.role IN ('owner', 'editor', 'reviewer','viewer')
11+
)
12+
);

0 commit comments

Comments
 (0)