Re: State of the art re: group default privileges

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Michael Orlitzky <michael(at)orlitzky(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: State of the art re: group default privileges
Date: 2013-03-20 22:40:58
Message-ID: 514A3AFA.10803@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/20/2013 03:26 PM, Michael Orlitzky wrote:
> On 03/20/2013 05:18 PM, Rob Sargent wrote:

>
> At the moment, everyone's just experimenting. Even with the proper
> tooling, my blog app shouldn't have to handle the database permissions
> table-by-table. I should be able to set up sensible defaults.
>
CREATE ROLE adrian LOGIN;
CREATE ROLE ranger LOGIN;
CREATE ROLE dev_user ROLE;
GRANT dev_user TO adrian;
GRANT dev_user TO ranger;

ALTER ROLE adrian IN DATABASE test set role=dev_user;

aklaver(at)panda:~> psql -d test -U adrian
Password for user adrian:
psql (9.0.12)
Type "help" for help.

test=> SELECT current_user;
current_user
--------------
dev_user
(1 row)

test=> SELECT session_user;
session_user
--------------
adrian
(1 row)

test=> CREATE TABLE adrian_tbl(id int);
CREATE TABLE
test=> \c - ranger
Password for user ranger:
You are now connected to database "test" as user "ranger".
test=> INSERT INTO adrian_tbl VALUES (1);
INSERT 0 1

>
>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Orlitzky 2013-03-20 23:11:09 Re: State of the art re: group default privileges
Previous Message Michael Orlitzky 2013-03-20 22:26:32 Re: State of the art re: group default privileges