-- View: sonex.v_permissions

-- DROP VIEW sonex.v_permissions;

CREATE OR REPLACE VIEW sonex.v_permissions
 AS
 SELECT oid AS id,
    rolname AS name,
    COALESCE(shobj_description(oid, 'pg_authid'::name), ''::text) AS description
   FROM pg_roles r
  WHERE rolname ~~ like_escape('permission\_%'::text, '\'::text);

ALTER TABLE sonex.v_permissions
    OWNER TO postgres;

GRANT SELECT ON TABLE sonex.v_permissions TO permission_accounts_view;
GRANT SELECT ON TABLE sonex.v_permissions TO permission_groups_view;
GRANT ALL ON TABLE sonex.v_permissions TO postgres;
GRANT INSERT, DELETE, SELECT, UPDATE ON TABLE sonex.v_permissions TO sonex;

