0001-agent-provision-role-authentication-levels.patch
hobo/agent/authentic2/provisionning.py | ||
---|---|---|
203 | 203 |
'details': role.details, |
204 | 204 |
'emails': role.emails, |
205 | 205 |
'emails_to_members': role.emails_to_members, |
206 |
'auth_level': role.auth_level, |
|
206 | 207 |
} for role in roles |
207 | 208 |
] |
208 | 209 |
else: |
hobo/agent/common/management/commands/hobo_notify.py | ||
---|---|---|
148 | 148 |
role, created = Role.objects.get_or_create( |
149 | 149 |
name=role_name, defaults={ |
150 | 150 |
'uuid': o['uuid'], |
151 |
'description': o['description']}) |
|
151 |
'description': o['description'], |
|
152 |
'auth_level': o['auth_level']}) |
|
152 | 153 |
except IntegrityError: |
153 | 154 |
# Can happen if uuid and name already exist |
154 | 155 |
logger.error(u'cannot provision role "%s" (%s)', o['name'], o['uuid']) |
... | ... | |
167 | 168 |
if role.details != o.get('details', u''): |
168 | 169 |
role.details = o.get('details', u'') |
169 | 170 |
save = True |
171 |
if role.auth_level != o['auth_level']: |
|
172 |
role.auth_level = o['auth_level'] |
|
173 |
save = True |
|
170 | 174 |
if save: |
171 | 175 |
try: |
172 | 176 |
with atomic(): |
hobo/agent/common/migrations/0003_role_auth_level.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
# Generated by Django 1.11.18 on 2019-04-18 14:47 |
|
3 |
from __future__ import unicode_literals |
|
4 | ||
5 |
from django.db import migrations, models |
|
6 | ||
7 | ||
8 |
class Migration(migrations.Migration): |
|
9 | ||
10 |
dependencies = [ |
|
11 |
('common', '0002_auto_20160105_1702'), |
|
12 |
] |
|
13 | ||
14 |
operations = [ |
|
15 |
migrations.AddField( |
|
16 |
model_name='role', |
|
17 |
name='auth_level', |
|
18 |
field=models.PositiveSmallIntegerField(default=1), |
|
19 |
), |
|
20 |
] |
hobo/agent/common/models.py | ||
---|---|---|
6 | 6 |
uuid = models.CharField(max_length=32) |
7 | 7 |
description = models.TextField(default=u'') |
8 | 8 |
details = models.TextField(default=u'') |
9 |
auth_level = models.PositiveSmallIntegerField(default=1) |
|
9 |
- |