mirror of
https://github.com/xbgmsharp/postgsail.git
synced 2025-09-17 19:27:49 +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 =
|
SET preferences =
|
||||||
jsonb_set(preferences::jsonb, key::text[], _value::jsonb)
|
jsonb_set(preferences::jsonb, key::text[], _value::jsonb)
|
||||||
WHERE
|
WHERE
|
||||||
lower(email) = lower(current_setting('request.jwt.claims', true)::json->>'email')
|
lower(email) = lower(current_setting('user.email', true));
|
||||||
OR (lower(email) = lower(current_setting('telegram.email', true)));
|
|
||||||
IF FOUND THEN
|
IF FOUND THEN
|
||||||
--RAISE WARNING '-> update_user_preferences_fn True';
|
--RAISE WARNING '-> update_user_preferences_fn True';
|
||||||
RETURN 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
|
-- Allow user_role to update and select on their own records
|
||||||
CREATE POLICY api_user_role ON auth.vessels TO user_role
|
CREATE POLICY api_user_role ON auth.vessels TO user_role
|
||||||
USING (mmsi = current_setting('vessel.mmsi', true)
|
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)
|
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
|
--CREATE POLICY grafana_role ON auth.vessels TO grafana
|
||||||
-- USING (owner_email = owner_email)
|
-- USING (owner_email = owner_email)
|
||||||
@@ -276,7 +276,7 @@ CREATE POLICY admin_all ON auth.accounts TO current_user
|
|||||||
WITH CHECK (true);
|
WITH CHECK (true);
|
||||||
-- Allow user_role to update and select on their own records
|
-- Allow user_role to update and select on their own records
|
||||||
CREATE POLICY api_user_role ON auth.accounts TO user_role
|
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