In GAE, is there a way to find out if a User is an administrator?
While the is_current_user_admin() reveals whether the current user is an administrator, I’d like to know if there’s a way to discover if a given User object is for an administrator or not (e.g. a hypothetical User.is_admin() function).
Thank you for reading.
Brian
Unfortunately, the User model does not contain any information about whether the user is an administrator or not.
If your list of administrators changes infrequently, then you could write your own
is_admin()function which checks to see if theUser.user_id()value corresponds to one of your administrators’ accounts. For example: