0001-django_rbac-add-authentication-level-field-to-Role-m.patch
src/authentic2/a2_rbac/migrations/0020_role_auth_level.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
# Generated by Django 1.11.18 on 2019-04-10 10:02 |
|
3 |
from __future__ import unicode_literals |
|
4 | ||
5 |
import django.core.validators |
|
6 |
from django.db import migrations, models |
|
7 | ||
8 | ||
9 |
class Migration(migrations.Migration): |
|
10 | ||
11 |
dependencies = [ |
|
12 |
('a2_rbac', '0019_organizationalunit_show_username'), |
|
13 |
] |
|
14 | ||
15 |
operations = [ |
|
16 |
migrations.AddField( |
|
17 |
model_name='role', |
|
18 |
name='auth_level', |
|
19 |
field=models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)], verbose_name='required authentication level'), |
|
20 |
), |
|
21 |
] |
src/django_rbac/migrations/0006_role_auth_level.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
# Generated by Django 1.11.18 on 2019-04-10 10:02 |
|
3 |
from __future__ import unicode_literals |
|
4 | ||
5 |
import django.core.validators |
|
6 |
from django.db import migrations, models |
|
7 | ||
8 | ||
9 |
class Migration(migrations.Migration): |
|
10 | ||
11 |
dependencies = [ |
|
12 |
('django_rbac', '0005_auto_20171209_1106'), |
|
13 |
] |
|
14 | ||
15 |
operations = [ |
|
16 |
migrations.AddField( |
|
17 |
model_name='role', |
|
18 |
name='auth_level', |
|
19 |
field=models.PositiveSmallIntegerField(default=1, validators=[django.core.validators.MinValueValidator(1)], verbose_name='required authentication level'), |
|
20 |
), |
|
21 |
] |
src/django_rbac/models.py | ||
---|---|---|
17 | 17 |
from django.contrib.auth.models import Group, _user_get_all_permissions, \ |
18 | 18 |
_user_has_perm, _user_has_module_perms, Permission as AuthPermission |
19 | 19 |
from django.contrib import auth |
20 |
from django.core.validators import MinValueValidator |
|
20 | 21 | |
21 | 22 |
from . import utils, constants, managers, backends |
22 | 23 | |
... | ... | |
197 | 198 |
to=utils.get_permission_model_name(), |
198 | 199 |
related_name='roles', |
199 | 200 |
blank=True) |
201 |
auth_level = models.PositiveSmallIntegerField( |
|
202 |
verbose_name=_('required authentication level'), |
|
203 |
default=1, |
|
204 |
validators=[MinValueValidator(1),]) |
|
200 | 205 | |
201 | 206 |
objects = managers.RoleQuerySet.as_manager() |
202 | 207 | |
203 |
- |