简体   繁体   English

如何在生产Google App引擎上访问管理员URL

[英]How to get access to admin urls on production google app engine

I have uploaded a gae app for testing to production. 我上传了一个gae应用,用于测试生产。 I need to est the admin access. 我需要est管理员访问权限。 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. 错误:未经授权您的客户端没有访问所请求URL / admin / delete-search-indexes的权限。

Am I missing something simple or is it that Google have to make everything difficult to understand? 我是否想念一些简单的东西,还是Google必须让所有事情都难以理解?

Ok, this resolved by changing the app.yaml setting to 好的,这可以通过将app.yaml设置更改为

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

and keeping the decorator as is 并保持装饰器原样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM