Skip to content
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

Simplified management of roles and allowed to made them inheritable. #2241

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Daniel-KM
Copy link
Contributor

No description provided.

@zerocrates
Copy link
Member

So the idea here is that the value for each role in that "roles" key is the roles it inherits from, and the default ones just don't inherit and that's why they're all empty arrays?

I feel like I'd prefer to see these three config arrays squashed into one "roles" key with the structure

'role_id' => [
    'label' => /* string */,
    'admin' => /* bool */,
    'parents' => /* string[] */.
]

and then we don't have to repeat the ids several places, plus an explicit "parents" subkey feels a little more self-documenting.

@Daniel-KM
Copy link
Contributor Author

I have no preference for the structure of the config, i recopied the old one of \Omeka\Permissions\Acl that has an array for roles and another one for labels.

The main point is to be able to manage roles and new roles simpler, for example guest and derivated ones. Currently, it is complex, because the roles should be created early to be fully managed in previous modules.

For parents, this is a native feature of Laminas Acl (https://docs.laminas.dev/laminas-permissions-acl/usage/#multiple-inheritance-among-roles) and the list of parents just need to be passed when the role is created. The default roles don't use parents, so they are empty array, but a module can add new rights for them just by adding one or more new roles.

@Daniel-KM
Copy link
Contributor Author

So at your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants