Use case:
Install and enable Admin Toolbar and Admin Toolbar Extra Tools modules.
Create editor role, assign 'Use the administration toolbar' permission to editor.
Create user with editor role.
Login with editor user
Problem:
User can see menu item: "Run database updates" - when clicking on item user get error message but menu item should be neither displayed.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | interdiff.txt | 1.67 KB | amateescu |
| #10 | 2701851-10.patch | 5.74 KB | amateescu |
| #7 | 2701851-7.patch | 4.07 KB | amateescu |
| #7 | 2701851-7-test-only.patch | 3.66 KB | amateescu |
| #2 | core-perm_for_dbupdate_menuitem-2701851-1-8.0.x.patch | 434 bytes | animaci |
Comments
Comment #2
animaci commentedComment #3
animaci commentedI think the menu item should require permission "administer software updates".
Please check my suggested solution I attached. Thanks!
Comment #4
cilefen commentedDoes this patch hide the menu link?
Comment #5
animaci commentedYes, only users who has "administer software updates" permission, will see the menu item.
But as it is my first patch, I really would like somebody to make review :)
Comment #6
animaci commentedAssigned to me but set to unassigned as I would like to ask for review.
Comment #7
amateescu commented@animaci, good find and congrats for your first patch! :)
Access to the db update page is also granted based on the 'update_free_access' setting, so it would be better to use the
access_check.db_updateservice instead.Here's also a small test for this.
Comment #9
dawehnerIs there no place in core where we link to the updates and ideally should check access as well?
Comment #10
amateescu commentedThere are a couple of places where we could do that.
Comment #11
dawehnerYeah its a bit pointless here to be honest, I just though that there is a good link somewhere else, so we could have skipped the custom test controller, but nevermind.
Comment #12
alexpottCommitted c3e0c5b and pushed to 8.1.x ad 8.2.x. Thanks!
Committed to 8.1.x as the fix is a patch release safe bug fix.
Comment #23
animaci commented@amateescu: Thanks for the fix! I can see that my patch was not really useful, only the finding, but I have learnt from your solution, really thanks for that! :)