pgsql: Refactor permissions-checking for role grants.

Поиск
Список
Период
Сортировка
От Robert Haas
Тема pgsql: Refactor permissions-checking for role grants.
Дата
Msg-id E1pDVz6-002D11-GE@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Refactor permissions-checking for role grants.

Instead of having checks in AddRoleMems() and DelRoleMems(), have
the callers perform checks where it's required. In some cases it
isn't, either because the caller has already performed a check for
the same condition, or because the check couldn't possibly fail.

The "Skip permission check if nothing to do" check in each of
AddRoleMems() and DelRoleMems() is pointless. Some call sites
can't pass an empty list. Others can, but in those cases, the role
being modified is one that the current user has just created.
Therefore, they must have permission to modify it, and so no
permission check is required at all.

This patch is intended to have no user-visible consequences. It is
intended to simplify future work in this area.

Patch by me, reviewed by Mark Dilger.

Discussion: http://postgr.es/m/CA+TgmobFzTLkLwOquFrAcdsWBsOWDr-_H-jw+qBvfx-wSzMwDA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/25bb03166b16db1faf18c677ed88f046fb08103f

Modified Files
--------------
src/backend/commands/user.c | 116 +++++++++++++++++++++-----------------------
1 file changed, 54 insertions(+), 62 deletions(-)


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Fix calculation of which GENERATED columns need to be updated.
Следующее
От: Robert Haas
Дата:
Сообщение: pgsql: Pass down current user ID to AddRoleMems and DelRoleMems.