def __init__(self, data, host_url): super().__init__(data) if 'schemas' not in data or 'urn:ietf:params:scim:schemas:core:2.0:Group' not in data[ 'schemas']: raise ScimError(400, detail='Unsupported schema', scim_type='invalidValue') group_id = generate_code(10) if 'id' not in data else data['id'] self.update(self.get_metadata(data, group_id, 'Group', host_url))
def __init__(self, data, host_url): super().__init__(data) user_id = generate_code(10) if 'id' not in data else data['id'] created = self.get_date(data, 'created') modified = self.get_date(data, 'modified') self.update({ 'id': user_id, 'active': True, 'meta': { 'resourceType': 'User', 'created': created, 'modified': modified, 'location': self.get_location(host_url + '/scim/v2/Users/', user_id), 'version': self.get_version(created, modified) } })
def issue_code(self): "Generate an authorization code for the request" return crypto.generate_code()
def add(self, info): id = generate_code(16) self.consent_info[id] = info return id