Skip to content
10 changes: 7 additions & 3 deletions app/controllers/scim_rails/scim_users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ def create
end

def show
user = @company.public_send(ScimRails.config.scim_users_scope).find(params[:id])
user = find_user
json_scim_response(object: user)
end

def put_update
user = @company.public_send(ScimRails.config.scim_users_scope).find(params[:id])
user = find_user
update_status(user) unless put_active_param.nil?
user.update!(permitted_user_params)
json_scim_response(object: user)
Expand All @@ -57,13 +57,17 @@ def put_update
# TODO: PATCH will only deprovision or reprovision users.
# This will work just fine for Okta but is not SCIM compliant.
def patch_update
user = @company.public_send(ScimRails.config.scim_users_scope).find(params[:id])
user = find_user
update_status(user)
json_scim_response(object: user)
end

private

def find_user
@company.public_send(ScimRails.config.scim_users_scope).find(params[:id])
end

def permitted_user_params
ScimRails.config.mutable_user_attributes.each.with_object({}) do |attribute, hash|
hash[attribute] = find_value_for(attribute)
Expand Down
2 changes: 1 addition & 1 deletion lib/scim_rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module ScimRails
VERSION = "0.4.0"
VERSION = "0.4.1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

end