Skip to content

Commit

Permalink
Fixes bug 943301 - Created permission to run long queries in search a…
Browse files Browse the repository at this point in the history
…nd report/list pages.
  • Loading branch information
adngdb committed Dec 18, 2013
1 parent 13ae068 commit 794b121
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions webapp-django/crashstats/crashstats/management/__init__.py
Expand Up @@ -16,6 +16,7 @@
'view_rawdump': 'View Raw Dumps',
'view_exploitability': 'View Exploitability Results',
'view_flash_exploitability': 'View Flash Exploitability Results',
'run_long_queries': 'Run Long Queries',
}


Expand Down
4 changes: 2 additions & 2 deletions webapp-django/crashstats/crashstats/tests/test_views.py
Expand Up @@ -1834,8 +1834,8 @@ def mocked_get(url, **options):

# Test an out-of-range date range for a logged in user
user = self._login()
user.is_superuser = True
user.save()
group = self._create_group_with_permission('run_long_queries')
user.groups.add(group)

response = self.client.get(url, {
'query': 'js::',
Expand Down
4 changes: 2 additions & 2 deletions webapp-django/crashstats/crashstats/views.py
Expand Up @@ -1099,7 +1099,7 @@ def report_list(request, partial=None, default_context=None):
range_unit
)

if request.user.is_superuser:
if request.user.has_perm('crashstats.run_long_queries'):
# The user is an admin and is allowed to perform bigger queries
max_query_range = settings.QUERY_RANGE_MAXIMUM_DAYS_ADMIN
else:
Expand Down Expand Up @@ -1671,7 +1671,7 @@ def query(request, default_context=None):
params['date_range_unit']
)

if request.user.is_superuser:
if request.user.has_perm('crashstats.run_long_queries'):
# The user is an admin and is allowed to perform bigger queries
max_query_range = settings.QUERY_RANGE_MAXIMUM_DAYS_ADMIN
error_type = 'exceeded_maximum_date_range_admin'
Expand Down

0 comments on commit 794b121

Please sign in to comment.