[google-appengine] Re: Access to admin urls in production gae app

2015-07-09 Thread Richard Cheesmar


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

 

>
> 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?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/3af88204-64ee-4d17-9b69-383268e39caf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[google-appengine] Re: Access to admin urls in production gae app

2015-07-09 Thread Nick (Cloud Platform Support)
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

On Thursday, July 9, 2015 at 12:07:17 PM UTC-4, Richard Cheesmar wrote:
>
>
>
> 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
>
>  
>
>>
>> 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?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/1df6b39c-0615-4f8f-b027-7126d35bb0ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.