protected function _authorizeSetPrivacyValue(AnCommandContext $context)
    {
        $value = $context->value;

        if ($this->_entity->authorize('administration')) {
            return true;
        }

        switch ($value) {
            case LibBaseDomainBehaviorPrivatable::GUEST :
            case LibBaseDomainBehaviorPrivatable::REG :
                $ret = true;
            break;

            case LibBaseDomainBehaviorPrivatable::FOLLOWER :
                $ret = $this->_entity->isFollowable() && $this->_entity->leading($this->_viewer);
            break;

            default :
                $ret = $this->_entity->authorize('administration');
        }

        return (bool) $ret;
    }
protected function _authorizeSetPrivacyValue(AnCommandContext $context)
    {
        $value = $context->value;

        if ($this->_entity->authorize('administration')) {
            return true;
        }

        switch ($value) {
            case LibBaseDomainBehaviorPrivatable::GUEST :
            case LibBaseDomainBehaviorPrivatable::REG :
                $ret = true;
            break;

            case LibBaseDomainBehaviorPrivatable::FOLLOWER :
                $ret = $this->_entity->isFollowable() && $this->_entity->leading($this->_viewer);
            break;

            default :
                $ret = $this->_entity->authorize('administration');
        }

        return (bool) $ret;
    }
protected function _authorizeSetPrivacyValue ( AnCommandContext $ context ) { $ value = $ context -> value ; if ( $ this -> _entity -> authorize ( 'administration' ) ) { return true ; } switch ( $ value ) { case LibBaseDomainBehaviorPrivatable :: GUEST : case LibBaseDomainBehaviorPrivatable :: REG : $ ret = true ; break ; case LibBaseDomainBehaviorPrivatable :: FOLLOWER : $ ret = $ this -> _entity -> isFollowable ( ) && $ this -> _entity -> leading ( $ this -> _viewer ) ; break ; default : $ ret = $ this -> _entity -> authorize ( 'administration' ) ; } return ( bool ) $ ret ; }
Check if the viewer can set certain privacy value.

@param AnCommandContext $context Context parameter

@return bool
Check if the viewer can set certain privacy value .