Class: Scimaenaga::ScimGroupsController
Constant Summary
Constants included
from Response
Response::CONTENT_TYPE
Instance Method Summary
collapse
Methods included from Response
#json_response, #json_scim_response
Instance Method Details
#create ⇒ Object
43
44
45
46
47
48
49
|
# File 'app/controllers/scimaenaga/scim_groups_controller.rb', line 43
def create
group = @company
.public_send(Scimaenaga.config.scim_groups_scope)
.create!(permitted_group_params)
json_scim_response(object: group, status: :created)
end
|
#index ⇒ Object
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
|
# File 'app/controllers/scimaenaga/scim_groups_controller.rb', line 5
def index
if params[:filter].present?
query = Scimaenaga::ScimQueryParser.new(
params[:filter], Scimaenaga.config.queryable_group_attributes
)
groups = @company
.public_send(Scimaenaga.config.scim_groups_scope)
.where(
"#{Scimaenaga.config.scim_groups_model
.connection.quote_column_name(query.attribute)}
#{query.operator} ?",
query.parameter
)
.order(Scimaenaga.config.scim_groups_list_order)
else
groups = @company
.public_send(Scimaenaga.config.scim_groups_scope)
.preload(:users)
.order(Scimaenaga.config.scim_groups_list_order)
end
counts = ScimCount.new(
start_index: params[:startIndex],
limit: params[:count],
total: groups.count
)
json_scim_response(object: groups, counts: counts)
end
|
#patch_update ⇒ Object
59
60
61
62
63
64
65
66
67
|
# File 'app/controllers/scimaenaga/scim_groups_controller.rb', line 59
def patch_update
group = @company
.public_send(Scimaenaga.config.scim_groups_scope)
.find(params[:id])
patch = ScimPatch.new(params, :group)
patch.save(group)
json_scim_response(object: group)
end
|
#put_update ⇒ Object
51
52
53
54
55
56
57
|
# File 'app/controllers/scimaenaga/scim_groups_controller.rb', line 51
def put_update
group = @company
.public_send(Scimaenaga.config.scim_groups_scope)
.find(params[:id])
group.update!(permitted_group_params)
json_scim_response(object: group)
end
|
#show ⇒ Object
36
37
38
39
40
41
|
# File 'app/controllers/scimaenaga/scim_groups_controller.rb', line 36
def show
group = @company
.public_send(Scimaenaga.config.scim_groups_scope)
.find(params[:id])
json_scim_response(object: group)
end
|