@@ -59,7 +59,13 @@ def extract_from_inside_quotations(string)
5959 end
6060
6161 def extract_path_params ( operation )
62- operation . key? ( "path" ) ? process_path ( operation ) : nil
62+ return nil unless operation . key? ( "path" )
63+
64+ if operation [ "path" ] . include? ( "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" )
65+ return process_extension_schema_path ( operation )
66+ end
67+
68+ process_path ( operation )
6369 end
6470
6571 def extract_active_param ( operation , path_params )
@@ -102,6 +108,12 @@ def process_path(operation)
102108 end
103109 end
104110
111+ def process_extension_schema_path ( operation )
112+ key = operation [ "path" ] . split ( ":" ) . last
113+
114+ { "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User" : { "#{ key } " : operation [ "value" ] } }
115+ end
116+
105117 # `process_filter_path` is a method that, like the `process_path`
106118 # method above, parses the string in the "path" key of a PATCH
107119 # operation. It converts the operation into a Hash that resembles
@@ -238,34 +250,18 @@ def update_status(object)
238250 deprovision_method = ScimRails . config . group_deprovision_method
239251 end
240252
241- object . public_send ( reprovision_method ) if active?
242- object . public_send ( deprovision_method ) unless active?
243- end
244-
245- def active?
246- active = params [ :active ]
247-
248- case active
249- when true , "true" , 1
250- true
251- when false , "false" , 0
252- false
253- else
254- raise ActiveRecord ::RecordInvalid
253+ if patch_status ( params [ :active ] )
254+ object . public_send ( reprovision_method )
255+ else
256+ object . public_send ( deprovision_method )
255257 end
256258 end
257259
258260 def patch_status ( active_param )
259- case active_param
260- when true , "true" , 1
261- true
262- when false , "false" , 0
263- false
264- when nil
265- nil
266- else
267- raise ScimRails ::ExceptionHandler ::InvalidActiveParam
268- end
261+ # Must use .to_s.downcase to handle strings "True" and "False"
262+ # Which is sent by Azure AD
263+ # Other possible inputs (true, "true", false, "false", 0, 1, nil)
264+ ActiveModel ::Type ::Boolean . new . cast ( active_param . to_s . downcase )
269265 end
270266 end
271267end
0 commit comments