summaryrefslogtreecommitdiffstats
path: root/mellon/models.py
blob: 20aba3313640a631ef40ec34f3e342944da9d51b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from django.contrib.auth.models import Group
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.conf import settings


class UserSAMLIdentifier(models.Model):
    user = models.ForeignKey(
        verbose_name=_('user'),
        to=settings.AUTH_USER_MODEL,
        related_name='saml_identifiers')
    issuer = models.TextField(
        verbose_name=_('Issuer'))
    name_id = models.TextField(
        verbose_name=_('SAML identifier'))
    created = models.DateTimeField(
        verbose_name=_('created'),
        auto_now_add=True)

    class Meta:
        verbose_name = _('user SAML identifier')
        verbose_name_plural = _('users SAML identifiers')
        unique_together = (('issuer', 'name_id'),)


class AuthenticationLevel(models.Model):
    group = models.OneToOneField(Group, related_name='auth_level')
    # ou plutot laisser blanc pour qu'il y ait une erreur si on
    # a pas recu les niveaux ?
    value = models.PositiveSmallIntegerField(default=1)