You are here

public function ServerController::serverBypassEnable in OAuth2 Server 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/ServerController.php \Drupal\oauth2_server\Controller\ServerController::serverBypassEnable()

Enables a OAuth2 server without a confirmation form.

Parameters

\Drupal\oauth2_server\ServerInterface $oauth2_server: The server to be enabled.

Return value

\Symfony\Component\HttpFoundation\Response The response to send to the browser.

Throws

\Drupal\Core\Entity\EntityStorageException

1 string reference to 'ServerController::serverBypassEnable'
oauth2_server.routing.yml in ./oauth2_server.routing.yml
oauth2_server.routing.yml

File

src/Controller/ServerController.php, line 26

Class

ServerController
Class Server Controller.

Namespace

Drupal\oauth2_server\Controller

Code

public function serverBypassEnable(ServerInterface $oauth2_server) {
  $oauth2_server
    ->setStatus(TRUE)
    ->save();

  // Notify the user about the status change.
  $this
    ->messenger()
    ->addMessage($this
    ->t('The OAuth2 server %name has been enabled.', [
    '%name' => $oauth2_server
      ->label(),
  ]));
  return $this
    ->redirect('oauth2_server.overview');
}