Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve consistency in GRANT syntax between roles and privileges according to SQL standard [CORE5248] #5527

Closed
firebird-automations opened this issue May 20, 2016 · 15 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @mrotteveel

Attachments:
adminOption.sql

The current syntax of GRANT is inconsistent between privileges and roles. Specifically, for privileges there is the `WITH GRANT OPTION`, while for roles there is the `WITH ADMIN OPTION` which has a similar effect (looking at the langref).

I would propose that for roles the `WITH GRANT OPTION` is also added. The `WITH GRANT OPTION` means that the user can 1) grant this role to users and 2) revoke from users the role granted by this user, while `WITH ADMIN OPTION` means that 1) the user can grant privileges to this role and 2) grant this role to users and 3) revoke this role from all users irrespective of the grantee.

For privileges a `WITH ADMIN OPTION` could be added with the same meaning as `WITH GRANT OPTION` for consistency purposes.

Commits: 43579ac 7bf7455

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

We use the standard syntax. SQL spec declares WITH GRANT OPTION for privileges and WITH ADMIN OPTION for roles. I'm not sure they mean the same though, it needs checking.

@firebird-automations
Copy link
Collaborator Author

Modified by: @mrotteveel

description: The current syntax of GRANT is inconsistent between privileges and roles. Specifically, for privileges there is the `WITH GRANT OPTION`, while for roles there is the `WITH ADMIN OPTION` which has a similar effect (looking at the langref).

I would propose that for roles the `WITH GRANT OPTION` is also added. The `WITH GRANT OPTION` means that the user can 1) grant this role to users and 2) revoke from users the role granted by this user, while `WITH ADMIN OPTION` means that 1) the user can grant privileges to this role and 2) grant this role to users and 3) revoke this role from all users irrespective of the grantee.

=>

The current syntax of GRANT is inconsistent between privileges and roles. Specifically, for privileges there is the `WITH GRANT OPTION`, while for roles there is the `WITH ADMIN OPTION` which has a similar effect (looking at the langref).

I would propose that for roles the `WITH GRANT OPTION` is also added. The `WITH GRANT OPTION` means that the user can 1) grant this role to users and 2) revoke from users the role granted by this user, while `WITH ADMIN OPTION` means that 1) the user can grant privileges to this role and 2) grant this role to users and 3) revoke this role from all users irrespective of the grantee.

For privileges a `WITH ADMIN OPTION` could be added with the same meaning as `WITH GRANT OPTION` for consistency purposes.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @mrotteveel

I hadn't thought of that. This ticket was triggered by this SO question: http://stackoverflow.com/questions/37327616/in-firebird-database-how-do-i-grant-a-role-to-a-user-with-the-grant-option

If this is specified by the SQL standard, then maybe we should just leave this as is.

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

In our code ADMIN option behaves exactly like GRANT which violates standard. It should behave like Mark describes (up to ability to drop granted role) - reviewed standard not long ago.

What about extension of GRANT option for roles - that should IMHO be decided separately.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

priority: Minor [ 4 ] => Major [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

And I tend to treat it as a bug in our GRANT/REVOKE.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

issuetype: Improvement [ 4 ] => Bug [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

summary: Improve consistency in GRANT syntax between roles and privileges => Improve consistency in GRANT syntax between roles and privileges according to SQL standard

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

adminOption.sql contains a number of tests checking behavior of grant WITH ADMIN OPTION

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Attachment: adminOption.sql [ 13005 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Fix in B3_0 is minimalistic - I do not want to change behavior in production version, just fixed obvious bug that any role can be dropped by any user. Full fix with SQL standard compliant ADMIN OPTION in role grants is in master branch, i.e. FB4.

Attention - to obtain new behavior in old databases roles should be recreated!

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.1 [ 10730 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants