From: Ant Zucaro Date: Mon, 16 Jun 2014 01:42:43 +0000 (-0400) Subject: Add basic merge view with admin group membership required. X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9bddc594cb6869e65089d9bad92240c23d28c621;p=xonotic%2Fxonstat.git Add basic merge view with admin group membership required. --- diff --git a/xonstat/__init__.py b/xonstat/__init__.py index 2955504..d2ace0a 100644 --- a/xonstat/__init__.py +++ b/xonstat/__init__.py @@ -173,7 +173,7 @@ def main(global_config, **settings): config.add_route("login", "/login") config.add_view(login, route_name="login", check_csrf=True, renderer="json") - #config.add_route("merge", "/merge") - #config.add_view(merge, route_name="merge", renderer="merge.mako") + config.add_route("merge", "/admin/merge") + config.add_view(merge, route_name="merge", renderer="merge.mako", permission="merge") return config.make_wsgi_app() diff --git a/xonstat/security.py b/xonstat/security.py index 47828a4..a92804c 100644 --- a/xonstat/security.py +++ b/xonstat/security.py @@ -16,8 +16,9 @@ GROUPS = { # default ACL class ACLFactory(object): __acl__ = [ + # permission, principal, permission (Allow, Everyone, 'view'), - (Allow, 'group:admins', 'merge') + (Allow, 'admin', 'merge') ] def __init__(self, request): pass diff --git a/xonstat/views/admin.py b/xonstat/views/admin.py index b8f6486..a1516bc 100644 --- a/xonstat/views/admin.py +++ b/xonstat/views/admin.py @@ -18,8 +18,8 @@ def login(request): player_email = DBSession.query(Player).\ filter(Player.email_addr == persona_email).one() - #log.debug("Verified email address: %s" % persona_email) - #log.debug("Corresponding player is %s" % player_email) + log.debug("Verified email address: %s" % persona_email) + log.debug("Corresponding player is %s" % player_email) if player_email is not None: # Add the headers required to remember the user to the response @@ -30,3 +30,7 @@ def login(request): # Return a json message containing the address or path to redirect to. return {'redirect': request.POST['came_from'], 'success': True} + +def merge(request): + '''A simple merge view. The merge.mako template does the work.''' + return {}