-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
Panel\Field::role()
allow passing $roles
#6654
base: develop-minor
Are you sure you want to change the base?
Conversation
ee6c42b
to
54481de
Compare
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.
I'm not entirely sure why, but when I test this PR in the sandbox lab, I can only add users with admin roles. The other roles vanish from the field.
40a079a
to
045da6b
Compare
@bastianallgeier It's because of this https://github.com/getkirby/kirby/blob/develop-minor/src/Cms/User.php#L588-L591 - for the last admin we exit here too early. That's fine for changing the role, but not creating. Maybe we need to first merge #6657 and then can remove that check. |
045da6b
to
2d974e0
Compare
dd62413
to
3e86173
Compare
Description
$user->roles($purpose)
#6653 firstUser::roles()
for last admin #6693UserPermissions
#6658Summary of changes
Panel\Field::role()
Reasoning
Different action contexts will have a different set of roles available to display. Instead of putting that logic into this UI method, it should rather allow to pass the appropriate roles collection to this helper method.
Additional context
We will modify the actual roles collection passed in the dialogs in a subsequent PR. We keep them basic for now to have no change in behavior.
Changelog
Fixes
create
andchangeRole
permission and user optionsuser permissions: support for
options
broken #5147user permissions: changeRole has no effect #5146
Enhancements
Ready?
Unit tests for fixed bug/feature