Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_superuser -> is_staff #88

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/config/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ class ConfigView(APIView):

def get(self, request, name=None):
if name is None:
if request.user.is_superuser:
if request.user.is_staff:
return FormattedResponse(config.get_all())
return FormattedResponse(config.get_all_non_sensitive())
if not config.is_sensitive(name) or request.is_superuser:
if not config.is_sensitive(name) or request.is_staff:
return FormattedResponse(config.get(name))
return FormattedResponse(status=HTTP_403_FORBIDDEN)

Expand Down
4 changes: 2 additions & 2 deletions src/polaris/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def allocate_instance(challenge_id, user):
'user': str(user.id),
'team': str(user.team.id)
})
if not user.is_superuser:
if not user.is_staff:
return censor_instance(response)
return response

Expand All @@ -102,7 +102,7 @@ def reallocate_instance(challenge_id, user):
'user': str(user.id),
'team': str(user.team.id)
})
if not user.is_superuser:
if not user.is_staff:
return censor_instance(response)
return response

Expand Down
1 change: 0 additions & 1 deletion src/scorerecalculator/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from backend.response import FormattedResponse
from challenge.models import Score
from config import config
from team.models import Team


Expand Down
4 changes: 2 additions & 2 deletions src/team/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class TeamViewSet(AdminListModelViewSet):

def get_queryset(self):
if self.action == "list":
if self.request.user.is_superuser:
if self.request.user.is_staff:
return Team.objects.order_by("id").prefetch_related("members")
return Team.objects.filter(is_visible=True).order_by("id").prefetch_related("members")
if self.request.user.is_superuser and not self.request.user.should_deny_admin():
if self.request.user.is_staff and not self.request.user.should_deny_admin():
return Team.objects.order_by("id").prefetch_related(
"solves",
"members",
Expand Down