예제 #1
0
파일: Acl.php 프로젝트: mat33470/PFA
 /**
  * Disallows a permission for a given role.
  *
  * @param string $resourceType
  * @param string $folderPath
  * @param int    $permission
  * @param string $role
  *
  * @return $this|Acl
  */
 public function disallow($resourceType, $folderPath, $permission, $role)
 {
     $folderPath = Path::normalize($folderPath);
     if (!isset($this->rules[$folderPath][$role][$resourceType])) {
         $this->rules[$folderPath][$role][$resourceType] = new MaskBuilder();
     }
     /* @var $ruleMask MaskBuilder */
     $ruleMask = $this->rules[$folderPath][$role][$resourceType];
     $ruleMask->disallow($permission);
     return $this;
 }
예제 #2
0
 /**
  * Renames current working folder
  *
  * @param string $newName new folder name
  *
  * @return array containing newName and newPath
  *
  * @throws \Exception if rename failed
  */
 public function rename($newName)
 {
     $disallowUnsafeCharacters = $this->app['config']->get('disallowUnsafeCharacters');
     if (!Folder::isValidName($newName, $disallowUnsafeCharacters) || $this->backend->isHiddenFolder($newName)) {
         throw new InvalidNameException('Invalid folder name');
     }
     $newBackendPath = dirname($this->getPath()) . '/' . $newName;
     if ($this->backend->has($newBackendPath)) {
         throw new AlreadyExistsException('File already exists');
     }
     $newClientPath = Path::normalize(dirname($this->getClientCurrentFolder()) . '/' . $newName);
     $dispatcher = $this->app['dispatcher'];
     $renameFolderEvent = new RenameFolderEvent($this->app, $this, $newName);
     $dispatcher->dispatch(CKFinderEvent::RENAME_FOLDER, $renameFolderEvent);
     $newName = $renameFolderEvent->getNewFolderName();
     if (!$renameFolderEvent->isPropagationStopped()) {
         if (!$this->getBackend()->rename($this->getPath(), $newBackendPath)) {
             throw new AccessDeniedException();
         }
         /* @var OperationManager $currentRequestOperation */
         $currentRequestOperation = $this->app['operation'];
         if ($currentRequestOperation->isAborted()) {
             // Don't continue in this case, no need to touch thumbs and cache entries
             return array('aborted' => true);
         }
         // Delete related thumbs path
         $this->thumbnailRepository->deleteThumbnails($this->resourceType, $this->getClientCurrentFolder());
         $this->app['cache']->changePrefix(Path::combine($this->resourceType->getName(), $this->getClientCurrentFolder()), Path::combine($this->resourceType->getName(), $newClientPath));
     }
     return array('newName' => $newName, 'newPath' => $newClientPath);
 }