Exemplo n.º 1
0
 public function canAdd()
 {
     $result = parent::canAdd();
     // FIXME: layout=form is not used anymore
     if ($this->getModel()->getState()->isUnique() || $this->getRequest()->query->layout === 'form') {
         $category = $this->getModel()->fetch();
         if ($category && $category->isPermissible()) {
             $result = $category->canPerform('add');
         }
     }
     return (bool) $result;
 }
Exemplo n.º 2
0
    public function canAdd()
    {
        // If we are on a certain category make sure user can add something here
        if ($this->getRequest()->query->slug)
        {
            $category = $this->getModel()->fetch();
            $result   = (!$category->isPermissible() || $category->canPerform('add'));
        }
        else
        {
            $result = parent::canAdd();
        }

        return $result;
    }
Exemplo n.º 3
0
 public function canAdd()
 {
     $result = parent::canAdd();
     // adding a document
     if (!$this->getRequest()->isGet()) {
         $data = $this->getRequest()->data;
         $category_id = !empty($data->docman_category_id) ? $data->docman_category_id : $this->getRequest()->query->get('docman_category_id', 'int');
         if ($category_id) {
             $category = $this->getObject('com://admin/docman.model.categories')->id((int) $category_id)->fetch();
             if ($category && $category->isPermissible()) {
                 $result = $category->canPerform('add');
             }
         }
     } else {
         if (count(self::getAuthorisedCategories(array('core.create')))) {
             $result = true;
         }
     }
     return (bool) $result;
 }
Exemplo n.º 4
0
    public function canAdd()
    {
        $result = parent::canAdd();

        // FIXME: layout=form is not used anymore
        if ($this->getModel()->getState()->isUnique() || $this->getRequest()->query->layout === 'form')
        {
            $data        = $this->getRequest()->data;
            $category_id = !empty($data->docman_category_id) ? $data->docman_category_id : $this->getRequest()->query->get('docman_category_id', 'int');

            if ($category_id)
            {
                $category = $this->getObject('com://admin/docman.model.categories')->id((int)$category_id)->fetch();
                if ($category && $category->isPermissible()) {
                    $result = $category->canPerform('add');
                }
            }
        }

        return (bool) $result;
    }
Exemplo n.º 5
0
    public function canAdd()
    {
        if ($this->getRequest()->getMethod() == 'GET')
        {
            $result = parent::canAdd();
        }
        else
        {
            $data = $this->getRequest()->data;

            if ($category_id = $data->docman_category_id)
            {
                $category = $this->getObject('com://admin/docman.model.categories')->id((int) $category_id)->fetch();

                if ($category && $category->isPermissible())
                {
                    $result = $category->canPerform('add');
                }
            }
        }

        return (bool) $result;
    }