diff --git a/production/templates/production/partials/production_stream_card.html b/production/templates/production/partials/production_stream_card.html index f174556e17489cfe5fd895d2cccf1c408915838d..de93543f84f3433c4d6df6982a44c3d4e1734bc2 100644 --- a/production/templates/production/partials/production_stream_card.html +++ b/production/templates/production/partials/production_stream_card.html @@ -9,7 +9,7 @@ <h3>Events</h3> {% include 'production/partials/production_events.html' with events=stream.events.all %} - {% if "can_work_for_stream" in sub_perms %} + {% if "can_perform_supervisory_actions" in sub_perms %} {% if perms.scipost.can_publish_accepted_submission or perms.scipost.can_assign_production_supervisor and perms.scipost.can_assign_production_officer %} <h3>Actions</h3> <ul> @@ -59,7 +59,7 @@ <li>Production Officer: {% if stream.officer %} <strong>{{ stream.officer }}</strong> - {% if perms.scipost.can_assign_production_officer and "can_work_for_stream" in sub_perms %} + {% if perms.scipost.can_assign_production_officer and "can_perform_supervisory_actions" in sub_perms %} · <a href="{% url 'production:remove_officer' stream_id=stream.id officer_id=stream.officer.id %}" class="text-danger">Remove from stream</a> {% endif %} {% else %} diff --git a/production/views.py b/production/views.py index 32d47a41ad90d0135b0b058735771b187d962856..9c86ca0c9f0473030373e175da29151e893829a6 100644 --- a/production/views.py +++ b/production/views.py @@ -112,7 +112,7 @@ def add_event(request, stream_id): def add_officer(request, stream_id): stream = get_object_or_404(ProductionStream.objects.ongoing(), pk=stream_id) checker = ObjectPermissionChecker(request.user) - if not checker.has_perm('can_work_for_stream', stream) or not request.user.has_perm('scipost.can_assign_production_officer'): + if not checker.has_perm('can_perform_supervisory_actions', stream): return redirect(reverse('production:production')) form = AssignOfficerForm(request.POST or None, instance=stream) @@ -133,7 +133,7 @@ def add_officer(request, stream_id): def remove_officer(request, stream_id, officer_id): stream = get_object_or_404(ProductionStream.objects.ongoing(), pk=stream_id) checker = ObjectPermissionChecker(request.user) - if not checker.has_perm('can_work_for_stream', stream) or not request.user.has_perm('scipost.can_assign_production_officer'): + if not checker.has_perm('can_perform_supervisory_actions', stream): return redirect(reverse('production:production')) if getattr(stream.officer, 'id', 0) == int(officer_id): @@ -155,10 +155,10 @@ def add_supervisor(request, stream_id): form.save() supervisor = form.cleaned_data.get('supervisor') assign_perm('can_work_for_stream', supervisor.user, stream) + assign_perm('can_perform_supervisory_actions', supervisor.user, stream) messages.success(request, 'Supervisor {supervisor} has been assigned.'.format( supervisor=supervisor)) notify_new_stream_assignment(request.user, stream, supervisor.user) - # assign_perm('can_perform_supervisory_actions', supervisor.user, stream) else: for key, error in form.errors.items(): messages.warning(request, error[0])