On définit STAFF_ENTRANCE_YEAR dans le modèle CASAccount
This commit is contained in:
parent
e6bc3d25dc
commit
cb3a1b232f
2 changed files with 5 additions and 2 deletions
|
@ -30,6 +30,9 @@ class CASAccount(models.Model):
|
||||||
verbose_name=_("année de création du compte CAS"), blank=False, null=False
|
verbose_name=_("année de création du compte CAS"), blank=False, null=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# The entrance year 0 is used for members of staff
|
||||||
|
STAFF_ENTRANCE_YEAR = 0
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = _("Compte CAS")
|
verbose_name = _("Compte CAS")
|
||||||
verbose_name_plural = _("Comptes CAS")
|
verbose_name_plural = _("Comptes CAS")
|
||||||
|
|
|
@ -6,6 +6,7 @@ from cas import CASClient
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from authens import conf as default_conf
|
from authens import conf as default_conf
|
||||||
|
from authens.models import CASAccount
|
||||||
|
|
||||||
|
|
||||||
def get_cas_client(request):
|
def get_cas_client(request):
|
||||||
|
@ -35,9 +36,8 @@ def parse_entrance_year(home_dir):
|
||||||
settings, "AUTHENS_ALLOW_STAFF", default_conf.AUTHENS_ALLOW_STAFF
|
settings, "AUTHENS_ALLOW_STAFF", default_conf.AUTHENS_ALLOW_STAFF
|
||||||
)
|
)
|
||||||
|
|
||||||
# The staff members have an entrance year set to 0
|
|
||||||
if allow_staff and dirs[:3] == ["", "users", "staffs"]:
|
if allow_staff and dirs[:3] == ["", "users", "staffs"]:
|
||||||
return 0
|
return CASAccount.STAFF_ENTRANCE_YEAR
|
||||||
|
|
||||||
if len(dirs) < 3 or not dirs[2].isdecimal() or dirs[1] != "users":
|
if len(dirs) < 3 or not dirs[2].isdecimal() or dirs[1] != "users":
|
||||||
raise ValueError("Invalid home directory: {}".format(home_dir))
|
raise ValueError("Invalid home directory: {}".format(home_dir))
|
||||||
|
|
Loading…
Add table
Reference in a new issue