Re: [SQL] Grants

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Cc: "Ezequias Rodrigues da Rocha" <ezequias(dot)rocha(at)gmail(dot)com>, imad <immaad(at)gmail(dot)com>, Pgadmin-Support <pgadmin-support(at)postgresql(dot)org>
Subject: Re: [SQL] Grants
Date: 2006-12-01 15:42:10
Message-ID: 200612010742.10553.aklaver@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-sql

On Friday 01 December 2006 06:03 am, Ezequias Rodrigues da Rocha wrote:
>
> 2006/11/30, imad <immaad(at)gmail(dot)com>:
> > You did not grant access privileges to schema.
> > Also GRANT administrators on the base schema as you did for the table.
> >
> > --Imad
> > www.EnterpriseDB.com
> >
> > On 12/1/06, Ezequias Rodrigues da Rocha <ezequias(dot)rocha(at)gmail(dot)com> wrote:
> > > Hi list,
> > >
> > > I am having problem with grants and users on PostgreSQL.
> > >
> > > I am using pgAdmin to connect like other user to test my permissions.
> > >
> > > As the owner of the database I have criated two roles:
> > >
> > > administrators (cannot connect)
> > > ezequias (can connect)
> > >
> > > I give permissions to a table I have:
> > > GRANT SELECT, UPDATE, INSERT ON TABLE base.table1 TO administrators;
> > >
> > >
> > > My user:
> > > CREATE ROLE ezequias LOGIN
> > > NOSUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;
> > > GRANT administradores TO ezequias;
> > >
> > > My group
> > > CREATE ROLE administradores
> > > NOSUPERUSER NOINHERIT NOCREATEDB NOCREATEROLE;
> > >
> > > When I try to access the table base.table1 with ezequias login the
> > > pgAdmin reports:
> > > (see attached image)
> > >
> > > Could someone tell me what I did wrong ?
> > > Ezequias
> > >
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)--------------------------- TIP 5: don't forget to increase
> > > your free space map settings
> ####Schema grants####
>
> CREATE SCHEMA base
> AUTHORIZATION root;
> GRANT ALL ON SCHEMA base TO root;
> GRANT USAGE ON SCHEMA base TO administrators;
>
> ####Table grants####
> GRANT ALL ON TABLE base."local" TO root;
> GRANT SELECT, UPDATE, INSERT ON TABLE base."local" TO administrators;
>
> Still the same problem. :(

Two things I see.
The first may only be a translation artifact. You have CREATE ROLE
administradores and then GRANT to administrators on the table.
Second in the CREATE ROLE ezequias you have NOINHERIT. This means ezequias
does not automatically assume the privileges of the ROLES it belongs to. To
acquire the privileges you have to do a SET ROLE administrators at the
connection.
--
Adrian Klaver
aklaver(at)comcast(dot)net

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Frodo Larik 2006-12-01 18:32:40 bug + pgadmin 1.6.x + Mac OS X + numeric keyboard
Previous Message Ezequias Rodrigues da Rocha 2006-12-01 14:03:38 Re: [SQL] Grants

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2006-12-01 16:40:50 calling elog possibly causing problem in DirectFunctionCall1
Previous Message Richard Broersma Jr 2006-12-01 14:48:02 Re: Setting boolean column based on cumulative integer value