Re: Web users as database users?

Поиск
Список
Период
Сортировка
От Andrei Zhidenkov
Тема Re: Web users as database users?
Дата
Msg-id D8BCF6CD-3C3B-4F66-A26F-17483A80C76C@n26.com
обсуждение исходный текст
Ответ на Re: Web users as database users?  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-general
I used to use a different approach:

1. Create auth() pl/python procedure as follows:

create or replace
function auth(auser_id integer) returns void as $$
    GD['user_id'] = auser_id
$$ language plpythonu;

This procedure is supposed to be called after a sucesseful authorisation (in a database or on application side).

2. Create get_current_user() procedure:

create or replace
function get_current_user() returns integer as $$
    return GD.get('user_id')
$$ language plpythonu stable security definer;

Now you can get current user id from every SQL query or stored procedure. It works fast because Python shared array GD is always present in memory.

On 11. Mar 2020, at 15:46, Michael Lewis <mlewis@entrata.com> wrote:

On Fri, Sep 20, 2019 at 8:19 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
There is a restriction on how many distinct GRANTs you can
issue against any one object --- performance will get bad if the ACL
list gets too large.


Any ballpark numbers here? Are we talking 50 or 8000?

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

Предыдущее
От: Michael Lewis
Дата:
Сообщение: Re: Web users as database users?
Следующее
От: Torsten Krah
Дата:
Сообщение: Re: Force WAL cleanup on running instance