add vlidity and service category fields for authz rule model

This commit is contained in:
Paul Marillonnet 2019-05-03 10:47:14 +02:00
parent da78303891
commit 357be4844e
1 changed files with 19 additions and 0 deletions

View File

@ -29,16 +29,35 @@ from .utils import ServiceAccessDenied
class AuthorizationRule(models.Model):
"""
todo: multiple choices charfield as radio buttons
"""
SCOPE_READ = 1
SCOPE_WRITE = 2
AUTHZ_SCOPES_CHOICES = (
(SCOPE_READ, "Read"),
(SCOPE_WRITE, "Write"),
)
SERVICE_URM = 1
SERVICE_SPORTS = 2
SERVICE_CULTURE = 3
SERVICE_CATEGORY_CHOICES = (
(SERVICE_URM, _("URM Services")),
(SERVICE_SPORTS, _("Sports services")),
(SERVICE_CULTURE, _("Cultural service")),
)
scopes = models.CharField(
verbose_name=_('scopes'),
choices=AUTHZ_SCOPES_CHOICES,
max_length=63)
validity = models.DateTimeField(
auto_now=True)
service_categories = models.CharField(
verbose_name=_('Service category'),
help_text=_('Category of services for which the authorization rule applies'),
choices = SERVICE_CATEGORY_CHOICES,
default = SERVICE_URM,
max_length=63)
class DeletedUser(models.Model):