Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State Voter #63

Open
dbu opened this issue Jun 25, 2013 · 1 comment
Open

State Voter #63

dbu opened this issue Jun 25, 2013 · 1 comment
Labels

Comments

@dbu
Copy link
Member

dbu commented Jun 25, 2013

we could have a state based publish workflow. for the access check, it would look like the following. additionally we need to set the available states on the admin (another admin extension i guess).
then we would need to build some sort of event system around the state changes and maybe provide a simple way to define what should happen for which state. also editing permissions will be more complicated than the simple VIEW permissions.

interface ObjectStateInterface
{
    /**
    * A state label
    *
    * @return string
    */
    getState()
}

class PublishStateVoter
{

    /**
    * @param array $stateRoleMap mapping of state names to required symfony role or true for public
    */
    __construct($container, $stateRoleMap)
    ...

    /**
    *
    vote(...)
    {
        $state = $object->getState;
        if (! isset($this->stateRoleMap[$state])) {
            throw ...
        }
        if (true === $this->stateRoleMap[$state]) {
            return self::ACCESS_GRANTED;
        }
        if VIEW_ANONYMOUS is required, return self::ACCESS_DENIED at this point
        $context = $this->container->get('security.context');
        if (null === $context->getToken()) {
            // no firewall, the user is not authorised
            return self::ACCESS_DENIED;
        }
        if ($context->isGranted($this->stateRoleMap[$state])) {
            return self::ACCESS_GRANTED;
        }

        return self::ACCESS_DENIED;
@dbu
Copy link
Member Author

dbu commented Jul 14, 2014

this should most likely integrate with http://jackrabbit.510166.n4.nabble.com/jcr-2-mix-lifecycle-td2216584.html

@lsmith77 lsmith77 added this to the 1.3 milestone Jun 17, 2015
@dbu dbu removed this from the 1.3 milestone Aug 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants