Module: TwoPercent::ValidatesUserGroupsPatch

Included in:
BulkProcessor, ScimController
Defined in:
lib/two_percent/validates_user_groups_patch.rb

Overview

Validates PATCH operations against RFC 7643 read-only attributes

Ensures User.groups attribute cannot be modified via PATCH operations, as per RFC 7643 Section 4.1.2. Group memberships must be managed via PATCH operations on the Group resource itself.

Instance Method Summary collapse

Instance Method Details

#validate_patch_operations!(resource_type, patch_request) ⇒ Object

Validate PATCH operations against RFC 7643 read-only attributes

Parameters:

  • resource_type (String)

    The SCIM resource type (e.g., "Users", "Groups")

  • patch_request (Hash)

    The PATCH request payload

Raises:



14
15
16
17
18
19
20
21
22
# File 'lib/two_percent/validates_user_groups_patch.rb', line 14

def validate_patch_operations!(resource_type, patch_request)
  return unless resource_type == "Users"

  patch_request = patch_request.with_indifferent_access
  operations = patch_request[:Operations]
  return unless operations.is_a?(Array)

  operations.each { |operation| validate_operation_path!(operation.with_indifferent_access) }
end