Re: How can I kow my permissions?

From: Martin Neimeier <nei(at)ibn(dot)de>
To: Waldemar Baraldi <wbaraldi(at)lacasilla(dot)com(dot)ar>, PostgreSQL-General Mailinglist <pgsql-general(at)postgresql(dot)org>
Subject: Re: How can I kow my permissions?
Date: 2000-09-04 10:11:07
Message-ID: 39B3753B.303DFCF2@ibn.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Waldemar Baraldi wrote:
>
> I'm programming a database application that uses the API, but I have
> some security issues that I have to manage, so I need to know my access
> rights on a table and the "try" technique is not appropiate because if I
> get a "Permission denied" then my transaction block is aborted and I
> don't want that to happend.
> The psql program can read it with the \z option so I know that it can be
> done, so, how? from tha API, a query? which?.
>
> Thanks in advance and sorry for my English, I speak Spanish.

H Waldemar,

you can query the system-table "pg_class". The filed "relacl" holds the acl for the table.

The form is:
{RIGHT[,RIGHT]}

where RIGHT is in the form:
"[user]=[acl-for-user]"

acl-for-user is a combination of the following:
a - insert granted
r - select granted
w - update granted
R - rule granted

Sample Entry:
{"=","admin=arwR","simpleuser=r","updater=w"}

means:
PUBLIC: allowed nothing
admin: insert,select,update,rule
simpleuser: select
updater: update

Hope this works for you.

cu
Martin
--
Martin Neimeier
Ingenieur-Buero Neimeier
Schwarzach / Germany
mailto:nei(at)ibn(dot)de / http://www.ibn.de (under heavy reconstruction)
Tel:+49(6262)912344 / Fax:+49(6262)912347

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gabriel Fernandez 2000-09-04 10:32:02 Problem with drop table within a transaction
Previous Message Jan Wieck 2000-09-04 10:05:51 Re: Updating cursors