Add a line to describe superusers, remove useless roles in rights table

This commit is contained in:
Yohann D'ANELLO 2020-08-31 21:49:02 +02:00
parent 08c8792aed
commit ee26850e34
5 changed files with 41 additions and 29 deletions

View File

@ -2432,9 +2432,9 @@
"activity" "activity"
], ],
"query": "[\"AND\", {\"valid\": false}, {\"creater\": [\"user\"]}]", "query": "[\"AND\", {\"valid\": false}, {\"creater\": [\"user\"]}]",
"type": "organizer", "type": "change",
"mask": 1, "mask": 1,
"field": "name", "field": "organizer",
"permanent": false, "permanent": false,
"description": "Modifier l'organisateur d'une activité non validée dont on est l'auteur" "description": "Modifier l'organisateur d'une activité non validée dont on est l'auteur"
} }
@ -2950,8 +2950,6 @@
55, 55,
57, 57,
52, 52,
53,
54,
23, 23,
24, 24,
25, 25,

View File

@ -3,11 +3,10 @@
import django_tables2 as tables import django_tables2 as tables
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db.models import Q
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from django_tables2 import A from django_tables2 import A
from member.models import Membership from member.models import Membership
from note_kfet.middlewares import get_current_authenticated_user from note_kfet.middlewares import get_current_authenticated_user
from permission.backends import PermissionBackend from permission.backends import PermissionBackend
@ -37,7 +36,11 @@ class RightsTable(tables.Table):
def render_roles(self, record): def render_roles(self, record):
# If the user has the right to manage the roles, display the link to manage them # If the user has the right to manage the roles, display the link to manage them
roles = record.roles.all() roles = record.roles.filter((~(Q(name="Adhérent BDE")
| Q(name="Adhérent Kfet")
| Q(name="Membre de club")
| Q(name="Bureau de club"))
& Q(weirole__isnull=True))).all()
s = ", ".join(str(role) for role in roles) s = ", ".join(str(role) for role in roles)
if PermissionBackend.check_perm(get_current_authenticated_user(), "member.change_membership_roles", record): if PermissionBackend.check_perm(get_current_authenticated_user(), "member.change_membership_roles", record):
s = format_html("<a href='" + str(reverse_lazy("member:club_manage_roles", kwargs={"pk": record.pk})) s = format_html("<a href='" + str(reverse_lazy("member:club_manage_roles", kwargs={"pk": record.pk}))

View File

@ -13,6 +13,9 @@
{% trans "Users that have surnormal rights" %} {% trans "Users that have surnormal rights" %}
</h3> </h3>
<div class="card-body"> <div class="card-body">
<div class="alert alert-info">
<i class="fas fa-info-circle"></i> {% trans "Superusers have all rights on everything, to manage the website." %}
</div>
<div class="card"> <div class="card">
<div class="card-head"> <div class="card-head">
<h4 class="card-header text-center"> <h4 class="card-header text-center">

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-31 21:07+0200\n" "POT-Creation-Date: 2020-08-31 21:45+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -885,7 +885,7 @@ msgid "Add"
msgstr "" msgstr ""
#: apps/member/templates/member/club_detail.html:13 #: apps/member/templates/member/club_detail.html:13
#: apps/permission/templates/permission/all_rights.html:30 #: apps/permission/templates/permission/all_rights.html:33
msgid "Club managers" msgid "Club managers"
msgstr "" msgstr ""
@ -1567,7 +1567,7 @@ msgid ""
msgstr "" msgstr ""
#: apps/permission/models.py:183 #: apps/permission/models.py:183
#: apps/permission/templates/permission/all_rights.html:87 #: apps/permission/templates/permission/all_rights.html:90
msgid "permanent" msgid "permanent"
msgstr "" msgstr ""
@ -1616,35 +1616,39 @@ msgstr ""
msgid "Users that have surnormal rights" msgid "Users that have surnormal rights"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:19 #: apps/permission/templates/permission/all_rights.html:17
msgid "Superusers have all rights on everything, to manage the website."
msgstr ""
#: apps/permission/templates/permission/all_rights.html:22
msgid "Superusers" msgid "Superusers"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:43 #: apps/permission/templates/permission/all_rights.html:46
msgid "Roles description" msgid "Roles description"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:50 #: apps/permission/templates/permission/all_rights.html:53
msgid "Filter with roles that I have in at least one club" msgid "Filter with roles that I have in at least one club"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:67 #: apps/permission/templates/permission/all_rights.html:70
msgid "Owned" msgid "Owned"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:78 #: apps/permission/templates/permission/all_rights.html:81
msgid "Own this role in the clubs" msgid "Own this role in the clubs"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:84 #: apps/permission/templates/permission/all_rights.html:87
msgid "Mask:" msgid "Mask:"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:84 #: apps/permission/templates/permission/all_rights.html:87
msgid "Query:" msgid "Query:"
msgstr "" msgstr ""
#: apps/permission/templates/permission/all_rights.html:90 #: apps/permission/templates/permission/all_rights.html:93
msgid "No associated permission" msgid "No associated permission"
msgstr "" msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-08-31 21:07+0200\n" "POT-Creation-Date: 2020-08-31 21:45+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -910,7 +910,7 @@ msgid "Add"
msgstr "Ajouter" msgstr "Ajouter"
#: apps/member/templates/member/club_detail.html:13 #: apps/member/templates/member/club_detail.html:13
#: apps/permission/templates/permission/all_rights.html:30 #: apps/permission/templates/permission/all_rights.html:33
msgid "Club managers" msgid "Club managers"
msgstr "Bureau du club" msgstr "Bureau du club"
@ -1612,7 +1612,7 @@ msgstr ""
"l'utilisateur est expirée." "l'utilisateur est expirée."
#: apps/permission/models.py:183 #: apps/permission/models.py:183
#: apps/permission/templates/permission/all_rights.html:87 #: apps/permission/templates/permission/all_rights.html:90
msgid "permanent" msgid "permanent"
msgstr "permanent" msgstr "permanent"
@ -1669,35 +1669,39 @@ msgstr ""
msgid "Users that have surnormal rights" msgid "Users that have surnormal rights"
msgstr "Liste des utilisateurs ayant des droits surnormaux" msgstr "Liste des utilisateurs ayant des droits surnormaux"
#: apps/permission/templates/permission/all_rights.html:19 #: apps/permission/templates/permission/all_rights.html:17
msgid "Superusers have all rights on everything, to manage the website."
msgstr "Les super-utilisateurs ont tous les droits sur tout, afin de gérer le site."
#: apps/permission/templates/permission/all_rights.html:22
msgid "Superusers" msgid "Superusers"
msgstr "Super-utilisateurs" msgstr "Super-utilisateurs"
#: apps/permission/templates/permission/all_rights.html:43 #: apps/permission/templates/permission/all_rights.html:46
msgid "Roles description" msgid "Roles description"
msgstr "Description de tous les rôles" msgstr "Description de tous les rôles"
#: apps/permission/templates/permission/all_rights.html:50 #: apps/permission/templates/permission/all_rights.html:53
msgid "Filter with roles that I have in at least one club" msgid "Filter with roles that I have in at least one club"
msgstr "Filtrer les rôles que je possède dans au moins un club" msgstr "Filtrer les rôles que je possède dans au moins un club"
#: apps/permission/templates/permission/all_rights.html:67 #: apps/permission/templates/permission/all_rights.html:70
msgid "Owned" msgid "Owned"
msgstr "Possédé" msgstr "Possédé"
#: apps/permission/templates/permission/all_rights.html:78 #: apps/permission/templates/permission/all_rights.html:81
msgid "Own this role in the clubs" msgid "Own this role in the clubs"
msgstr "Possède ce rôle dans les clubs" msgstr "Possède ce rôle dans les clubs"
#: apps/permission/templates/permission/all_rights.html:84 #: apps/permission/templates/permission/all_rights.html:87
msgid "Mask:" msgid "Mask:"
msgstr "Masque :" msgstr "Masque :"
#: apps/permission/templates/permission/all_rights.html:84 #: apps/permission/templates/permission/all_rights.html:87
msgid "Query:" msgid "Query:"
msgstr "Requête :" msgstr "Requête :"
#: apps/permission/templates/permission/all_rights.html:90 #: apps/permission/templates/permission/all_rights.html:93
msgid "No associated permission" msgid "No associated permission"
msgstr "Pas de permission associée" msgstr "Pas de permission associée"