mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 11:17:46 +00:00
Update RSL to 'user.email' settings
Remove dependency to jwt for auth tables
This commit is contained in:
@@ -186,8 +186,7 @@ BEGIN
|
||||
SET preferences =
|
||||
jsonb_set(preferences::jsonb, key::text[], _value::jsonb)
|
||||
WHERE
|
||||
lower(email) = lower(current_setting('request.jwt.claims', true)::json->>'email')
|
||||
OR (lower(email) = lower(current_setting('telegram.email', true)));
|
||||
lower(email) = lower(current_setting('user.email', true));
|
||||
IF FOUND THEN
|
||||
--RAISE WARNING '-> update_user_preferences_fn True';
|
||||
RETURN True;
|
||||
|
@@ -259,10 +259,10 @@ CREATE POLICY admin_all ON auth.vessels TO current_user
|
||||
-- Allow user_role to update and select on their own records
|
||||
CREATE POLICY api_user_role ON auth.vessels TO user_role
|
||||
USING (mmsi = current_setting('vessel.mmsi', true)
|
||||
AND owner_email = current_setting('request.jwt.claims', false)::json->>'email'
|
||||
AND owner_email = current_setting('user.email', true)
|
||||
)
|
||||
WITH CHECK (mmsi = current_setting('vessel.mmsi', false)
|
||||
AND owner_email = current_setting('request.jwt.claims', false)::json->>'email'
|
||||
AND owner_email = current_setting('user.email', true)
|
||||
);
|
||||
--CREATE POLICY grafana_role ON auth.vessels TO grafana
|
||||
-- USING (owner_email = owner_email)
|
||||
@@ -276,7 +276,7 @@ CREATE POLICY admin_all ON auth.accounts TO current_user
|
||||
WITH CHECK (true);
|
||||
-- Allow user_role to update and select on their own records
|
||||
CREATE POLICY api_user_role ON auth.accounts TO user_role
|
||||
USING (email = current_setting('request.jwt.claims', false)::json->>'email'
|
||||
USING (email = current_setting('user.email', true)
|
||||
)
|
||||
WITH CHECK (email = current_setting('request.jwt.claims', false)::json->>'email'
|
||||
WITH CHECK (email = current_setting('user.email', true)
|
||||
);
|
||||
|
Reference in New Issue
Block a user