Commit aa139d42 authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Updating the GroupRequiredMixin in views



I exchanged the `GroupRequiredMixin` by `IsProviderMixin` in every
relevant views.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent 71e16112
......@@ -60,7 +60,7 @@ from .forms import (
# Local imports
import config
from .helpers import get_base_url, get_ssh_data, upload_data, notify_controller
from .mixins import GroupRequiredMixin
from .mixins import IsProviderMixin
from .models import (
AllgoUser,
DockerOs,
......@@ -210,7 +210,7 @@ class WebappUpdate(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
return super(WebappUpdate, self).form_invalid(form)
class WebappCreate(SuccessMessageMixin, LoginRequiredMixin, GroupRequiredMixin, CreateView):
class WebappCreate(SuccessMessageMixin, LoginRequiredMixin, IsProviderMixin, CreateView):
"""Create a new webapp
Attributes:
......@@ -225,7 +225,7 @@ class WebappCreate(SuccessMessageMixin, LoginRequiredMixin, GroupRequiredMixin,
form_class = WebappForm
success_message = 'Webapp created successfully.'
template_name = 'webapp_add.html'
group_required = ['inria', ]
# group_required = ['inria', ]
def get_success_url(self):
"""If successful redirect to the webapp list page"""
......@@ -974,7 +974,7 @@ class RunnerList(LoginRequiredMixin, ListView):
return super().get_context_data(**kwargs)
class RunnerCreate(SuccessMessageMixin, LoginRequiredMixin, GroupRequiredMixin, CreateView):
class RunnerCreate(SuccessMessageMixin, LoginRequiredMixin, IsProviderMixin, CreateView):
"""Create a runner and save it into the database
Attributes:
......@@ -990,7 +990,6 @@ class RunnerCreate(SuccessMessageMixin, LoginRequiredMixin, GroupRequiredMixin,
error_message = 'You don\'t have sufficient privileges to create an open bar runner.'
success_url = reverse_lazy('main:runner_list')
template_name = 'runner_add_update.html'
group_required = ['inria', ]
def form_valid(self, form):
""" Validate some fields before saving them."""
......
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