protected function _authorizeAction(AnCommandContext $context)
    {
        //if entity is not privatable then it doesn't have access to allow method
        if (!$this->_entity->isPrivatable()) {
            return true;
        }

        //if viewer is admin then return true on the action
        if ($this->_viewer->admin()) {
            return true;
        }

        $action = $context->action;

        //any action on the actor requires being a follower by default
        $context->append(array(
            'default' => LibBaseDomainBehaviorPrivatable::FOLLOWER,
        ));

        //not access to the entiy
        if (! $this->_entity->authorize('access')) {
            return false;
        }

        $parts = explode(':', $action);

        $component = array_shift($parts);
        //check if it's a social app then if it's enabled

        if ($component) {

            $component = $this->getService('repos:components.component')->find(array('component' => $component));

            if (
                $component &&
                $component->authorize('action', array(
                                                    'actor' => $this->_entity,
                                                    'action' => $parts[1],
                                                    'resource' => $parts[0],
                                                    )) === false
            ) {
                return false;
            }
        }

        return $this->_entity->allows($this->_viewer, $action, $context->default);
    }
protected function _authorizeAction(AnCommandContext $context)
    {
        //if entity is not privatable then it doesn't have access to allow method
        if (!$this->_entity->isPrivatable()) {
            return true;
        }

        //if viewer is admin then return true on the action
        if ($this->_viewer->admin()) {
            return true;
        }

        $action = $context->action;

        //any action on the actor requires being a follower by default
        $context->append(array(
            'default' => LibBaseDomainBehaviorPrivatable::FOLLOWER,
        ));

        //not access to the entiy
        if (! $this->_entity->authorize('access')) {
            return false;
        }

        $parts = explode(':', $action);

        $component = array_shift($parts);
        //check if it's a social app then if it's enabled

        if ($component) {

            $component = $this->getService('repos:components.component')->find(array('component' => $component));

            if (
                $component &&
                $component->authorize('action', array(
                                                    'actor' => $this->_entity,
                                                    'action' => $parts[1],
                                                    'resource' => $parts[0],
                                                    )) === false
            ) {
                return false;
            }
        }

        return $this->_entity->allows($this->_viewer, $action, $context->default);
    }
protected function _authorizeAction ( AnCommandContext $ context ) { //if entity is not privatable then it doesn't have access to allow method if ( ! $ this -> _entity -> isPrivatable ( ) ) { return true ; } //if viewer is admin then return true on the action if ( $ this -> _viewer -> admin ( ) ) { return true ; } $ action = $ context -> action ; //any action on the actor requires being a follower by default $ context -> append ( array ( 'default' => LibBaseDomainBehaviorPrivatable :: FOLLOWER , ) ) ; //not access to the entiy if ( ! $ this -> _entity -> authorize ( 'access' ) ) { return false ; } $ parts = explode ( ':' , $ action ) ; $ component = array_shift ( $ parts ) ; //check if it's a social app then if it's enabled if ( $ component ) { $ component = $ this -> getService ( 'repos:components.component' ) -> find ( array ( 'component' => $ component ) ) ; if ( $ component && $ component -> authorize ( 'action' , array ( 'actor' => $ this -> _entity , 'action' => $ parts [ 1 ] , 'resource' => $ parts [ 0 ] , ) ) === false ) { return false ; } } return $ this -> _entity -> allows ( $ this -> _viewer , $ action , $ context -> default ) ; }
Authorizes an action on resources owned by the actor.

@param AnCommandContext $context Context parameter

@return bool
Authorizes an action on resources owned by the actor .