jumpserver/apps/ops/views.py

36 lines
1.0 KiB
Python
Raw Normal View History

2016-11-16 06:20:44 +00:00
# ~*~ coding: utf-8 ~*~
from __future__ import unicode_literals
2016-08-08 16:43:11 +00:00
2016-11-16 06:20:44 +00:00
from django.conf import settings
from django.views.generic.list import ListView, MultipleObjectMixin
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from django.views.generic.detail import DetailView, SingleObjectMixin
from .hands import AdminUserRequiredMixin
2016-11-20 06:48:18 +00:00
from .utils import CreateSudoPrivilegesMixin, ListSudoPrivilegesMixin
from models import *
2016-11-16 06:20:44 +00:00
2016-11-20 06:48:18 +00:00
class SudoListView(AdminUserRequiredMixin, ListSudoPrivilegesMixin, ListView):
2016-11-16 06:20:44 +00:00
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
2016-11-20 06:48:18 +00:00
model = Sudo
context_object_name = 'sudos'
template_name = 'sudo/list.html'
2016-11-16 06:20:44 +00:00
2016-11-20 06:48:18 +00:00
class SudoCreateView(AdminUserRequiredMixin, CreateSudoPrivilegesMixin, CreateView):
model = Sudo
template_name = 'sudo/create.html'
2016-11-16 06:20:44 +00:00
2016-11-16 07:00:46 +00:00
class SudoUpdateView(AdminUserRequiredMixin, UpdateView):
2016-11-20 06:48:18 +00:00
model = Sudo
template_name = 'sudo/update.html'
2016-11-16 06:20:44 +00:00
class SudoDetailView(DetailView):
2016-11-20 06:48:18 +00:00
model = Sudo
context_object_name = 'sudo'
template_name = 'sudo/detail.html'
2016-11-16 06:20:44 +00:00