1

I have a Google App Engine application for the use of Google Apps users. For that I need the roles and priviledges of users to be reflected in Google App Engine application. But using UserServices API I am only able to retrieve nick name, email ID all the details. But I found no way for retrieving the Role assigned to a particular user inside my GAE application.

Lipis
  • 21,388
  • 20
  • 94
  • 121

2 Answers2

1

There is no way to get the exact role of the user that you have assigned in your GAE dashboard, but you can check if the currently logged in user is on that list. If you are using Python here is how you can achieve that:

from google.appengine.api import users

user = users.get_current_user()

if user:
    print 'Welcome, %s!' % user.nickname()
    if users.is_current_user_admin():
        print '<a href="/admin/">Go to admin area</a>'
Lipis
  • 21,388
  • 20
  • 94
  • 121
  • The latest status is that this won't be fixed: https://code.google.com/p/googleappengine/issues/detail?id=4897 – Lipis Mar 04 '14 at 10:00
  • Thnks man... I am really hoping this to be implemented. It will be very much useful. – TMGooglePractice Mar 04 '14 at 11:22
  • Can you suggest any work around for this. This will be very much helpful if we can make the roles reflected in GAE application. – TMGooglePractice Mar 04 '14 at 11:26
  • @TMGooglePractice as you saw.. it won't be implemented so don't wait for it any time soon..! You will have to implement your own roles by having your own User model.. but this is something that really depends on what are you exact needs, language, etc.. – Lipis Mar 04 '14 at 11:50
0

If you want to use the Google Apps admin roles (super admin or delegated admin) instead of the App Engine permissions you should implement it yourself by synchronizing your own users entities in the datastore against the directory API part of the admin SDK of Google Apps, specifically with the fields isAdmin or isDelegatedAdmin.

David Cifuentes
  • 564
  • 5
  • 16