symfonysymfony-voter

Symfony Voters only for checking user permission?


Symfony Voters (Documentation) is for checking user permission for an entity (usually) :

Security voters are the most granular way of checking permissions (e.g. "can this specific user edit the given item?")

Sut if I want to control the permissions on a module (for a user), the Symfony Voters are they adapted ? Example : can't edit module if module is valitated (validated = true on database) ?

In summary, are voters exclusively tied to users or can they then play a more general role ?


Solution

  • Voters will do anything you "tell" them to. For convenience they receive the user as parameter, but you are not obliged to use it.