Skip to content

Commit

Permalink
Merge pull request #304 from mkurek/fix/superuser-services
Browse files Browse the repository at this point in the history
fixed service filter (by permissions)
  • Loading branch information
kula1922 committed Oct 15, 2014
2 parents 3689153 + 52b53e8 commit 02deff2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ralph_scrooge/rest/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from django.views.decorators.http import require_http_methods

from ralph.util.views import jsonify
from ralph.account.models import Perm

from ralph_scrooge.models import (
ServiceEnvironment,
Team,
Expand All @@ -26,11 +28,16 @@ def left_menu(request, *args, **kwargs):
service_environments = ServiceEnvironment.objects.select_related(
"service",
"environment",
).filter(
service__serviceownership__owner__profile__user=request.user,
).order_by(
"service__name",
)
if not (
request.user.is_superuser or
request.user.profile.has_perm(Perm.has_scrooge_access)
):
service_environments = service_environments.filter(
service__serviceownership__owner__profile__user=request.user,
)

results = {}

Expand Down

0 comments on commit 02deff2

Please sign in to comment.