mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-21 19:03:11 +00:00
Factorisation des décorateurs ACL dans les vues. Fix #121
This commit is contained in:
parent
f7d7a41586
commit
a61d8d6ebd
4 changed files with 10 additions and 27 deletions
|
@ -195,9 +195,7 @@ def revert_action(request, revision_id):
|
|||
|
||||
|
||||
@login_required
|
||||
@can_view_all(IpList)
|
||||
@can_view_all(Interface)
|
||||
@can_view_all(User)
|
||||
@can_view_all(IpList, Interface, User)
|
||||
def stats_general(request):
|
||||
"""Statistiques générales affinées sur les ip, activées, utilisées par
|
||||
range, et les statistiques générales sur les users : users actifs,
|
||||
|
@ -313,10 +311,7 @@ def stats_general(request):
|
|||
|
||||
|
||||
@login_required
|
||||
@can_view_app('users')
|
||||
@can_view_app('cotisations')
|
||||
@can_view_app('machines')
|
||||
@can_view_app('topologie')
|
||||
@can_view_app('users', 'cotisations', 'machines', 'topologie')
|
||||
def stats_models(request):
|
||||
"""Statistiques générales, affiche les comptages par models:
|
||||
nombre d'users, d'écoles, de droits, de bannissements,
|
||||
|
|
|
@ -1272,12 +1272,7 @@ def index_nas(request):
|
|||
|
||||
|
||||
@login_required
|
||||
@can_view_all(SOA)
|
||||
@can_view_all(Mx)
|
||||
@can_view_all(Ns)
|
||||
@can_view_all(Txt)
|
||||
@can_view_all(Srv)
|
||||
@can_view_all(Extension)
|
||||
@can_view_all(SOA, Mx, Ns, Txt, Srv, Extension)
|
||||
def index_extension(request):
|
||||
""" View displaying the list of existing extensions, the list of
|
||||
existing SOA records, the list of existing MX records , the list of
|
||||
|
|
|
@ -58,13 +58,8 @@ from . import forms
|
|||
|
||||
|
||||
@login_required
|
||||
@can_view_all(OptionalUser)
|
||||
@can_view_all(OptionalMachine)
|
||||
@can_view_all(OptionalTopologie)
|
||||
@can_view_all(GeneralOption)
|
||||
@can_view_all(AssoOption)
|
||||
@can_view_all(MailMessageOption)
|
||||
@can_view_all(HomeOption)
|
||||
@can_view_all(OptionalUser, OptionalMachine, OptionalTopologie, GeneralOption,
|
||||
AssoOption, MailMessageOption, HomeOption)
|
||||
def display_options(request):
|
||||
"""Vue pour affichage des options (en vrac) classé selon les models
|
||||
correspondants dans un tableau"""
|
||||
|
@ -149,7 +144,8 @@ def add_service(request):
|
|||
@can_edit(Service)
|
||||
def edit_service(request, service_instance, **_kwargs):
|
||||
"""Edition des services affichés sur la page d'accueil"""
|
||||
service = ServiceForm(request.POST or None, request.FILES or None,instance=service_instance)
|
||||
service = ServiceForm(
|
||||
request.POST or None, request.FILES or None, instance=service_instance)
|
||||
if service.is_valid():
|
||||
with transaction.atomic(), reversion.create_revision():
|
||||
service.save()
|
||||
|
|
|
@ -200,9 +200,7 @@ def index_ap(request):
|
|||
|
||||
|
||||
@login_required
|
||||
@can_view_all(Stack)
|
||||
@can_view_all(Building)
|
||||
@can_view_all(SwitchBay)
|
||||
@can_view_all(Stack, Building, SwitchBay)
|
||||
def index_physical_grouping(request):
|
||||
"""Affichage de la liste des stacks (affiche l'ensemble des switches)"""
|
||||
stack_list = (Stack.objects
|
||||
|
@ -241,8 +239,7 @@ def index_physical_grouping(request):
|
|||
|
||||
|
||||
@login_required
|
||||
@can_view_all(ModelSwitch)
|
||||
@can_view_all(ConstructorSwitch)
|
||||
@can_view_all(ModelSwitch, ConstructorSwitch)
|
||||
def index_model_switch(request):
|
||||
""" Affichage de l'ensemble des modèles de switches"""
|
||||
model_switch_list = ModelSwitch.objects.select_related('constructor')
|
||||
|
@ -957,7 +954,7 @@ edge[arrowhead=odot,arrowtail=dot]''']
|
|||
<FONT COLOR="#7B7B7B" >{}</FONT>
|
||||
</TD>
|
||||
<TD ALIGN="LEFT">
|
||||
<FONT COLOR="#7B7B7B" >{}</FONT>
|
||||
<FONT COLOR="#7B7B7B" >{}</FONT>
|
||||
</TD></TR>
|
||||
<TR><TD ALIGN="LEFT" BORDER="0">
|
||||
<FONT COLOR="#7B7B7B" >{}</FONT>
|
||||
|
|
Loading…
Reference in a new issue