Notice: Over the next few months, we're reorganizing the App Engine documentation site to make it easier to find content and better align with the rest of Google Cloud products. The same content will be available, but the navigation will now match the rest of the Cloud products.

As PHP version 5.5 is no longer supported by the community, we strongly recommend new apps use the PHP 7+ runtime.

\google\appengine\api\users\UserService

FINAL

Methods

createLoginURL

STATIC   

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

Computes the login URL for redirection.

Parameters

Name Description

$destination_url

string

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.

$federated_identity

string

The parameter is used to trigger OpenId Login flow, an empty value will trigger Google OpenID Login by default.

Throws

\google\appengine\api\users\UsersException

If there was a problem using the Users service.

Returns

string

Login URL. If federatedIdentity is set, this will be a federated login using the specified identity. If not, this will use Google Accounts.

createLogoutURL

STATIC   

createLogoutURL(string $destination_url) : string

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

Parameters

Name Description

$destination_url

string

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.

Throws

\google\appengine\api\users\UsersException

If there was a problem using the Users service.

Returns

string

Logout URL.

getCurrentUser

STATIC   

getCurrentUser() : \google\appengine\api\users\User

Get the current logged in user.

Returns

\google\appengine\api\users\User

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

isCurrentUserAdmin

STATIC   

isCurrentUserAdmin() : boolean

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.

Returns

boolean

Whether the current user is an administrator of the application.