/** * @param int $id * @param string $action * * @return \Symfony\Component\HttpFoundation\RedirectResponse * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($id, $action) { if ($this->roleRepository->roleExists($id) === true) { $this->sortOperation->execute($id, $action); $this->permissionsCache->getCacheDriver()->deleteAll(); return $this->redirect()->temporary('acp/permissions'); } throw new Core\Controller\Exception\ResultNotExistsException(); }
/** * Gibt alle in der Datenbank vorhandenen Ressourcen zurück * * @return array */ protected function getResources() { if ($this->resources === []) { $this->resources = $this->permissionsCache->getResourcesCache(); } return $this->resources; }
/** * @param string $action * * @return array|\Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException */ public function execute($action = '') { return $this->actionHelper->handleCustomDeleteAction($action, function (array $items) { $bool = $levelNotDeletable = false; foreach ($items as $item) { if (in_array($item, [1, 2, 4]) === true) { $levelNotDeletable = true; } else { $bool = $this->rolesModel->delete($item); } } $this->permissionsCache->getCacheDriver()->deleteAll(); if ($levelNotDeletable === true) { $result = !$levelNotDeletable; $text = $this->translator->t('permissions', 'role_not_deletable'); } else { $result = $bool !== false; $text = $this->translator->t('system', $result ? 'delete_success' : 'delete_error'); } return $this->redirectMessages()->setMessage($result, $text); }); }
/** * @param int $roleId * @param int $defaultValue * * @return array */ protected function fetchModulePermissions($roleId, $defaultValue = 0) { $rules = $this->permissionsCache->getRulesCache([$roleId]); $modules = $this->modules->getActiveModules(); $privileges = $this->privilegeRepository->getAllPrivileges(); $cPrivileges = count($privileges); foreach ($modules as $name => $moduleInfo) { $moduleDir = strtolower($moduleInfo['dir']); for ($j = 0; $j < $cPrivileges; ++$j) { $privileges[$j]['select'] = $this->generatePrivilegeCheckboxes($roleId, $moduleInfo['id'], $privileges[$j]['id'], isset($rules[$moduleDir][$privileges[$j]['key']]['permission']) ? (int) $rules[$moduleDir][$privileges[$j]['key']]['permission'] : $defaultValue); if ($roleId !== 0) { $privileges[$j]['calculated'] = $this->calculatePermission($rules, $moduleDir, $privileges[$j]['key']); } } $modules[$name]['privileges'] = $privileges; } return $modules; }
protected function renewCaches() { $this->get('core.lang.dictionary_cache')->saveLanguageCache($this->translator->getLocale()); $this->moduleInfoCache->saveModulesInfoCache(); $this->permissionsCache->saveResourcesCache(); }
public function execute() { $this->cache->saveResourcesCache(); }