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

Methods
Classes and Modules
Constants
Service = UserServiceFactory.getUserService
Class Public methods
admin?()

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.

# File lib/appengine-apis/users.rb, line 68
      def admin?
        Service.is_user_admin?
      end
create_login_url(url)

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

Args:

  • dest_url: The desired final destination URL for the user
              once login is complete. If +dest_url+ does not have a host
              specified, we will use the host from the current request.
    
# File lib/appengine-apis/users.rb, line 43
      def create_login_url(url)
        Service.create_login_url(url)
      end
create_logout_url(url)

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.
    
# File lib/appengine-apis/users.rb, line 53
      def create_logout_url(url)
        Service.create_logout_url(url)
      end
current_user()

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.

# File lib/appengine-apis/users.rb, line 33
      def current_user
        Service.current_user
      end
logged_in?()

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

# File lib/appengine-apis/users.rb, line 58
      def logged_in?
        Service.is_user_logged_in?
      end