0001-agent-common-prepare-for-user-provisionning-8440.patch
hobo/agent/common/management/commands/hobo_notify.py | ||
---|---|---|
59 | 59 |
and 'description' in o |
60 | 60 | |
61 | 61 |
@classmethod |
62 |
def process_notification(cls, tenant, notification): |
|
63 |
assert cls.check_valid_notification(notification), \ |
|
64 |
'invalid notification' |
|
65 |
service = tenant.get_service() |
|
66 |
action = notification['@type'] |
|
67 |
audience = notification['audience'] |
|
68 |
full = notification['full'] if 'full' in notification else False |
|
69 |
entity_id = service.get('saml-sp-metadata-url') |
|
70 |
assert entity_id, 'service has no saml-sp-metadat-url field' |
|
71 |
if entity_id not in audience: |
|
72 |
return |
|
62 |
def provision_role(cls, action, data, full=False): |
|
73 | 63 |
uuids = set() |
74 |
for o in notification['objects']:
|
|
64 |
for o in data:
|
|
75 | 65 |
assert cls.check_valid_role(o) |
76 | 66 |
uuids.add(o['uuid']) |
77 | 67 |
if action == 'provision': |
... | ... | |
95 | 85 |
elif action == 'deprovision': |
96 | 86 |
for role in Role.objects.filter(uuid__in=uuids): |
97 | 87 |
role.delete() |
88 | ||
89 |
@classmethod |
|
90 |
def process_notification(cls, tenant, notification): |
|
91 |
assert cls.check_valid_notification(notification), \ |
|
92 |
'invalid notification' |
|
93 |
service = tenant.get_service() |
|
94 |
action = notification['@type'] |
|
95 |
audience = notification['audience'] |
|
96 |
full = notification['full'] if 'full' in notification else False |
|
97 |
entity_id = service.get('saml-sp-metadata-url') |
|
98 |
assert entity_id, 'service has no saml-sp-metadat-url field' |
|
99 |
if entity_id not in audience: |
|
100 |
return |
|
101 |
uuids = set() |
|
102 |
cls.provision_role(action, notification['objects'], full=full) |
|
98 |
- |