protected function _authorizeAddComment($context)
    {
        if ($this->_viewer->guest()) {
            return false;
        }

        if ($this->_entity->isCommentable()) {
            if (is_person($this->_viewer) && $this->_viewer->admin()) {
                return true;
            }

            if (!$this->_entity->openToComment) {
                return false;
            }

            if ($this->_entity->isOwnable()) {
                //if the owner has blocked the viewer or the other way around, return false
                $owner = $this->_entity->owner;

                if ($this->_entity->owner->blocking($this->_viewer) || $this->_viewer->blocking($this->_entity->owner)) {
                    return false;
                }

                //if ownable and can't access the owner then
                //can't comment
                if ($this->_entity->owner->authorize('access') === false) {
                    return false;
                }

                $action = 'com_'.$this->_entity->getIdentifier()->package.':'.$this->_entity->getIdentifier()->name.':addcomment';
                $result = $this->_entity->owner->authorize('action', array('action' => $action));

                if ($result === false) {
                    /*
                     * @TODO We need to communicate back the nature of not having a 
                     * permission to comment on an entity.Right now we are using
                     * the entity iself as the communication mechanism. Perpas an error
                     * object to AnCommandContext
                     */
                    $this->_entity->__require_follow = false;

                    if ($this->_entity->owner->hasPermission($action, LibBaseDomainBehaviorPrivatable::FOLLOWER)) {
                        $this->_entity->__require_follow = true;
                    }
                }

                return $result;
            }
        }

        return  false;
    }
protected function _authorizeAddComment($context)
    {
        if ($this->_viewer->guest()) {
            return false;
        }

        if ($this->_entity->isCommentable()) {
            if (is_person($this->_viewer) && $this->_viewer->admin()) {
                return true;
            }

            if (!$this->_entity->openToComment) {
                return false;
            }

            if ($this->_entity->isOwnable()) {
                //if the owner has blocked the viewer or the other way around, return false
                $owner = $this->_entity->owner;

                if ($this->_entity->owner->blocking($this->_viewer) || $this->_viewer->blocking($this->_entity->owner)) {
                    return false;
                }

                //if ownable and can't access the owner then
                //can't comment
                if ($this->_entity->owner->authorize('access') === false) {
                    return false;
                }

                $action = 'com_'.$this->_entity->getIdentifier()->package.':'.$this->_entity->getIdentifier()->name.':addcomment';
                $result = $this->_entity->owner->authorize('action', array('action' => $action));

                if ($result === false) {
                    /*
                     * @TODO We need to communicate back the nature of not having a 
                     * permission to comment on an entity.Right now we are using
                     * the entity iself as the communication mechanism. Perpas an error
                     * object to AnCommandContext
                     */
                    $this->_entity->__require_follow = false;

                    if ($this->_entity->owner->hasPermission($action, LibBaseDomainBehaviorPrivatable::FOLLOWER)) {
                        $this->_entity->__require_follow = true;
                    }
                }

                return $result;
            }
        }

        return  false;
    }
protected function _authorizeAddComment ( $ context ) { if ( $ this -> _viewer -> guest ( ) ) { return false ; } if ( $ this -> _entity -> isCommentable ( ) ) { if ( is_person ( $ this -> _viewer ) && $ this -> _viewer -> admin ( ) ) { return true ; } if ( ! $ this -> _entity -> openToComment ) { return false ; } if ( $ this -> _entity -> isOwnable ( ) ) { //if the owner has blocked the viewer or the other way around, return false $ owner = $ this -> _entity -> owner ; if ( $ this -> _entity -> owner -> blocking ( $ this -> _viewer ) || $ this -> _viewer -> blocking ( $ this -> _entity -> owner ) ) { return false ; } //if ownable and can't access the owner then //can't comment if ( $ this -> _entity -> owner -> authorize ( 'access' ) === false ) { return false ; } $ action = 'com_' . $ this -> _entity -> getIdentifier ( ) -> package . ':' . $ this -> _entity -> getIdentifier ( ) -> name . ':addcomment' ; $ result = $ this -> _entity -> owner -> authorize ( 'action' , array ( 'action' => $ action ) ) ; if ( $ result === false ) { /*
                     * @TODO We need to communicate back the nature of not having a 
                     * permission to comment on an entity.Right now we are using
                     * the entity iself as the communication mechanism. Perpas an error
                     * object to AnCommandContext
                     */ $ this -> _entity -> __require_follow = false ; if ( $ this -> _entity -> owner -> hasPermission ( $ action , LibBaseDomainBehaviorPrivatable :: FOLLOWER ) ) { $ this -> _entity -> __require_follow = true ; } } return $ result ; } } return false ; }
Checks if a comment can be added to a  node.

@param AnCommandContext $context Context parameter

@return bool
Checks if a comment can be added to a node .