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
Comments
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. |
Modified by: @mrotteveeldescription: 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. |
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
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. |
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. |
Modified by: @AlexPeshkoffpriority: Minor [ 4 ] => Major [ 3 ] |
Commented by: @AlexPeshkoff And I tend to treat it as a bug in our GRANT/REVOKE. |
Modified by: @AlexPeshkoffissuetype: Improvement [ 4 ] => Bug [ 1 ] |
Modified by: @AlexPeshkoffsummary: Improve consistency in GRANT syntax between roles and privileges => Improve consistency in GRANT syntax between roles and privileges according to SQL standard |
Commented by: @AlexPeshkoff adminOption.sql contains a number of tests checking behavior of grant WITH ADMIN OPTION |
Modified by: @AlexPeshkoffAttachment: adminOption.sql [ 13005 ] |
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! |
Modified by: @AlexPeshkoffstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 3.0.1 [ 10730 ] Fix Version: 4.0 Alpha 1 [ 10731 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: No test => Done successfully |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
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
The text was updated successfully, but these errors were encountered: