Add panel. prefix to permissions and new editor role - #730
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR scopes all existing backend permissions under a panel. prefix and introduces a new editor role, while preventing administrators from changing other users’ passwords.
- Prefix all permission keys in views, controllers, and navigation with
panel. - Add an
editorrole configuration supporting the main panel modules - Simplify the Permissions loader and fallback logic in code, and update user/password field behavior
Reviewed Changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| site/users/roles/user.yaml | Removed legacy user permissions block |
| site/users/roles/editor.yaml | Added new editor role with scoped panel.* permissions |
| site/users/roles/admin.yaml | Replaced detailed admin permissions with a single panel: true entry |
| site/schemes/users/user.yaml | Unlocked password and role fields for runtime visibility control |
| panel/views/... | Updated all has() checks to use the panel. prefix |
| panel/config/navigation.php | Prefixed navigation item permissions and changed logout to null |
| formwork/src/Users/Permissions.php | Simplified constructor and updated permission inheritance via beforeLast |
| formwork/src/Panel/Controllers/... | Prefixed all controller guards to use panel.* keys |
| formwork/translations/*.yaml | Added user.role.editor labels; updated FR locale |
Comments suppressed due to low confidence (2)
site/users/roles/user.yaml:1
- The
user.yamlfile no longer defines any permissions after removing the block. Regular users will be unable to access any panel actions. Please restore the permissions mapping with appropriatepanel.*prefixes.
title: '{{user.role.user}}'
formwork/src/Users/Permissions.php:17
- Wildcard (
*) permission handling was removed and no longer short-circuits inhas(), which can lead to infinite recursion ifhas('*')is called. Consider reintroducing an explicit check for'*'before fallback logic.
public function has(string $permission): bool
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The intention of this pull request is to improve the user management for Formwork 2.0, and allow in future frontend users (maybe with a plugin).
The major and breaking change is that now all existing permissions, all within the panel, are now prefixed with
panel., so they won't collide with futuresite.*permissions.It also adds a new
editorrole to replace the previoususerrole (now reserved for future usage, e.g. frontend users).Another important change is that now administrators cannot change passwords of other users. Every user, independently from their role chan change only their own password.