/** * 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; }
/** * 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); }