Skip to content

Commit dc47b1a

Browse files
author
Andrew Burns
committed
Cleanup / Make schema clearer
1 parent 0061888 commit dc47b1a

File tree

1 file changed

+29
-34
lines changed

1 file changed

+29
-34
lines changed

app/services/parameter_service.rb

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,47 @@ module ParameterService
1212

1313
# https://datatracker.ietf.org/doc/html/rfc7643#section-4
1414
SCIM_CORE_USER_SCHEMA = {
15-
"id" => String,
16-
"department" => String,
17-
"userName" => String,
18-
"displayName" => String,
19-
"nickName" => String,
15+
"id" => :value,
16+
"department" => :value,
17+
"userName" => :value,
18+
"displayName" => :value,
19+
"nickName" => :value,
2020
"name" => {
21-
"formatted" => String,
22-
"familyName" => String,
23-
"givenName" => String,
24-
"middleName" => String,
25-
"honorificPrefix" => String,
26-
"honorificSuffix" => String,
21+
"formatted" => :value,
22+
"familyName" => :value,
23+
"givenName" => :value,
24+
"middleName" => :value,
25+
"honorificPrefix" => :value,
26+
"honorificSuffix" => :value,
2727
},
28-
"profileUrl" => String,
29-
"title" => String,
30-
"userType" => String,
31-
"preferredLanguage" => String,
32-
"locale" => String,
33-
"timezone" => String,
34-
"active" => String,
35-
"password" => String,
28+
"profileUrl" => :value,
29+
"title" => :value,
30+
"userType" => :value,
31+
"preferredLanguage" => :value,
32+
"locale" => :value,
33+
"timezone" => :value,
34+
"active" => :value,
35+
"password" => :value,
3636
"emails" => [],
3737
"phoneNumbers" => [],
38-
"ims" => String,
39-
"photos" => String,
38+
"ims" => :value,
39+
"photos" => :value,
4040
"addresses" => {
41-
"formatted" => String,
42-
"streetAddress" => String,
43-
"locality" => String,
44-
"region" => String,
45-
"postalCode" => String,
46-
"country" => String,
41+
"formatted" => :value,
42+
"streetAddress" => :value,
43+
"locality" => :value,
44+
"region" => :value,
45+
"postalCode" => :value,
46+
"country" => :value,
4747
},
4848
"entitlements" => [],
4949
"roles" => [],
5050
"x509Certificates" => [],
5151
}
52-
# def invalid_params(params, object_type)
53-
# raise "Not supported" unless object_type == "User"
54-
# schema = ScimRails.config.user_schema
55-
# schema.each do |schema_key, schema_value|
56-
# end
57-
# end
5852

5953
# Given a schema and a parameter hash this method
60-
# will return
54+
# will return an aray of parameters that do not exist
55+
# or have a mismatched type in the schema
6156
def invalid_parameters(schema, parameters, parent_path: nil)
6257
invalid = []
6358

0 commit comments

Comments
 (0)