0001-agent-provision-authentication-levels-along-with-rol.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 | ||
---|---|---|
129 | 129 | |
130 | 130 |
@classmethod |
131 | 131 |
def provision_role(cls, issuer, action, data, full=False): |
132 |
from mellon.models import AuthenticationLevel |
|
132 | 133 |
logger = logging.getLogger(__name__) |
133 | 134 |
uuids = set() |
134 | 135 |
for o in data: |
... | ... | |
153 | 154 |
# Can happen if uuid and name already exist |
154 | 155 |
logger.error(u'cannot provision role "%s" (%s)', o['name'], o['uuid']) |
155 | 156 |
continue |
157 |
AuthenticationLevel.objects.get_or_create( |
|
158 |
group=role, value=o['auth_level']) |
|
156 | 159 |
if not created: |
157 | 160 |
save = False |
158 | 161 |
if role.name != role_name: |
... | ... | |
167 | 170 |
if role.details != o.get('details', u''): |
168 | 171 |
role.details = o.get('details', u'') |
169 | 172 |
save = True |
173 |
if hasattr(role, 'auth_level'): |
|
174 |
if role.auth_level.value != o['auth_level']: |
|
175 |
role.auth_level.value = o['auth_level'] |
|
176 |
role.auth_level.save() |
|
177 |
else: |
|
178 |
AuthenticationLevel.objects.get_or_create( |
|
179 |
group=role, value=o['auth_level']) |
|
170 | 180 |
if save: |
171 | 181 |
try: |
172 | 182 |
with atomic(): |
173 |
- |