From 90c7daaa8ab0c6de7b1b5a6f9d737a93cf3dff06 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Thu, 28 Mar 2019 17:03:51 +0100 Subject: [PATCH] add auth levels --- mellon/migrations/0002_authenticationlevel.py | 24 +++++++++++++++++++ mellon/models.py | 8 +++++++ 2 files changed, 32 insertions(+) create mode 100644 mellon/migrations/0002_authenticationlevel.py diff --git a/mellon/migrations/0002_authenticationlevel.py b/mellon/migrations/0002_authenticationlevel.py new file mode 100644 index 0000000..08a1393 --- /dev/null +++ b/mellon/migrations/0002_authenticationlevel.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-03-28 16:52 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('mellon', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='AuthenticationLevel', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('value', models.PositiveSmallIntegerField(default=1)), + ('group', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='auth_level', to='auth.Group')), + ], + ), + ] diff --git a/mellon/models.py b/mellon/models.py index 9368a1d..20aba33 100644 --- a/mellon/models.py +++ b/mellon/models.py @@ -1,3 +1,4 @@ +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 @@ -20,3 +21,10 @@ class UserSAMLIdentifier(models.Model): 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)