Skip to content

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

Open
Daniel-KM wants to merge 2 commits intoomeka:developfrom
Daniel-KM:feat/roles
Open

Simplified management of roles and allowed to made them inheritable.#2241
Daniel-KM wants to merge 2 commits intoomeka:developfrom
Daniel-KM:feat/roles

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.

Daniel-KM pushed a commit to Daniel-KM/Omeka-S-module-Guest that referenced this pull request Dec 23, 2024
Daniel-KM pushed a commit to Daniel-KM/Omeka-S-module-Guest that referenced this pull request Dec 23, 2024
Daniel-KM pushed a commit to Daniel-KM/Omeka-S-module-GuestPrivate that referenced this pull request Feb 24, 2025
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