---
--- Name: read_permissions; Type: VIEW; Schema: public; Owner: -
---
-
-CREATE VIEW read_permissions AS
- WITH RECURSIVE read_permissions(follow, user_uuid, readable_uuid) AS (
- SELECT true AS bool,
- users.uuid,
- users.uuid
- FROM users
- UNION
- SELECT (((links.name)::text = 'can_manage'::text) OR ((links.head_uuid)::text ~~ 'su92l-j7d0g-%'::text)) AS follow,
- rp.user_uuid,
- links.head_uuid
- FROM read_permissions rp,
- links
- WHERE (rp.follow AND ((links.tail_uuid)::text = (rp.readable_uuid)::text))
- )
- SELECT read_permissions.follow,
- read_permissions.user_uuid,
- read_permissions.readable_uuid
- FROM read_permissions;
-
-