Access to admin urls in production gae app

51 views
Skip to first unread message

Richard Cheesmar

unread,
Jul 9, 2015, 11:56:04 AM7/9/15
to google-a...@googlegroups.com, ch...@chezandred.com


I have uploaded a gae app for testing to production. I need to est the admin access. I have added two email addresses via permissions and set them as owners.

I have a decorator which is called to check admin user and this is called properly on the local development machine.



def admin_required(handler):
 
"""
 Decorator for checking if there's an admin user
 Assigned Google App admin only NOT users with admin permissions
 """


 
def check_admin(self, *args, **kwargs):
 
"""
 Admin decorator
 """

 logging
.info(users.is_current_user_admin())
 
if not users.is_current_user_admin():
 
self.redirect_to('home')
 
else:
 
return handler(self, *args, **kwargs)

 
return check_admin

I login to my app using one of the emails in permissions and then try to access an admin page and get the following:

Error: Unauthorized Your client does not have permission to the requested URL /admin/delete-search-indexes.



Am I missing something simple or is it that Google have to make everything difficult to understand?

Richard Cheesmar

unread,
Jul 9, 2015, 12:07:17 PM7/9/15
to google-a...@googlegroups.com, ch...@chezandred.com


On Thursday, July 9, 2015 at 6:56:04 PM UTC+3, Richard Cheesmar wrote:


I have uploaded a gae app for testing to production. I need to est the admin access. I have added two email addresses via permissions and set them as owners.

I have a decorator which is called to check admin user and this is called properly on the local development machine.



def admin_required(handler):
 
"""
 Decorator for checking if there's an admin user
 Assigned Google App admin only NOT users with admin permissions
 """


 
def check_admin(self, *args, **kwargs):
 
"""
 Admin decorator
 """

 logging
.info(users.is_current_user_admin())
 
if not users.is_current_user_admin():
 
self.redirect_to('home')
 
else:
 
return handler(self, *args, **kwargs)

 
return check_admin

I have this in app.yaml

- url: /admin.*
script: main.app
login: admin
auth_fail_action: unauthorized
 

Nick (Cloud Platform Support)

unread,
Jul 9, 2015, 7:51:17 PM7/9/15
to google-a...@googlegroups.com, cheza...@gmail.com, ch...@chezandred.com
Hey Richard,

It appears as though you're returning the check_admin function itself rather than the result of calling the function, like check_admin(). Is that intentional? It's hard to tell what you're intending since the rest of your code which would give context is missing.

At any rate, this forum isn't meant for 1-on-1 technical support, but is rather for general discussion of the platform, so I think you should proceed to post this question, with a little more explanation, on stackoverflow

Have a great day,

Nick
Reply all
Reply to author
Forward
0 new messages