diff --git a/core/lib/Drupal/Core/Session/AccountInterface.php b/core/lib/Drupal/Core/Session/AccountInterface.php index ede2854..cd4ca59 100644 --- a/core/lib/Drupal/Core/Session/AccountInterface.php +++ b/core/lib/Drupal/Core/Session/AccountInterface.php @@ -18,6 +18,16 @@ interface AccountInterface { /** + * Role ID for anonymous users. + */ + const ANONYMOUS_ID = 'anonymous'; + + /** + * Role ID for authenticated users. + */ + const AUTHENTICATED_ID = 'authenticated'; + + /** * Returns the user ID or 0 for anonymous. * * @return int diff --git a/core/lib/Drupal/Core/Session/SessionHandler.php b/core/lib/Drupal/Core/Session/SessionHandler.php index 3795beb..c987b29 100644 --- a/core/lib/Drupal/Core/Session/SessionHandler.php +++ b/core/lib/Drupal/Core/Session/SessionHandler.php @@ -11,7 +11,6 @@ use Drupal\Core\Database\Connection; use Drupal\Core\Site\Settings; use Drupal\Core\Utility\Error; -use Drupal\user\RoleInterface; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; @@ -87,7 +86,7 @@ public function read($sid) { $rids = $this->connection->query("SELECT ur.roles_target_id as rid FROM {user__roles} ur WHERE ur.entity_id = :uid", array( ':uid' => $values['uid'], ))->fetchCol(); - $values['roles'] = array_merge(array(RoleInterface::AUTHENTICATED_ID), $rids); + $values['roles'] = array_merge(array(AccountInterface::AUTHENTICATED_ID), $rids); $_session_user = new UserSession($values); } elseif ($values) { diff --git a/core/lib/Drupal/Core/Session/UserSession.php b/core/lib/Drupal/Core/Session/UserSession.php index bc358e0..fb95abf 100644 --- a/core/lib/Drupal/Core/Session/UserSession.php +++ b/core/lib/Drupal/Core/Session/UserSession.php @@ -7,8 +7,6 @@ namespace Drupal\Core\Session; -use Drupal\user\RoleInterface; - /** * An implementation of the user account interface for the global user. * @@ -128,7 +126,7 @@ public function getRoles($exclude_locked_roles = FALSE) { $roles = $this->roles; if ($exclude_locked_roles) { - $roles = array_values(array_diff($roles, array(RoleInterface::ANONYMOUS_ID, RoleInterface::AUTHENTICATED_ID))); + $roles = array_values(array_diff($roles, array(AccountInterface::ANONYMOUS_ID, AccountInterface::AUTHENTICATED_ID))); } return $roles; diff --git a/core/modules/user/src/RoleInterface.php b/core/modules/user/src/RoleInterface.php index 998a5a9..8404365 100644 --- a/core/modules/user/src/RoleInterface.php +++ b/core/modules/user/src/RoleInterface.php @@ -8,6 +8,7 @@ namespace Drupal\user; use Drupal\Core\Config\Entity\ConfigEntityInterface; +use Drupal\Core\Session\AccountInterface; /** * Provides an interface defining a user role entity. @@ -19,12 +20,12 @@ /** * Role ID for anonymous users; should match what's in the "role" table. */ - const ANONYMOUS_ID = 'anonymous'; + const ANONYMOUS_ID = AccountInterface::ANONYMOUS_ID; /** * Role ID for authenticated users; should match what's in the "role" table. */ - const AUTHENTICATED_ID = 'authenticated'; + const AUTHENTICATED_ID = AccountInterface::AUTHENTICATED_ID; /** * Returns a list of permissions assigned to the role.