示例#1
0
 public function execute($name, KCommandContext $context)
 {
     /*
      * For config and file controllers, we have specific checks for all actions on them
      */
     $result = true;
     if ($this->_mixer->getIdentifier()->name === 'config') {
         $result = $this->canAdmin();
     }
     if ($this->_mixer->getIdentifier()->name === 'file' || $this->getRequest()->routed) {
         if (!in_array($context->action, array('get', 'display', 'read', 'browse'))) {
             $result = JFactory::getUser()->authorise('com_docman.upload', 'com_docman');
         } else {
             $result = $this->canManage() || $this->canChangeAnything();
         }
     }
     if ($result === false) {
         $context->setError(new KControllerException('Action ' . ucfirst($context->action) . ' Not Allowed', KHttpResponse::METHOD_NOT_ALLOWED));
         return false;
     }
     return parent::execute($name, $context);
 }
示例#2
0
    public function canBrowse()
    {
        if ($this->getMixer()->getIdentifier()->name === 'submit') {
            return false;
        }

        return parent::canBrowse();
    }