public function canRead() { $itemid = $this->getRequest()->Itemid; $page = $this->getService('com://site/docman.model.pages')->id($itemid)->getItem(); $view = $this->getView()->getName(); // Submit view is meant to be used with new items only if ($page->query['view'] === 'submit' && $this->getModel()->getState()->isUnique()) { return false; } if (in_array($view, array('document', 'list')) && $this->getRequest()->layout !== 'form') { return !$this->getModel()->getItem()->isNew(); } // Only display the edit form if user can add/edit stuff if ($view === 'document' && $this->getRequest()->layout === 'form') { return $this->getModel()->getState()->isUnique() ? $this->canEdit() : $this->canAdd(); } if ($view === 'download') { $result = JFactory::getUser()->authorise('com_docman.download', 'com_docman'); $item = $this->getModel()->getItem(); if ($item->isAclable()) { $result = $item->canPerform('download'); } if (!$result) { $result = $item->created_by == JFactory::getUser()->id; } return (bool) $result; } return parent::canRead(); }