Use permissions to authenticate bds buro members

I prefer using a permission (namely `bds.is_team`) to determine if a
user is member of the BDS staff rather that using a `is_buro` boolean
field.

We already use this approach is the kfet app
This commit is contained in:
Martin Pépin 2019-12-20 23:49:24 +01:00
parent d2ba9471da
commit 4d5419fdbc
No known key found for this signature in database
GPG key ID: E7520278B1774448
2 changed files with 23 additions and 1 deletions

View file

@ -0,0 +1,22 @@
# Generated by Django 2.2.8 on 2019-12-20 22:48
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("bds", "0002_bds_group"),
]
operations = [
migrations.AlterModelOptions(
name="bdsprofile",
options={
"permissions": (("is_team", "est membre du burô"),),
"verbose_name": "Profil BDS",
"verbose_name_plural": "Profils BDS",
},
),
migrations.RemoveField(model_name="bdsprofile", name="is_buro",),
]

View file

@ -63,7 +63,6 @@ class BDSProfile(models.Model):
)
mails_bds = models.BooleanField(_("recevoir les mails du BDS"), default=False)
is_buro = models.BooleanField(_("membre du Burô du BDS"), default=False)
has_certificate = models.BooleanField(_("certificat médical"), default=False)
certificate_file = models.FileField(
@ -90,6 +89,7 @@ class BDSProfile(models.Model):
class Meta:
verbose_name = _("Profil BDS")
verbose_name_plural = _("Profils BDS")
permissions = (("is_team", _("est membre du burô")),)
def __str__(self):
return self.user.username