neos / neos/flow-development-collection

Check for parent roles

Open
#2,000 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug P: Flow
Dominant language
PHP
Stars
143
Forks
191
Avg merge
3d 12h
Merged PRs (30d)
9

Description

Description

If I assign a more specific role to a user and do a check for the base role, I would expect the PolicyService or the Account class to respect the inheritance of roles in Policy.yaml

Steps to Reproduce
  1. Create a Policy.yaml with two inherrited roles, e.g. Base and Specific (parentRoles: - Base).
  2. Assign the Specific role to an account.
  3. Check if the account has the Base role, e.g. $account->hasRole('Base')
Expected behavior

I would expect to get a positive result, as the account has the Base role as inherited role.

Actual behavior

The result of the check is false.

If this is the intended behaviour, what would be the correct way to do a check with respecting the inheritance of roles?

Kind regards,
Christopher

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the PolicyService or Account entry point used by $account->hasRole('Base'), then inspect how Policy.yaml represents parentRoles. Reproduce the Base/Specific example and confirm that checking the inherited Base role returns a positive result, or document the correct check if inheritance is intentionally unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authorization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.