pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Igal @ Lucee.org <igal@lucee.org>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Group Roles with Inheritance
Date: Sat, 23 Dec 2017 11:18:59 -0800
Message-ID: <429a9c34-af4f-2214-42f0-e641162645cd@lucee.org> (raw)

Hello,

I want to create three (group) roles.  The first one will be read-only, 
the second will add INSERT, and the third will add UPDATE and DELETE.

Does the below look OK for this purpose or did I forget something?


/** role_r is read-only with SELECT and EXECUTE */
CREATE ROLE role_r;

GRANT USAGE ON SCHEMA <schema> TO role_r;

GRANT SELECT ON ALL TABLES IN SCHEMA <schema> TO role_r;

GRANT SELECT ON ALL SEQUENCES IN SCHEMA <schema> TO role_r;

GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA <schema> TO role_r;

ALTER DEFAULT PRIVILEGES IN SCHEMA <schema>
     GRANT SELECT ON TABLES TO role_r;

ALTER DEFAULT PRIVILEGES IN SCHEMA <schema>
     GRANT SELECT ON SEQUENCES TO role_r;


/** role_ra adds INSERT */
CREATE ROLE role_ra;
GRANT role_r TO role_ra;

GRANT INSERT ON ALL TABLES IN SCHEMA <schema> TO role_ra;

ALTER DEFAULT PRIVILEGES IN SCHEMA <schema>
     GRANT INSERT ON TABLES TO role_ra;


/** role_rawd adds UPDATE, DELETE */
CREATE ROLE role_rawd;
GRANT role_ra TO role_rawd;

GRANT INSERT ON ALL TABLES IN SCHEMA <schema> TO role_rawd;

ALTER DEFAULT PRIVILEGES IN SCHEMA <schema>
     GRANT UPDATE, DELETE ON TABLES TO role_rawd;


Thank you,


Igal Sapir
Lucee Core Developer
Lucee.org




Message-ID: <429a9c34-af4f-2214-42f0-e641162645cd@lucee.org>
Permalink:  ../429a9c34-af4f-2214-42f0-e641162645cd@lucee.org/
Also on:    postgresql.org/message-id/429a9c34-af4f-2214-42f0-e641162645cd@lucee.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: igal@lucee.org
  Subject: Re: Group Roles with Inheritance
  In-Reply-To: <429a9c34-af4f-2214-42f0-e641162645cd@lucee.org>
  References: <429a9c34-af4f-2214-42f0-e641162645cd@lucee.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox