fix: fix delete perms user folders

This commit is contained in:
Ruben Fiszel
2024-04-16 19:53:30 +02:00
parent 16aeb549d4
commit c4711d38e0
2 changed files with 23 additions and 0 deletions
@@ -0,0 +1 @@
-- Add down migration script here
@@ -0,0 +1,22 @@
DO
$do$
DECLARE
i text;
arr text[] := array['resource', 'script', 'variable', 'schedule', 'flow', 'app', 'raw_app'];
BEGIN
FOREACH i IN ARRAY arr
LOOP
EXECUTE FORMAT(
$$
DROP POLICY IF EXISTS see_folder_extra_perms_user_delete ON %1$I;
CREATE POLICY see_folder_extra_perms_user_delete ON %1$I FOR DELETE TO windmill_user
USING (SPLIT_PART(%1$I.path, '/', 1) = 'f' AND SPLIT_PART(%1$I.path, '/', 2) = any(regexp_split_to_array(current_setting('session.folders_write'), ',')::text[]));
$$,
i
);
END LOOP;
END
$do$;-- Add up migration script here