Skip to content

Method setEntityPermission doesn't work properlyΒ #7262

@gremo

Description

@gremo

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.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions