forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitce6b672
committed
Make role grant system more consistent with other privileges.
Previously, membership of role A in role B could be recorded in thecatalog tables only once. This meant that a new grant of role A torole B would overwrite the previous grant. For other object types, anew grant of permission on an object - in this case role A - existsalong side the existing grant provided that the grantor is different.Either grant can be revoked independently of the other, andpermissions remain so long as at least one grant remains. Make rolegrants work similarly.Previously, when granting membership in a role, the superuser couldspecify any role whatsoever as the grantor, but for other object types,the grantor of record must be either the owner of the object, or arole that currently has privileges to perform a similar GRANT.Implement the same scheme for role grants, treating the bootstrapsuperuser as the role owner since roles do not have owners. This meansthat attempting to revoke a grant, or admin option on a grant, can nowfail if there are dependent privileges, and that CASCADE can be usedto revoke these. It also means that you can't grant ADMIN OPTION ona role back to a user who granted it directly or indirectly to you,similar to how you can't give WITH GRANT OPTION on a privilege backto a role which granted it directly or indirectly to you.Previously, only the superuser could specify GRANTED BY with a userother than the current user. Relax that rule to allow the grantorto be any role whose privileges the current user posseses. Thisdoesn't improve compatibility with what we do for other object types,where support for GRANTED BY is entirely vestigial, but it makes thisfeature more usable and seems to make sense to change at the same timewe're changing related behaviors.Along the way, fix "ALTER GROUP group_name ADD USER user_name" torequire the same privileges as "GRANT group_name TO user_name".Previously, CREATEROLE privileges were sufficient for either, butonly the former form was permissible with ADMIN OPTION on the role.Now, either CREATEROLE or ADMIN OPTION on the role suffices foreither spelling.Patch by me, reviewed by Stephen Frost.Discussion:http://postgr.es/m/CA+TgmoaFr-RZeQ+WoQ5nKPv97oT9+aDgK_a5+qWHSgbDsMp1Vg@mail.gmail.com1 parent36f729e commitce6b672
File tree
15 files changed
+834
-140
lines changed- doc/src/sgml/ref
- src
- backend
- commands
- parser
- utils
- adt
- cache
- bin/pg_dump
- include
- catalog
- utils
- test/regress
- expected
- sql
15 files changed
+834
-140
lines changedLines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
52 | 52 |
| |
53 | 53 |
| |
54 | 54 |
| |
55 |
| - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 |
| |
57 | 61 |
| |
58 | 62 |
| |
|
Lines changed: 9 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
267 | 267 |
| |
268 | 268 |
| |
269 | 269 |
| |
270 |
| - | |
271 |
| - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
272 | 278 |
| |
273 | 279 |
| |
274 | 280 |
| |
| |||
333 | 339 |
| |
334 | 340 |
| |
335 | 341 |
| |
336 |
| - | |
| 342 | + | |
337 | 343 |
| |
338 | 344 |
| |
339 | 345 |
| |
|
Lines changed: 8 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
201 |
| - | |
202 |
| - | |
203 |
| - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
204 | 205 |
| |
205 | 206 |
| |
206 | 207 |
| |
| |||
239 | 240 |
| |
240 | 241 |
| |
241 | 242 |
| |
242 |
| - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
243 | 247 |
| |
244 | 248 |
| |
245 | 249 |
| |
|
0 commit comments
Comments
(0)