Commit cf7ba4d6 authored by Bonnegent Sebastien's avatar Bonnegent Sebastien
Browse files

Merge branch '48-permettre-la-vue-de-toutes-les-pao-a-tous-les-enseignants' into 'master'

Resolve "permettre la vue de toutes les PAO à tous les enseignants"

Closes #48

See merge request !28
parents 2fe557aa 4b5bb8d9
......@@ -13,4 +13,5 @@ db.sqlite3*
*~
*.autosave
*.swp
.DS_Store
scripts/
from django.core.management.base import BaseCommand
from django.conf import settings
from django.contrib.auth.models import Group
from django.contrib.auth.models import Permission
from projets.tools import ldaprequest
......@@ -15,6 +16,8 @@ class Command(BaseCommand):
self.stdout.write(
f">> création du groupe enseignant [{settings.GROUP_TEACHER}]"
)
grp_add_perm = Permission.objects.get(name="Can add pao")
grp.permissions.add(grp_add_perm)
grp.save()
for element in settings.LDAP_GROUPS_TEACHERS:
enseignants = ldaprequest.get_usernames(element)
......
......@@ -215,7 +215,7 @@ class CampagneDetail(MenuPAO, generic.DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user = self.request.user
if user.is_superuser is True:
if user.is_superuser is True or est_un_enseignant(user):
context["pao_list"] = self.object.pao_set.all()
else:
context["pao_list"] = self.object.get_pao_visibles(user)
......
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