Projet

Général

Profil

0001-models-add-authentication-level-attribute-to-Group.patch

Valentin Deniaud, 16 avril 2019 14:07

Télécharger (2,15 ko)

Voir les différences:

Subject: [PATCH 1/2] models: add authentication level attribute to Group

 mellon/migrations/0002_authenticationlevel.py | 24 +++++++++++++++++++
 mellon/models.py                              |  6 +++++
 2 files changed, 30 insertions(+)
 create mode 100644 mellon/migrations/0002_authenticationlevel.py
mellon/migrations/0002_authenticationlevel.py
1
# -*- coding: utf-8 -*-
2
# Generated by Django 1.11.18 on 2019-04-16 08:45
3
from __future__ import unicode_literals
4

  
5
from django.db import migrations, models
6
import django.db.models.deletion
7

  
8

  
9
class Migration(migrations.Migration):
10

  
11
    dependencies = [
12
        ('mellon', '0001_initial'),
13
    ]
14

  
15
    operations = [
16
        migrations.CreateModel(
17
            name='AuthenticationLevel',
18
            fields=[
19
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
20
                ('value', models.PositiveSmallIntegerField(default=1)),
21
                ('group', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='auth_level', to='auth.Group')),
22
            ],
23
        ),
24
    ]
mellon/models.py
1
from django.contrib.auth.models import Group
1 2
from django.db import models
2 3
from django.utils.translation import ugettext_lazy as _
3 4
from django.conf import settings
......
20 21
        verbose_name = _('user SAML identifier')
21 22
        verbose_name_plural = _('users SAML identifiers')
22 23
        unique_together = (('issuer', 'name_id'),)
24

  
25

  
26
class AuthenticationLevel(models.Model):
27
    group = models.OneToOneField(Group, related_name='auth_level')
28
    value = models.PositiveSmallIntegerField(default=1)
23
-