Module: AppEngine::Users

Defined in:
lib/appengine-apis/users.rb

Overview

Users provides information useful for forcing a user to log in or out, and retrieving information about the user who is currently logged-in.

Defined Under Namespace

Classes: User

Constant Summary collapse

Service =
UserServiceFactory.getUserService

Class Method Summary collapse

Class Method Details

.admin?Boolean

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

This is 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)


68
69
70
# File 'lib/appengine-apis/users.rb', line 68

def admin?
  Service.is_user_admin?
end

.create_login_url(url) ⇒ Object

Computes the login URL for this request and specified destination URL.

Args:

  • dest_url: The desired final destination URL for the user

    once  is complete. If +dest_url+ does not have a host
    specified, we will use the host from the current request.
    


43
44
45
# File 'lib/appengine-apis/users.rb', line 43

def (url)
  Service.(url)
end

.create_logout_url(url) ⇒ Object

Computes the logout URL for this request and specified destination URL.

Args:

  • dest_url: String that is the desired final destination URL for the

    user once logout is complete. If +dest_url+ does not have
    a host specified, uses the host from the current request.
    


53
54
55
# File 'lib/appengine-apis/users.rb', line 53

def create_logout_url(url)
  Service.create_logout_url(url)
end

.current_userObject

If the user is logged in, this method will return a User that contains information about them. Note that repeated calls may not necessarily return the same User object.



33
34
35
# File 'lib/appengine-apis/users.rb', line 33

def current_user
  Service.current_user
end

.logged_in?Boolean

Returns true if there is a user logged in, false otherwise.

Returns:

  • (Boolean)


58
59
60
# File 'lib/appengine-apis/users.rb', line 58

def logged_in?
  Service.is_user_logged_in?
end