class UserService (View source)

Methods

static string
createLoginURL(string $destination_url = null, string $federated_identity = null)

Computes the login URL for redirection.

static string
createLogoutURL(string $destination_url)

Computes the logout URL for this request and specified destination URL, for both federated login App and Google Accounts App.

static User
getCurrentUser()

Get the current logged in user.

static boolean
isCurrentUserAdmin()

Return true if the user making this request is an admin for this application, false otherwise.

Details

static string createLoginURL(string $destination_url = null, string $federated_identity = null)

Computes the login URL for redirection.

Parameters

string $destination_url The desired final destination URL for the user once login is complete. If 'destinationURL' does not have a host specified, we will use the host from the current request.
string $federated_identity OpenID 2.0 support has been disabled. Setting this to a non-null value will throw a UsersException. For more information see https://cloud.google.com/appengine/docs/deprecations

Return Value

string Login URL. The Google Accounts Login URL.

Exceptions

UsersException If there was a problem using the Users service.

static string createLogoutURL(string $destination_url)

Computes the logout URL for this request and specified destination URL, for both federated login App and Google Accounts App.

Parameters

string $destination_url The desired final destination URL for the user once logout is complete. If 'destinationURL' does not have a host specified, we will use the host from the current request.

Return Value

string Logout URL.

Exceptions

UsersException If there was a problem using the Users service.

static User getCurrentUser()

Get the current logged in user.

Return Value

User The object representing the current signed in user, or null if no user is signed in.

static boolean isCurrentUserAdmin()

Return true if the user making this request is an admin for this application, false otherwise.

We specifically make this a separate function, and not a member function of the User class, because admin status is not persisted in the datastore. It only exists for the user making this request right now.

Return Value

boolean Whether the current user is an administrator of the application.