3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'app/controllers/scimitar/schemas_controller.rb', line 3
def index
schemas = Scimitar::Engine.schemas
schemas.each do |schema|
schema.meta.location = scim_schemas_url(name: schema.id)
end
schemas_by_id = schemas.reduce({}) do |hash, schema|
hash[schema.id] = schema
hash
end
list = if params.key?(:name)
[ schemas_by_id[params[:name]] ]
else
schemas
end
schemas_to_render = if Scimitar.engine_configuration.schema_list_from_attribute_mappings.empty?
list
else
self.redraw_schema_list_using_mappings(list)
end
render(json: {
schemas: [
'urn:ietf:params:scim:api:messages:2.0:ListResponse'
],
totalResults: schemas_to_render.size,
startIndex: 1,
itemsPerPage: schemas_to_render.size,
Resources: schemas_to_render
})
end
|