开发者

How to check if a user is admin of their Google Apps domain in App Engine?

I followed this tutorial to enable single sign on for an app that installs through the G开发者_开发知识库oogle Apps Marketplace. Now, what is the best way to check if the user is admin of the Google Apps domain?

Edit: I'm asking this because we can define links for "setup" and "manage" in the manifest. I don't think those pages in my app should be accessible by all users of the Google Apps domain, only by the admin ones. And then I thought I'd just need to limit access to those pages based on who is admin of the domain.


You can take your admin user to your app via the optional step3 of the install process from the marketplace where you could manually request which user(s) they want to dedicate admin rights to within your app.


You probably could use the Provisioning API to do retrieve a user account. In the response you would then be able to tell whether a user is admin or not:

 <apps:login userName="JoeBloggs" suspended="false" admin="false"
    changePasswordAtNextLogin="false" agreedToTerms="true"/>

[edit] I see you can use the gdata-python-client library to call a RetrieveUser function to make things even easier.


Have you tried users.is_current_user_admin()?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜