. */ namespace SP\Modules\Web\Controllers\PublicLink; use Exception; use SP\Core\Acl\AclActionsInterface; use SP\Core\Events\Event; use SP\Http\JsonResponse; use SP\Modules\Web\Controllers\Traits\JsonTrait; /** * Class RefreshController */ final class RefreshController extends PublicLinkSaveBase { use JsonTrait; /** * Create action * * @param int $id * * @return bool * @throws \JsonException */ public function refreshAction(int $id): bool { try { if (!$this->acl->checkUserAccess(AclActionsInterface::PUBLICLINK_REFRESH)) { return $this->returnJsonResponse( JsonResponse::JSON_ERROR, __u('You don\'t have permission to do this operation') ); } $this->publicLinkService->refresh($id); $this->eventDispatcher->notify('edit.publicLink.refresh', new Event($this)); return $this->returnJsonResponse(JsonResponse::JSON_SUCCESS, __u('Link updated')); } catch (Exception $e) { processException($e); $this->eventDispatcher->notify('exception', new Event($e)); return $this->returnJsonResponseException($e); } } }