Commit 48fd9c2f authored by fred's avatar fred

fix permission check

parent 48281229
...@@ -69,7 +69,7 @@ class TrackDetailView(DetailView): ...@@ -69,7 +69,7 @@ class TrackDetailView(DetailView):
return ctx return ctx
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks') assert self.request.user.has_perm('nonstop.add_track')
instance = self.get_object() instance = self.get_object()
old_nonstop_zones = copy.copy(instance.nonstop_zones.all()) old_nonstop_zones = copy.copy(instance.nonstop_zones.all())
form = TrackMetaForm(request.POST, instance=instance) form = TrackMetaForm(request.POST, instance=instance)
...@@ -172,7 +172,7 @@ class UploadTracksView(FormView): ...@@ -172,7 +172,7 @@ class UploadTracksView(FormView):
success_url = '.' success_url = '.'
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks') assert self.request.user.has_perm('nonstop.add_track')
form_class = self.get_form_class() form_class = self.get_form_class()
form = self.get_form(form_class) form = self.get_form(form_class)
tracks = request.FILES.getlist('tracks') tracks = request.FILES.getlist('tracks')
...@@ -230,7 +230,7 @@ class RecentTracksView(ListView): ...@@ -230,7 +230,7 @@ class RecentTracksView(ListView):
return Track.objects.exclude(creation_timestamp__isnull=True).order_by('-creation_timestamp')[:50] return Track.objects.exclude(creation_timestamp__isnull=True).order_by('-creation_timestamp')[:50]
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks') assert self.request.user.has_perm('nonstop.add_track')
for track_id in request.POST.getlist('track'): for track_id in request.POST.getlist('track'):
track = Track.objects.get(id=track_id) track = Track.objects.get(id=track_id)
track.language = request.POST.get('lang-%s' % track_id, '') track.language = request.POST.get('lang-%s' % track_id, '')
...@@ -305,7 +305,7 @@ class CleanupView(TemplateView): ...@@ -305,7 +305,7 @@ class CleanupView(TemplateView):
return ctx return ctx
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
assert self.request.user.has_perm('nonstop.add_tracks') assert self.request.user.has_perm('nonstop.add_track')
count = 0 count = 0
for track_id in request.POST.getlist('track'): for track_id in request.POST.getlist('track'):
if request.POST.get('remove-%s' % track_id): if request.POST.get('remove-%s' % track_id):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment