Module: AppEngine::OAuth

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

Overview

OAuth protocol provides information useful for granting permissions, and retrieving information about the user who is currently logged-in.

Constant Summary collapse

Service =
OAuthServiceFactory.getOAuthService

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)


54
55
56
# File 'lib/appengine-apis/oauth.rb', line 54

def admin?
  Service.is_user_admin?
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.



36
37
38
# File 'lib/appengine-apis/oauth.rb', line 36

def current_user
    Service.current_user
end

.oauth_consumer_keyObject

Returns the oauth_consumer_key OAuth parameter from the request. Throws: OAuthRequestException - If the request was not a valid OAuth request. OAuthServiceFailureException - If an unknown OAuth error occurred.



44
45
46
# File 'lib/appengine-apis/oauth.rb', line 44

def oauth_consumer_key
  Service.get_oauth_consumer_key
end