Trigger with current user

From: Nicolas Kowalski <Nicolas(dot)Kowalski(at)imag(dot)fr>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Trigger with current user
Date: 2001-07-05 11:47:48
Message-ID: Pine.LNX.4.33.0107051332180.13218-100000@girose.imag.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hello.

We use PostgreSQL 7.1.2 on Debian GNU/Linux as our Intranet database. I
am currently working on a small mailing-lists management application. I
would like to enforce table access permissions depending on the current
username :

- if the current user is declared as one of the lists maintainers
("SELECT maintainer FROM sys_mailing_lists;"), he(she) will be able to
SELECT, INSERT, UPDATE & DELETE rows in the 'sys_mailing_members' table,

- if not he(she) will only be able to do SELECT's on
'sys_mailing_members'.

So, I thought using triggers. However, I am missing some elements :

- how can I get back the currently connected username ?

- when using a "BEFORE" trigger, how can I cancel the
INSERT/UPDATE/DELETE actions to be performed if the user connected does
not match the access permissions ?

Thanks.
Nicolas.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message eddie iannuccelli 2001-07-05 13:21:15 Re: Re: 7.1.2 ERROR: UNIQUE constraint matching given keys for referenced table ......
Previous Message Ryan Mahoney 2001-07-05 10:36:46 Re: Why is it not using the other processor?