EasyCorp / EasyCorp/EasyAdminBundle
Method setEntityPermission doesn't work properly
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4.3k
- Forks
- 1.1k
- Avg merge
- 8d 2h
- Merged PRs (30d)
- 11
Description
From the documentation:
You can also restrict which items users can see in the index and detail pages thanks to the setEntityPermission() method.
I want to restrict access to the index and detail pages to employees who share the same profile property as the current user:
public function configureCrud(Crud $crud): Crud
{
return $crud
->setEntityPermission(
new Expression("subject.profile === user.profile")
)
;
}
And it doesn't work. Expression seems to work fine for edit, delete and detail actions instead.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the security documentation section on setEntityPermission() and trace the configureCrud() entry point using the provided Expression example. Compare permission handling for index and detail pages with edit, delete, and detail actions. Done means an expression such as subject.profile === user.profile correctly restricts the index and detail pages, with coverage for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, symfony
- Domain
- authorization, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100