. */ namespace SP\Modules\Web\Controllers\AuthToken; use SP\Core\Events\Event; use SP\Domain\Common\Attributes\Action; use SP\Domain\Common\Dtos\ActionResponse; use SP\Domain\Common\Enums\ResponseType; use SP\Domain\Core\Acl\AclActionsInterface; use SP\Domain\Core\Exceptions\SPException; use function SP\__; use function SP\__u; /** * Class EditController * * @package SP\Modules\Web\Controllers */ final class EditController extends AuthTokenViewBase { /** * Edit action * * @param int $id * * @return ActionResponse * @throws SPException */ #[Action(ResponseType::JSON)] public function editAction(int $id): ActionResponse { if (!$this->acl->checkUserAccess(AclActionsInterface::AUTHTOKEN_EDIT)) { return ActionResponse::error(__u('You don\'t have permission to do this operation')); } $this->view->assign('header', __('Edit Authorization')); $this->view->assign('route', sprintf("authToken/saveEdit/%d", $id)); $this->setViewData($id, false); $this->eventDispatcher->notify('show.authToken.edit', new Event($this)); return ActionResponse::ok('', ['html' => $this->render()]); } }