1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Implements permission masks

This commit is contained in:
Yohann D'ANELLO
2020-03-19 16:12:52 +01:00
parent d083894e9b
commit 95315cdbe2
15 changed files with 133 additions and 78 deletions

View File

@ -50,6 +50,20 @@ class InstancedPermission:
return self.__repr__()
class PermissionMask(models.Model):
rank = models.PositiveSmallIntegerField(
verbose_name=_('rank'),
)
description = models.CharField(
max_length=255,
verbose_name=_('description'),
)
def __str__(self):
return self.description
class Permission(models.Model):
PERMISSION_TYPES = [
@ -85,6 +99,11 @@ class Permission(models.Model):
type = models.CharField(max_length=15, choices=PERMISSION_TYPES)
mask = models.ForeignKey(
PermissionMask,
on_delete=models.PROTECT,
)
field = models.CharField(max_length=255, blank=True)
description = models.CharField(max_length=255, blank=True)