summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValentin Deniaud <vdeniaud@entrouvert.com>2019-03-28 16:03:51 (GMT)
committerValentin Deniaud <vdeniaud@entrouvert.com>2019-03-28 16:52:46 (GMT)
commit90c7daaa8ab0c6de7b1b5a6f9d737a93cf3dff06 (patch)
tree7356accb4d9d2e3021507bd5527561db34ac1b62
parentb640f5b33438c444e76dda9433397e1b3c5587f7 (diff)
downloaddjango-mellon-90c7daaa8ab0c6de7b1b5a6f9d737a93cf3dff06.zip
django-mellon-90c7daaa8ab0c6de7b1b5a6f9d737a93cf3dff06.tar.gz
django-mellon-90c7daaa8ab0c6de7b1b5a6f9d737a93cf3dff06.tar.bz2
add auth levels
-rw-r--r--mellon/migrations/0002_authenticationlevel.py24
-rw-r--r--mellon/models.py8
2 files changed, 32 insertions, 0 deletions
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)