-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
Remove unused / update menu permissions #16595
base: 3.x
Are you sure you want to change the base?
Conversation
43457eb
to
c64ef7c
Compare
46fc1b8
to
aaa7467
Compare
While I like this, I'm having trouble getting the 3.0.0-policy-permissions-menu-update.php file to actually correct my permissions on an update. Additionally, It is possible for someone to have duplicated or created a new Admin Policy Template, in which case I believe this would only correct one template (if it fired), since it uses getObject. |
I just tested, these should be in the 3.1.0-pl upgrade file. |
I don't quite understand, isn't the permission key enough to update/delete it? The template shouldn't play a role, or am I wrong? |
The primary key of Access Permissions is their ID. When you duplicate a policy, all of their permission names are duplicated as well. So it is possible for there to be multiple entries for 'about', 'credits', 'export_static', 'menu_security', and 'menu_support' for example. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Revert setup/includes/upgrades/mysql/3.0.0-pl.php
- Create a link in setup/includes/upgrades/mysql/3.1.0-pl.php to the 3.1.0-policy-permissions-menu-update.php
I still don't understand the problem, wouldn't a request like |
54ec6a7
to
6316dfc
Compare
No, getObject gets a single object. It is the same as adding limit->(1) to a query |
Basically, I'd recommend changing:
To
|
Further, we need to make sure the permissions being updated are from the appropriate templates. You would need to limit the query by template ids for the targeted template group( s ). |
Why do we need a template limit? I change/delete these permissions everywhere. |
Because permissions with the same key can have different meanings in different template groups. There may not be any of those in this batch, but users can create their own template groups/templates/permissions and the permission names could match. If they did, you would be changing those permissions and breaking their use of them. So while I get in this case there will probably not be any such conflicts (or at least the chances are very low), we need to treat the situation as if they could and write the upgrade scripts appropriately. |
91f5f03
to
5b23faf
Compare
5b23faf
to
06b6ff2
Compare
@Ruslan-Aleev can you please rebase this PR to the current 3.x branch, or do you want me to handle that? |
f1f20cd
to
423a9f5
Compare
@theboxer Corrected, please check. |
I'll have to edit it again after updating the 3.x branch, I'll do it in a few days. |
Hi @Ruslan-Aleev will you have a chance to get to this soon? We've only got one additional PR to sort out plus this one to get to the 3.1 release. |
75d8a1f
to
47c02de
Compare
47c02de
to
0c167b2
Compare
0c167b2
to
39b214a
Compare
@opengeek Are you sure this change won't break custom permissions? You can easily create a custom policy template and add there regular permissions like So with the limit to update only built in policy templates, all custom ones will remain untouched and permissions may/will break for users. The fact that the custom permissions may match those renames is quite dangerous on it's own. My vote would be to For removing unused permissions, that's also debatable. As you can do basically anything asa MODX admin, you can easily tie custom menu entries/CMPs into existing permissions. Should you do that? Probably not, but nothing stops you (and I don't think we warn somewhere from this practice). Should an upgrade potentially leak parts of admin area to unauthorised users? Probably not. |
This could happen, but I think it's very unlikely. The problem is that the access settings are now just a mess, without logic, and it would be better to put things in order there, and that's what I'm thinking of doing. |
What does it do?
Remove unused menu permissions:
about
;credits
;export_static
;menu_security
;menu_support
;menu_tools
;Update menu permissions:
menu_site
;menu_trash
;components
;Brought permissions to a single format 'menu_*', added permissions for menu folders.
For example, the entire settings folder (cog icon) was hidden when disabling the system settings item permission, because the same permission
settings
was set (although there was a separatemenu_system
permission, but for some reason it was not used).Related issue(s)/PR(s)
#14498