Skip to content

Commit

Permalink
Add modify_stats approval group
Browse files Browse the repository at this point in the history
  • Loading branch information
glinscott committed Feb 28, 2015
1 parent 6a38b69 commit 0a79ba8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 2 additions & 1 deletion fishtest/fishtest/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
class RootFactory(object):
__acl__ = [ (Allow, Everyone, 'view'),
(Allow, 'group:admins', 'modify_db'),
(Allow, 'group:approvers', 'approve_run'), ]
(Allow, 'group:approvers', 'approve_run'),
(Allow, 'group:stats', 'modify_stats'), ]
def __init__(self, request):
pass

12 changes: 3 additions & 9 deletions fishtest/fishtest/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def regression_request_isvalid(request):
(request.GET["type"] == "fishtest" or \
request.GET["type"] == "jl")

@view_config(route_name='regression_data', renderer='regression_data.mak')
@view_config(route_name='regression_data', renderer='regression_data.mak', permission='modify_stats')
def regression_data(request):
if not regression_request_isvalid(request):
return HTTPBadRequest()
Expand All @@ -180,12 +180,7 @@ def regression_data_json(request):
'jl_regression_data': request.regressiondb.get("jl", True)
})

#
# Does everyone have save privilage? Perhaps it makes sense to create
# a new group and give that group ability to save regression data
#

@view_config(route_name='regression_data_save', request_method='POST')
@view_config(route_name='regression_data_save', request_method='POST', permission='modify_stats')
def regression_data_save(request):
if not regression_request_isvalid(request):
return HTTPBadRequest()
Expand All @@ -198,15 +193,14 @@ def regression_data_save(request):

return HTTPFound(location="/regression/data?type=" + request.GET["type"])

@view_config(route_name='regression_data_delete', request_method='POST', permission='modify_db')
@view_config(route_name='regression_data_delete', request_method='POST', permission='modify_stats')
def regression_data_delete(request):
if not regression_request_isvalid(request) or "_id" not in request.POST:
return HTTPBadRequest()

request.regressiondb.delete(request.POST["_id"])
return HTTPFound(location="/regression/data?type=" + request.GET["type"])


def get_sha(branch, repo_url):
"""Resolves the git branch to sha commit"""
api_url = repo_url.replace('https://github.com', 'https://api.github.com/repos')
Expand Down

0 comments on commit 0a79ba8

Please sign in to comment.