This event handler clears the assets cache.

@access public
@param \Zepi\Turbo\Framework $framework
@param \Zepi\Turbo\Request\CliRequest $request
@param \Zepi\Turbo\Response\Response $response
171367
public function execute(Framework $framework, CliRequest $request, Response $response)
    {
        // Clean the asset cache
        $this->assetCacheManager->clearAssetCache();
        $response->setOutputPart('cacheCleared', 'The asset cache was successfully cleared!');
    }
264295
public function terminate($request, $response)
    {
        if ($this->sessionHandled && $this->sessionConfigured() && ! $this->usingCookieSessions()) {
            $this->manager->driver()->save();
        }
    }
641512
protected function saveToCache(
        RequestInterface $request,
        ResponseInterface $response
    ): bool {
        $key = $this->getCacheItemKey($request);

        try {
            $body = (string) $response->getBody();
            rewind_body($response);

            $cacheItem = $this
                ->cache
                ->getItem($key)
                ->expiresAfter(new \DateInterval($this->cacheTtl))
                ->set([
                    GuzzleClientMiddlewareInterface::BODY    => $body,
                    GuzzleClientMiddlewareInterface::HEADERS => $response->getHeaders(),
                    GuzzleClientMiddlewareInterface::STATUS  => $response->getStatusCode(),
                    GuzzleClientMiddlewareInterface::REASON  => $response->getReasonPhrase(),
                    GuzzleClientMiddlewareInterface::VERSION => $response->getProtocolVersion(),
                ]);
        } catch (InvalidArgumentException | \Exception $e) {
            if (null !== $this->logger) {
                $this->logger->error($e->getMessage());
            }

            return false;
        }

        $result = $this->cache->save($cacheItem);

        if ($result && null !== $this->logger) {
            $this->logger->info('Guzzle request result is saved to cache', [
                GuzzleClientMiddlewareInterface::URI => (string) $request->getUri(),
            ]);
        }

        return $result;
    }
632502
protected function terminateMiddleware($request, $response)
    {
        $middlewares = $this->app->shouldSkipMiddleware() ? [] : array_merge(
            $this->gatherRouteMiddleware($request),
            $this->middleware
        );

        foreach ($middlewares as $middleware) {
            if (! is_string($middleware)) {
                continue;
            }

            list($name) = $this->parseMiddleware($middleware);

            $instance = $this->app->make($name);

            if (method_exists($instance, 'terminate')) {
                $instance->terminate($request, $response);
            }
        }
    }
1374033
public function run(Request $request, Response $response)
    {
        $this->initController($request, $response);
        $event = $this->eventDispatcher->raiseEvent(
            $this->createLoadedEvent()
        );

        if ($event->isHandled() && $event->getResponse() instanceof Response) {
            return $event->getResponse();
        }

        $this->eventDispatcher->raiseEvent(
            $this->createFinishedEvent(
                $this->runController($request, $response)
            )
        );

        return $response;
    }
565547
public function execute(Framework $framework, CliRequest $request, Response $response)
    {
        // Execute the installer only if there are no users
        $dataRequest = new \Zepi\DataSource\Core\Entity\DataRequest(1, 0, 'name', 'ASC');
        if ($this->userManager->count($dataRequest) > 0) {
            return;
        }
        
        $username = '';
        while ($username === '') {
            $username = trim($this->cliHelper->inputText('Please enter the username for the super-admin user:'));
        }
        
        $password = '';
        while ($password === '') {
            $password = trim($this->cliHelper->inputText('Please enter the password for the super-admin user:'));
        }
        
        // Create the super-admin user
        $user = new \Zepi\Web\AccessControl\Entity\User('', '', $username, '', array());
        $user->setNewPassword($password);
        
        // Save the super-admin user
        $user = $this->userManager->add($user);
        
        // Add the super-admin access level
        $this->accessControlManager->grantPermission(
            $user->getUuid(),
            '\\Zepi\\Web\\AccessControl\\Entity\\User',
            '\\Global\\*',
            'CLI'
        );
    }
1019444
public function resolve(Request $request, Response $response, UriPath $uriPath)
    {
        if ($this->target instanceof HttpUri) {
            $targetUri = $this->target;
        } else {
            $targetUri = $request->uri()->withPath($this->target);
        }

        $response->redirect($targetUri, $this->statusCode);
    }
406862
public function execute(Framework $framework, WebRequest $request, Response $response)
    {
        $uuid = $request->getRouteParam('uuid');
        
        // If there is a request parameter we need to edit a user. Otherwise we create a new one.
        if (is_string($uuid)) {
            $additionalTitle = $this->translate('Modify user', '\\Zepi\\Web\\AccessControl');
            
            $user = $this->userManager->getUserForUuid($uuid);
        } else {
            $additionalTitle = $this->translate('Add user', '\\Zepi\\Web\\AccessControl');
            
            $user = new User('', '', '', '', array());
        }
        $title = $this->translate('User management', '\\Zepi\\Web\\AccessControl');
        $this->layout->setUser($user);
        
        // Prepare the page
        $this->activateMenuEntry('user-administration');
        $this->setTitle($title, $additionalTitle);
        
        // Process the data
        $result = $this->processFormData($request, $response, $user);
        if ($result === true) {
            // Display the successful saved message
            $response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Administration\\EditUserFinished', array(
                'title' => $this->getTitle()
            )));
        } else {
            // Display the form
            $response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Administration\\EditUserForm', array(
                'user' => $user,
                'title' => $this->getTitle(),
                'layout' => $this->layout->getLayout(),
                'layoutRenderer' => $this->getLayoutRenderer()
            )));
        }
    }
726538
public function decorateResponse(Request $request, Response $response)
    {
        if ($request->headers->has(self::ORIGIN_REQUEST_HEADER)) {
            $request->headers->set('referer', $request->headers->get(self::ORIGIN_REQUEST_HEADER));
        }

        $this->setTurbolinksLocationHeaderFromSession($request, $response);

        if ($response->isRedirect() && $response->headers->has(self::ORIGIN_RESPONSE_HEADER)) {
            $this->redirectTo($request, $response);
        }

        $this->modifyStatusCode($request, $response);
    }
1188645
public function execute(Framework $framework, WebRequest $request, Response $response)
    {
        $renderedOutput = $this->render('\\Zepi\\Web\\AccessControl\\Templates\\NoAccessMessage');
        
        $response->setOutput($renderedOutput);
    }
1313206
public function terminate(Request $request, $response)
    {
        if ($this->isLaravel()) {
            $this->getKernel()->terminate($request, $response);

            return;
        }

        $app = $this->getApplication();
        $reflection = new \ReflectionObject($app);

        $middleware = $reflection->getProperty('middleware');
        $middleware->setAccessible(true);

        $callTerminableMiddleware = $reflection->getMethod('callTerminableMiddleware');
        $callTerminableMiddleware->setAccessible(true);

        if (count($middleware->getValue($app)) > 0) {
            $callTerminableMiddleware->invoke($app, $response);
        }
    }
1316579
private function cacheVary(
        RequestInterface $request,
        ResponseInterface $response
    ) {
        $key = $this->getVaryKey($request);
        $this->cache->save($key, $this->normalizeVary($response), $this->getTtl($response));
    }
469934
public function execute(Framework $framework, WebRequest $request, Response $response)
    {
        // Prepare the page
        $this->setTitle($this->translate('Group management', '\\Zepi\\Web\\AccessControl'));
        $this->activateMenuEntry('group-administration');
        
        // Generate the Table
        $groupTable = new \Zepi\Web\AccessControl\Table\GroupTable(
            $framework, 
            true,
            true
        );
        
        // Displays the group table
        $response->setOutput($this->render('\\Zepi\\Web\\AccessControl\\Templates\\Administration\\Groups', array(
            'groupTable' => $groupTable,
            'tableRenderer' => $this->getTableRenderer()
        )));
    }
367922
protected function closeContext(
        Request $request,
        Response $response,
        TokenInterface $token
    ): Response {
        return $token->getOperator()->removeToken($request, $response, $token);
    }
381254
public function execute(Framework $framework, RequestAbstract $request, Response $response, $value = null)
    {
        // Revoke all permissions for the given access level key
        $this->accessControlManager->revokePermissions($value);
        
        return $value;
    }
695572
public function execute(Framework $framework, RequestAbstract $request, Response $response, $value = null)
    {
        if (!($request instanceof WebRequest)) {
            return $value;
        }
        
        $items = $this->eventAccessManager->getAccessLevelsForEvent($value);
        
        // If there are no access levels for the given event name the access
        // to the event is not restricted.
        if ($items === false) {
            return $value;
        }
        
        
        if (!$request->hasSession()) {
            return '\\Zepi\\Core\\AccessControl\\Event\\RedirectRequestWithoutSession';
        }
            
        foreach ($items as $accessLevel) {
            if ($request->getSession()->hasAccess($accessLevel)) {
                return $value;
            }
        }
        
        return '\\Zepi\\Core\\AccessControl\\Event\\DisplayNoAccessMessage';
    }
196374
protected function createForm(Framework $framework, WebRequest $request, Response $response)
    {
        // Create the form
        $form = new Form('login', $request->getFullRoute('login'), 'post');
        
        // Add the user data group
        $errorBox = new ErrorBox(
            'login-errors',
            1
        );
        $form->addPart($errorBox);
        
        $origin = '';
        if ($request->hasParam('_origin')) {
            $origin = $request->getParam('_origin');
        }
        
        $helpText = '';
        if ($this->getSetting('accesscontrol.allowRenewPassword')) {
            $helpText = $this->translate('Lost your password? <a href="%link%">Renew it here.</a>', '\\Zepi\\Web\\AccessControl', array(
                'link' => $request->getFullRoute('request-new-password')
            ));
        }
        
        // Add the user data group
        $group = new Group(
            'user-data',
            $this->translate('User data', '\\Zepi\\Web\\AccessControl'),
            array(
                new Text(
                    'username',
                    $this->translate('Username', '\\Zepi\\Web\\AccessControl'),
                    true
                ),
                new Password(
                    'password',
                    $this->translate('Password', '\\Zepi\\Web\\AccessControl'),
                    true,
                    '',
                    $helpText
                ),
                new Hidden(
                    'origin',
                    $origin
                )
            ),
            10
        );
        $form->addPart($group);
        
        // Add the submit button
        $buttonGroup = new ButtonGroup(
            'buttons',
            array(
                new Submit(
                    'submit',
                    $this->translate('Login', '\\Zepi\\Web\\AccessControl')
                )
            ),
            100
        );
        $form->addPart($buttonGroup);
        
        return $form;
    }