hasPermission() 공개 정적인 메소드

Returns whether the current user has certain permissions on a tasklist.
public static hasPermission ( string $tasklist, integer $perm ) : boolean
$tasklist string A tasklist id.
$perm integer A Horde_Perms permission mask.
리턴 boolean True if the current user has the requested permissions.
예제 #1
0
 /**
  */
 public function davDeleteObject($collection, $object)
 {
     $dav = $GLOBALS['injector']->getInstance('Horde_Dav_Storage');
     $internal = $dav->getInternalCollectionId($collection, 'tasks') ?: $collection;
     if (!Nag::hasPermission($internal, Horde_Perms::DELETE)) {
         throw new Nag_Exception("Task List does not exist or no permission to delete");
     }
     try {
         $object = $dav->getInternalObjectId($object, $internal) ?: preg_replace('/\\.ics$/', '', $object);
     } catch (Horde_Dav_Exception $e) {
     }
     $GLOBALS['injector']->getInstance('Nag_Factory_Driver')->create($internal)->delete($object);
     try {
         $dav->deleteExternalObjectId($object, $internal);
     } catch (Horde_Dav_Exception $e) {
     }
 }
예제 #2
0
파일: Api.php 프로젝트: Gomez/horde
 /**
  * Saves properties of a time object back to the task that it represents.
  *
  * At the moment only the title, description and due date are saved.
  *
  * @param array $timeobject  A time object hash.
  * @throws Nag_Exception
  */
 public function saveTimeObject(array $timeobject)
 {
     if (!Nag::hasPermission($timeobject['params']['tasklist'], Horde_Perms::EDIT)) {
         throw new Horde_Exception_PermissionDenied();
     }
     $storage = $GLOBALS['injector']->getInstance('Nag_Factory_Driver')->create($timeobject['params']['tasklist']);
     $existing = $storage->get($timeobject['id']);
     $info = array();
     if (isset($timeobject['start'])) {
         $info['due'] = new Horde_Date($timeobject['start']);
         $info['due'] = $info['due']->timestamp();
     }
     if (isset($timeobject['title'])) {
         $info['name'] = $timeobject['title'];
     }
     if (isset($timeobject['description'])) {
         $info['desc'] = $timeobject['description'];
     }
     $storage->modify($timeobject['id'], $info);
 }