Skip to content

Comments

Fix #6529 / #6732 : Check if entity is Accessible before processActions in EntityFactory#6772

Open
octoseth wants to merge 16 commits intoEasyCorp:4.xfrom
octoseth:fix_6529_6732
Open

Fix #6529 / #6732 : Check if entity is Accessible before processActions in EntityFactory#6772
octoseth wants to merge 16 commits intoEasyCorp:4.xfrom
octoseth:fix_6529_6732

Conversation

@octoseth
Copy link

Hi,
Today I encountered issues #6529 and #6732 in a project, so I propose this fix.

This pull request includes changes to the EntityFactory class in the src/Factory/EntityFactory.php file. The main update is the addition of an accessibility check for entities before processing actions, which ensures that only accessible entities are processed.

Entity accessibility check:

@octoseth octoseth changed the title Check if entity is Accessible before processActions in EntityFactory Fix #6529 / #6732 : Check if entity is Accessible before processActions in EntityFactory Jan 29, 2025
@octoseth octoseth changed the title Fix #6529 / #6732 : Check if entity is Accessible before processActions in EntityFactory [WIP] - Fix #6529 / #6732 : Check if entity is Accessible before processActions in EntityFactory Jan 30, 2025
@octoseth octoseth changed the title [WIP] - Fix #6529 / #6732 : Check if entity is Accessible before processActions in EntityFactory Fix #6529 / #6732 : Check if entity is Accessible before processActions in EntityFactory Feb 1, 2025
@sonofliberty
Copy link

Thanks, your fix works! How is this not merged yet?

@tito10047
Copy link

Hi @javiereguiluz can you please look at this PR? This bugs affected many projects.
Thx :)

@kikwik
Copy link

kikwik commented Oct 9, 2025

Any news about this merge?
I need to use setEntityPermission but is not working with version 4.25

@javiereguiluz javiereguiluz added bug priority: important Bugs to fix and features to implement labels Oct 22, 2025
@javiereguiluz javiereguiluz added this to the 4.x milestone Oct 22, 2025
@gremo
Copy link
Contributor

gremo commented Nov 26, 2025

@kikwik did you find a solution?

@kikwik
Copy link

kikwik commented Nov 28, 2025

@kikwik did you find a solution?

@gremo No, currently I'm not using that feature.
While I am not an expert on EasyAdmin internals, the code proposed by @octoseth did not work for me.
I found that the check needs to be added inside the \EasyCorp\Bundle\EasyAdminBundle\Factory\ActionFactory::processEntityActions() method instead.

like this:

final class ActionFactory
{
    public function processEntityActions(EntityDto $entityDto, ActionConfigDto $actionsDto): void
    {
        if (!$entityDto->isAccessible()) {
            return;
        }

        // here the rest of the easy admin code....

    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug priority: important Bugs to fix and features to implement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants