Re: Data access and user id

Поиск
Список
Период
Сортировка
От Jean-Yves F. Barbier
Тема Re: Data access and user id
Дата
Msg-id 4B08745A.5090800@gmail.com
обсуждение исходный текст
Ответ на Re: Data access and user id  (Richard Broersma <richard.broersma@gmail.com>)
Список pgsql-novice
Richard Broersma a écrit :
> On Sat, Nov 21, 2009 at 8:08 AM, Jean-Yves F. Barbier <12ukwn@gmail.com> wrote:

oops, sorry for the delay: icedove biffer sometimes miss new emails :(

>> My PB is I just can use triggers with SECURITY DEFINER to do that, thus
>> I can't update the field 'user_mod' with user's id because triggers are
>> always executed as their owner's id, not caller's id.
>
> http://www.postgresql.org/docs/8.4/interactive/functions-info.html
>
> Notice that there are different user operators to choose from.
> current_user ( user ), session_user.  I believe that one of those will
> give you what you want.

Yep, but no: my purpose is to forbid any direct rights and pass through
functions & triggers (in this case, trigger *must* be SECURITY DEFINER
to bypass the lack of schema and table permissions.)

The problem is if I use either current_user or session_user in the INSERT
trigger, it returns the trigger's owner Id, not the caller one.

--
Make sure your code does nothing gracefully.

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

Предыдущее
От: Richard Broersma
Дата:
Сообщение: Re: Data access and user id
Следующее
От: "Jean-Yves F. Barbier"
Дата:
Сообщение: Re: Data access and user id