You are here

public function UserSession::id in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Session/UserSession.php \Drupal\Core\Session\UserSession::id()

Returns the user ID or 0 for anonymous.

Return value

int The user ID.

Overrides AccountInterface::id

1 call to UserSession::id()
UserSession::hasPermission in core/lib/Drupal/Core/Session/UserSession.php
Checks whether a user has a certain permission.

File

core/lib/Drupal/Core/Session/UserSession.php, line 85

Class

UserSession
An implementation of the user account interface for the global user.

Namespace

Drupal\Core\Session

Code

public function id() {
  return $this->uid;
}