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