Symfony Voters: Access Denied

484 Views Asked by At

Is it normal when supports() returns false, it results Access Denied? According the Doc, Voter should end-up on supports so I assume an access should be granted.

Voter::supports($attribute, $subject)

When isGranted() (or denyAccessUnlessGranted()) is called, the first argument is passed here as $attribute (e.g. ROLE_USER, edit) and the second argument (if any) is passed as $subject (e.g. null, a Post object). Your job is to determine if your voter should vote on the attribute/subject combination. If you return true, voteOnAttribute() will be called. Otherwise, your voter is done: some other voter should process this. In this example, you return true if the attribute is view or edit and if the object is a Post instance.

0

There are 0 best solutions below