97 |
97 |
{'format': 'json', 'orig': self.orig, 'email': self.email})
|
98 |
98 |
signed_url = signature.sign_url(url, self.key)
|
99 |
99 |
response = requests.get(signed_url)
|
100 |
|
for role in response.json()['data']:
|
101 |
|
yield Role(name=role['text'], external_id=str(role['slug']),
|
102 |
|
slug=str(role['slug']))
|
|
100 |
if response.status_code == 200:
|
|
101 |
for role in response.json()['data']:
|
|
102 |
yield Role(name=role['text'], external_id=str(role['slug']),
|
|
103 |
slug=str(role['slug']))
|
|
104 |
else:
|
|
105 |
self.logger.warn('failed to get roles for %s (response: %s)',
|
|
106 |
self.wcs_url, response.status_code)
|
103 |
107 |
|
104 |
108 |
|
105 |
109 |
class Command(BaseCommand):
|
... | ... | |
128 |
132 |
if not me:
|
129 |
133 |
print 'skipping %s, self services is not marked' % tenant
|
130 |
134 |
return
|
131 |
|
orig = urlparse.urlsplit(me['base_url']).netloc
|
|
135 |
me = me[0]
|
|
136 |
orig = urlparse.urlsplit(me['base_url']).netloc.split(':')[0]
|
132 |
137 |
key = hashlib.sha1(orig+me['secret_key']).hexdigest()
|
133 |
138 |
# FIXME: get mail of the oldest superuser, could we do better ?
|
134 |
139 |
User = get_user_model()
|
135 |
140 |
email = User.objects.order_by('id').filter(email__contains='@',
|
136 |
141 |
is_superuser=True)[0].email
|
137 |
142 |
for service in hobo_environment['services']:
|
|
143 |
if not service.get('service-id') == 'wcs':
|
|
144 |
continue
|
138 |
145 |
if not service.get('saml-sp-metadata-url'):
|
139 |
146 |
continue
|
140 |
147 |
liberty_provider = LibertyProvider.objects.get(
|