Check if a node authroize being updated.

@param AnCommandContext $context Context parameter

@return bool
434853
protected function _authorizeEdit($context)
    {
        $ret = parent::_authorizeEdit($context);

        if ($ret === false) {
            if ($this->_entity->isOwnable()) {
                $action = $this->_entity->component.':'.$this->_entity->getIdentifier()->name.':add';

                if ($this->_entity->owner->authorize('action', $action)) {
                    return true;
                }
            }
        }

        return $ret;
    }
1261655
protected function _authorizeDelete($context)
    {
        $ret = false;

        $comment = $this->_entity;

        //guest can't delete
        if ($this->_viewer->guest()) {
            return false;
        }

        if ($this->_viewer->admin() || $this->_viewer->eql($comment->author)) {
            return true;
        }

        //check if the parent is ownable and the parent owner authorizes administrator
        if ($this->_entity->parent->isOwnable() && $this->_entity->parent->owner->authorize('administration')) {
            return true;
        }

        return false;
    }
641728
protected function _actionDelete(AnCommandContext $context)
    {
        $this->getResponse()->status = AnHttpResponse::NO_CONTENT;

        $token = $this->getService('repos:connect.session')->fetchSet(array(
                        'owner' => $this->actor,
                        'api' => $this->getAPI()->getName(),
                    ));

        $token->delete()->save();
    }
1082354
protected function _authorizeAdministration(AnCommandContext $context)
    {
        //if viewer is the same as the person
        if ($this->_viewer->eql($this->_entity)) {
            return true;
        }

        //if viewer is super admin
        if ($this->_viewer->superadmin()) {
            return true;
        }

        //if viewer is admin and the person is not a super admin
        if ($this->_viewer->admin() && !$this->_entity->superadmin()) {
            return true;
        }

        return false;
    }
361371
protected function _authorizeAddComment($context)
    {
        if (isset($this->_entity->object)) {
            if (is_array($this->_entity->object)) {
                return false;
            }

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

            return $this->_entity->object->authorize('add.comment');
        } else {
            return false;
        }
    }
839699
protected function _beforeControllerGet(AnCommandContext $context)
    {
        if ($this->cid) {
            $context->response->content = $this->getCommentController()->id($this->cid)->display();

            return false;
        } elseif ($this->permalink && !$context->request->isAjax()) {
            $cid = (int) preg_replace_callback('/[^\d]+/', function($matches) { return ''; }, $this->permalink);
            $offset = $this->getItem()->getCommentOffset($cid);
            $start = (int) ($offset / $this->limit) * $this->limit;
            $url = AnRequest::url();
            $query = $url->getQuery(true);

            if ($this->start != $start) {
                $query = array_merge($query, array('start' => $start));
            }

            unset($query['permalink']);

            $url->setQuery($query);

            $context->response->setRedirect($url.'#scroll='.$this->permalink);

            return false;
        }
    }
112303
function isUsable(?\CharlotteDunois\Livia\Commands\Context $context = null) {
        if($context === null) {
            return $this->globalEnabled;
        }
        
        if($this->guildOnly && $context->message->guild === null) {
            return false;
        }
        
        return ($this->isEnabledIn($context->message->guild) && $this->hasPermission($context) === true);
    }
561667
protected function _actionDispatch(AnCommandContext $context)
    {
        if ($this->action === 'confirm' && $this->token) {
            $context->data->append(array(
               '_action' => 'confirm',
               'token' => $this->token,
            ));

            return $this->execute('post', $context);
        }

        return parent::_actionDispatch($context);
    }
1064928
protected function _authorizeRemoveAdmin(AnCommandContext $context)
    {
        if ($this->_entity->isAdministrable()) {
            return ($this->_entity->administratorIds->count() >= 2);
        }

        return false;
    }
193648
protected function _onEntityValidate(AnCommandContext $context)
    {
        if ($this->nodeA->id === $this->nodeB->id) {
            return false;
        }

        return true;
    }
395213
protected function _authorizeLead(AnCommandContext $context)
    {
        //obviously guests cannot add new followers
        if (is_guest($this->_viewer)) {
            return false;
        }

        //viewers cannot add new followers to themselves
        if ($this->_viewer->eql($this->_entity)) {
            return false;
        }

        //new followers cannot be added to people
        if (is_person($this->_entity)) {
            return false;
        }

        return $this->_entity->authorize('action', 'leadable:add');
    }
1189915
protected function _authorizeSubscribe($context)
    {
        $entity = $this->_entity;

        if (is_guest($this->_viewer)) {
            return false;
        }

        if (! $entity->isSubscribable()) {
            return false;
        }

        return $this->_viewer->following($entity);
    }
476765
protected function _actionBlock(AnCommandContext $context)
    {
        $this->getResponse()->status = AnHttpResponse::RESET_CONTENT;
        $this->getItem()->addBlocker($this->actor);

        return $this->getItem();
    }
1298166
public function authorizeSubscribePackage(AnCommandContext $context)
    {
        $viewer = $context->viewer;

        return !$viewer->hasSubscription(false) || $this->authorize('upgradepackage');
    }
1037879
protected function _actionDelete(AnCommandContext $context)
    {
        //this wil not affect the json calls
        $redirect = AnRequest::get('server.HTTP_REFERER', 'url');
        $this->getController()->getResponse()->setRedirect($redirect);
        $result = $this->getController()->execute('delete', $context);

        return $result;
    }
773138
protected function _authorizeAction(AnCommandContext $context)
    {
        $method = '_authorize'.ucfirst($context->action);

        $ret = self::AUTH_NOT_IMPLEMENTED;

        if (method_exists($this, $method)) {
            $ret = $this->$method($context->resource);
        } elseif ($context->actor) {
            //check if it's enabled and assigned
            if ($this->_entity->isAssignable()) {
                $ret = $this->_entity->activeForActor($context->actor);
            }
        }

        return $ret;
    }
772838
protected function _authorizeDelete(AnCommandContext $context)
    {
        //if viewer same as the person whose profile being vieweed and viewer is a super admin don't allow to delete
        if ($this->_viewer->eql($this->_entity) && $this->_entity->superadmin()) {
            return false;
        }

        return parent::_authorizeDelete($context);
    }