Trigger with current user

Поиск
Список
Период
Сортировка
От Nicolas Kowalski
Тема Trigger with current user
Дата
Msg-id Pine.LNX.4.33.0107051332180.13218-100000@girose.imag.fr
обсуждение исходный текст
Ответы Re: Trigger with current user  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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.



В списке pgsql-general по дате отправления:

Предыдущее
От: Marc SCHAEFER
Дата:
Сообщение: SUMMARY: NOT IN issue
Следующее
От: "omid omoomi"
Дата:
Сообщение: RE: Table Description!!