Open
Conversation
Collaborator
tuboihirokidesu
left a comment
There was a problem hiding this comment.
提案したポリシーを追加するだけだと他のポリシーとの競合が生じる可能性があるので、適宜動作確認もお願いします。
src/supabase/sql/db_rls_settings.sql
Outdated
Comment on lines
+37
to
+39
| CREATE POLICY "ユーザー情報取得" ON "public"."User" AS PERMISSIVE FOR | ||
| SELECT | ||
| TO authenticated USING ( (auth.uid() = (user_id):: uuid)) |
Collaborator
There was a problem hiding this comment.
このポリシーだと認証していないユーザーはシェフの情報を参照することができなくないですか?
以下のポリシーも必要かと思います
CREATE POLICY "シェフ情報公開" ON "public"."User" AS PERMISSIVE FOR
SELECT
TO public USING (role = 'CHEF');同様にユーザーリンクなどもポリシーが必要かと思います
src/supabase/sql/db_rls_settings.sql
Outdated
|
|
||
| -- Recipe | ||
|
|
||
| CREATE POLICY "レシピ情報取得(公開・非公開の設定はコード" ON "public"."Recipe" AS PERMISSIVE FOR |
Collaborator
There was a problem hiding this comment.
すみません、設定はコードという意味がわかっていないのですが、
レシピに関しては以下のポリシーが必要かと思います
CREATE POLICY "シェフのレシピ情報取得" ON "public"."Recipe" AS PERMISSIVE FOR
SELECT TO public USING (user.role = 'CHEF' OR isPublished = true OR auth.uid() = user_id)
CREATE POLICY "非公開レシピ情報取得" ON "public"."Recipe" AS PERMISSIVE FOR
SELECT TO authenticated USING (isPublished = false AND auth.uid() = user_id)同様に材料や作り方などもポリシーが必要かと思います
src/supabase/sql/db_rls_settings.sql
Outdated
Comment on lines
+86
to
+88
| CREATE POLICY "レシピ情報削除" ON "public"."Recipe" AS PERMISSIVE FOR | ||
| DELETE | ||
| TO authenticated USING ( (auth.uid() = (user_id):: uuid)) |
Collaborator
There was a problem hiding this comment.
シェフのレシピは管理者が作成するので管理者権限を持つユーザーも削除できるように以下のように改良する必要があると思います
作成や更新も同様ですかね
Suggested change
| CREATE POLICY "レシピ情報削除" ON "public"."Recipe" AS PERMISSIVE FOR | |
| DELETE | |
| TO authenticated USING ( (auth.uid() = (user_id):: uuid)) | |
| CREATE POLICY "レシピ情報削除" ON "public"."Recipe" AS PERMISSIVE FOR | |
| DELETE | |
| USING (user.role = 'ADMIN' OR auth.uid() = user_id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
関連する issue*
#165
作業内容*
Supabaseで設定したRLS設定をSQLファイルに記載
メイン実装
そのほか発生した実装
残してある課題
チェックリスト*
実装者
その他