0001-agent-authentic2-search-user-s-roles-ou-for-audience.patch
hobo/agent/authentic2/apps.py | ||
---|---|---|
39 | 39 |
return role_or_through.role.ou |
40 | 40 | |
41 | 41 | |
42 |
def get_audience(role_or_through): |
|
43 |
ou = get_ou(role_or_through) |
|
44 |
if ou: |
|
45 |
qs = LibertyProvider.objects.filter(ou=ou) |
|
42 |
def get_audience(instance): |
|
43 |
ous = set([get_ou(instance)]) |
|
44 |
if hasattr(instance, 'roles_and_parents'): |
|
45 |
ous.update([role.ou for role in instance.roles_and_parents()]) |
|
46 |
if ous: |
|
47 |
qs = LibertyProvider.objects.filter(ou__in=ous) |
|
46 | 48 |
else: |
47 | 49 |
qs = LibertyProvider.objects.filter(ou__isnull=True) |
48 | 50 |
return [(service, service.entity_id) for service in qs] |
49 |
- |