示例#1
0
 /**
  * Access item by document ID or file path.
  * If document ID not available search last parent with document to inherit access.
  * If parent document not found use global setting.
  *
  * @param string $task accessed task name
  * @param mixed $docid document ID if null search parent, if false search document ID by path
  * @param string $path file path
  * @return boolean
  */
 public static function authorise($task, $docid, $path, $sessionid = null)
 {
     static $model;
     /* @var $model JoomDOCModelDocument */
     if (is_null($model)) {
         $model = JModelLegacy::getInstance(JOOMDOC_DOCUMENT, JOOMDOC_MODEL_PREFIX);
     }
     if ($docid === null) {
         // search last parent document ID
         $docid = $model->getParentDocumentID($path);
     }
     if ($docid === false) {
         // search document ID by path
         $docid = $model->searchIdByPath($path);
     }
     if ($docid) {
         // get access from file document or inherit from last parent
         return JoomDOCAccess::authorise($task, JoomDOCHelper::getDocumentAsset($docid), $sessionid);
     }
     // get global access
     return JoomDOCAccess::authorise($task, JOOMDOC_OPTION, $sessionid);
 }
示例#2
0
 /**
  * Manage document's licenses.
  *
  * @return boolean
  */
 public static function licenses()
 {
     return JoomDOCAccess::authorise(JOOMDOC_CORE_LICENSES);
 }