diff --git a/gestioncof/templates/gestioncof/home.html b/gestioncof/templates/gestioncof/home.html index 45b3e225..72d5613e 100644 --- a/gestioncof/templates/gestioncof/home.html +++ b/gestioncof/templates/gestioncof/home.html @@ -51,7 +51,7 @@ {# TODO: Since Django 1.9, we can store result with "as", allowing proper value management (if None) #}
  • Page d'accueil
  • Calendrier
  • - {% if perms.kfet.is_team %} + {% if perms.kfet.is_team and user.profile.is_cof %}
  • K-Psul
  • {% endif %} diff --git a/kfet/decorators.py b/kfet/decorators.py index 70848820..643fbe1b 100644 --- a/kfet/decorators.py +++ b/kfet/decorators.py @@ -2,7 +2,7 @@ from django.contrib.auth.decorators import user_passes_test def kfet_is_team(user): - return user.has_perm("kfet.is_team") + return user.has_perm("kfet.is_team") and user.profile.is_cof or user.username == 'kfet_genericteam' teamkfet_required = user_passes_test(kfet_is_team) diff --git a/kfet/models.py b/kfet/models.py index 7a0ec777..a20c0988 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -44,7 +44,12 @@ class AccountManager(models.Manager): if password is None: raise self.model.DoesNotExist - return self.get(password=hash_password(password)) + result = self.get(password=hash_password(password)) + if result.cofprofile.is_cof: + return result + else: + return None + class Account(models.Model): diff --git a/kfet/templates/kfet/base_nav.html b/kfet/templates/kfet/base_nav.html index 1cded20b..3b9fda0e 100644 --- a/kfet/templates/kfet/base_nav.html +++ b/kfet/templates/kfet/base_nav.html @@ -72,7 +72,7 @@ {% url "kfet.account.read" user.profile.account_kfet.trigramme as url_my_account %} {% include "kfet/nav_item.html" with href=url_my_account glyphicon="user" text="Mon compte" %} {% endif %} - {% if perms.kfet.is_team %} + {% if perms.kfet.is_team and user.profile.is_cof or user.username == 'kfet_genericteam'%} {% include "kfet/nav_item.html" with url="kfet.kpsul" glyphicon="shopping-cart" text="K-Psul" %} {% include "kfet/nav_item.html" with url="kfet.transfers" glyphicon="transfer" text="Transferts" %} {% include "kfet/nav_item.html" with url="kfet.history" glyphicon="th-list" text="Historique" %}