Supabase: カラムの権限を調べるSQL
2181 ワード
Supabaseで
- どのテーブルのどのカラムに
- 誰が
-
INSERT
やSELECT
,UPDATE
できるか
を調べるSQLです。
カラムレベルでの権限を調べるSQL
カラムレベルの権限はinformation_schema
のcolumn_privileges
ビューを開くと簡単にわかります。Supabaseでは、public
スキーマでのanon
ロールとauthenticated
ロールの権限がアプリケーションが気にすべき権限なので、その2つに絞って見ると分かりやすいです。
select grantee, table_name, column_name, privilege_type
from information_schema.column_privileges
where table_schema = 'public'
and grantee in ('anon', 'authenticated')
order by grantee, table_name, privilege_type, column_name;
実行結果の例
-
grantee
が権限付与されたロール名です。Supabaseではanon
やauthenticated
になります。 -
table_name
はどのテーブルかを指します。 -
column_name
はどのカラムかを指します。 -
privilege_type
はそのカラムに対してSELECT
やINSERT
、UPDATE
ができるかを指します。
ここの結果に出てこないということは、その権限が無いということです。
Author And Source
この問題について(Supabase: カラムの権限を調べるSQL), 我々は、より多くの情報をここで見つけました https://qiita.com/suin/items/a7265c2c5c4c4381da88著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .