You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQRuff issue [1786](quarylabs/sqruff#1786) was solved in sqruff 2.9.1
Re-enable rule LT01 accordingly, and re-apply linting to schema files.
Indicate the minimum version in the readme.
JOIN public."SpaceAccess"AS my_access ON (my_account.id=my_access.account_id)
166
166
JOIN public."SpaceAccess"AS their_access ON (their_access.space_id=my_access.space_idANDtheir_access.account_id=p_account_id)
167
167
WHEREmy_account.dg_account=auth.uid();
168
-
$$;
168
+
$$;
169
169
170
-
CREATE OR REPLACEFUNCTIONpublic.unowned_account_in_shared_space(p_account_id BIGINT) RETURNS boolean
170
+
CREATE OR REPLACEFUNCTIONpublic.unowned_account_in_shared_space(p_account_id BIGINT) RETURNS boolean
171
171
STABLE SECURITY DEFINER
172
172
SET search_path =''
173
173
LANGUAGE sql AS $$
@@ -176,52 +176,52 @@ LANGUAGE sql AS $$
176
176
JOIN public."SpaceAccess"AS their_access ON (their_access.space_id=my_access.space_idANDtheir_access.account_id=p_account_id)
177
177
JOIN public."PlatformAccount"AS their_account ON (their_access.account_id=their_account.idANDtheir_account.id=p_account_id)
178
178
WHEREmy_account.dg_account=auth.uid() AND COALESCE(their_account.dg_account, auth.uid()) =auth.uid();
179
-
$$;
179
+
$$;
180
180
181
-
COMMENT ON FUNCTION public.unowned_account_in_shared_space IS 'security utility: does current user share a space with this account? And is this an un-owned account (other than mine)?';
181
+
COMMENT ON FUNCTION public.unowned_account_in_shared_space IS 'security utility: does current user share a space with this account? And is this an un-owned account (other than mine)?';
182
182
183
183
184
184
-- Space: Allow anyone to insert, but only users who are members of the space can update or select
DROP POLICY IF EXISTS platform_account_policy ON public."PlatformAccount";
201
-
CREATE POLICY platform_account_policy ON public."PlatformAccount" FOR ALL USING (dg_account = (SELECTauth.uid()) OR (dg_account IS nullANDpublic.unowned_account_in_shared_space(id)));
200
+
DROP POLICY IF EXISTS platform_account_policy ON public."PlatformAccount";
201
+
CREATE POLICY platform_account_policy ON public."PlatformAccount" FOR ALL USING (dg_account = (SELECTauth.uid()) OR (dg_account IS nullANDpublic.unowned_account_in_shared_space(id)));
202
202
203
-
DROP POLICY IF EXISTS platform_account_select_policy ON public."PlatformAccount";
204
-
CREATE POLICY platform_account_select_policy ON public."PlatformAccount" FOR SELECT USING (dg_account = (SELECTauth.uid()) ORpublic.account_in_shared_space(id));
203
+
DROP POLICY IF EXISTS platform_account_select_policy ON public."PlatformAccount";
204
+
CREATE POLICY platform_account_select_policy ON public."PlatformAccount" FOR SELECT USING (dg_account = (SELECTauth.uid()) ORpublic.account_in_shared_space(id));
205
205
206
206
-- SpaceAccess: Created through the create_account_in_space and the Space create route, both of which bypass RLS.
207
207
-- Can be updated by a space peer for now, unless claimed by a user.
0 commit comments