diff --git a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php index a2aa7d8..04508be 100644 --- a/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/AuthenticationSubscriber.php @@ -40,18 +40,6 @@ public function __construct(AuthenticationProviderInterface $authentication_prov } /** - * Authenticates user on request. - * - * @see \Drupal\Core\Authentication\AuthenticationProviderInterface::authenticate() - */ - public function onKernelRequestAuthenticate(GetResponseEvent $event) { - if ($event->getRequestType() == HttpKernelInterface::MASTER_REQUEST) { - $request = $event->getRequest(); - $this->authenticationProvider->authenticate($request); - } - } - - /** * Triggers authentication clean up on response. * * @see \Drupal\Core\Authentication\AuthenticationProviderInterface::cleanup() @@ -83,9 +71,6 @@ public function onException(GetResponseForExceptionEvent $event) { * Cookie provider to send all relevant session data to the user. */ public static function getSubscribedEvents() { - // Priority must be higher than LanguageRequestSubscriber as LanguageManager - // access current user in case language module enabled. - $events[KernelEvents::REQUEST][] = array('onKernelRequestAuthenticate', 300); $events[KernelEvents::RESPONSE][] = array('onRespond', 0); $events[KernelEvents::EXCEPTION][] = array('onException', 0); return $events; diff --git a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php index ee64237..296b32f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php @@ -49,8 +49,7 @@ function assertEntityAccess($ops, AccessibleInterface $object, AccountInterface */ function testEntityAccess() { // Set up a non-admin user that is allowed to view test entities. - global $user; - $user = $this->createUser(array('uid' => 2), array('view test entity')); + \Drupal::currentUser()->setAccount($this->createUser(array('uid' => 2), array('view test entity'))); $entity = entity_create('entity_test', array( 'name' => 'test', )); @@ -78,8 +77,7 @@ function testEntityAccess() { */ function testEntityAccessDefaultController() { // The implementation requires that the global user id can be loaded. - global $user; - $user = $this->createUser(array('uid' => 2)); + \Drupal::currentUser()->setAccount($this->createUser(array('uid' => 2))); // Check that the default access controller is used for entities that don't // have a specific access controller defined. @@ -101,8 +99,7 @@ function testEntityAccessDefaultController() { function testEntityTranslationAccess() { // Set up a non-admin user that is allowed to view test entity translations. - global $user; - $user = $this->createUser(array('uid' => 2), array('view test entity translations')); + \Drupal::currentUser()->setAccount($this->createUser(array('uid' => 2), array('view test entity translations'))); // Create two test languages. foreach (array('foo', 'bar') as $langcode) {