8000 [Security] VoterInterface::vote(TokenInterface $token, $subject, array $attributes) · Issue #16600 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Security] VoterInterface::vote(TokenInterface $token, $subject, array $attributes) #16600
Closed
@lyrixx

Description

@lyrixx

Currently, nothing prevent users to use scalar for the $object parameter in VoterInterface::vote(TokenInterface $token, $object, array $attributes).

We already depreciated VoterInterface::supportsAttribute and VoterInterface::supportsClass.

So I propose this new interface:

interface VoterInterface
{
    const ACCESS_GRANTED = 1;
    const ACCESS_ABSTAIN = 0;
    const ACCESS_DENIED = -1;

    /**
     * Returns the vote for the given parameters.
     *
     * This method must return one of the following constants:
     * ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.
     *
     * @param TokenInterface $token      A TokenInterface instance
     * @param mixed          $subject     The subject to secure
     * @param array          $attributes An array of attributes associated with the method being invoked
     *
     * @return int either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED
     */
    public function vote(TokenInterface $token, $subject, array $attributes);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0