Scope enrollment membership migration and use pull-only deployed gateway
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
-- Migration 24 could not see FORCE ROW LEVEL SECURITY memberships without a
|
||||
-- tenant context, even when run by the table owner. Use each tenant's policy.
|
||||
DO $$
|
||||
DECLARE
|
||||
current_tenant uuid;
|
||||
BEGIN
|
||||
FOR current_tenant IN SELECT tenant_id FROM tenants LOOP
|
||||
PERFORM set_config('app.tenant_id', current_tenant::text, true);
|
||||
UPDATE memberships SET permissions = array_append(permissions, 'devices:enroll')
|
||||
WHERE tenant_id = current_tenant AND 'devices:revoke' = ANY(permissions)
|
||||
AND NOT ('devices:enroll' = ANY(permissions));
|
||||
END LOOP;
|
||||
END;
|
||||
$$;
|
||||
Reference in New Issue
Block a user