Commit 565be40
Changed files (2)
lib
scim
spec
scim
lib/scim/shady.rb
@@ -390,6 +390,91 @@ module Scim
y.uniqueness = :none
end
end
+ schema.add_attribute(name: :groups, type: :complex) do |x|
+ x.multi_valued = true
+ x.description = "A list of groups to which the user belongs, either through direct membership, through nested groups, or dynamically calculated."
+ x.required = false
+ x.mutability = :read_only
+ x.returned = :default
+ x.add_attribute(name: :value, type: :string) do |y|
+ y.multi_valued = false
+ y.description = "The identifier of the User's group."
+ y.required = false
+ y.case_exact = false
+ y.mutability = :read_only
+ y.returned = :default
+ y.uniqueness = :none
+ end
+ x.add_attribute(name: '$ref', type: :reference) do |y|
+ y.multi_valued = false
+ y.description = "The URI of the corresponding 'Group' resource to which the user belongs."
+ y.required = false
+ y.case_exact = false
+ y.mutability = :read_only
+ y.returned = :default
+ y.uniqueness = :none
+ end
+ x.add_attribute(name: :display, type: :string) do |y|
+ y.multi_valued = false
+ y.description = "A human-readable name, primarily used for display purposes. READ-ONLY."
+ y.required = false
+ y.case_exact = false
+ y.mutability = :read_only
+ y.returned = :default
+ y.uniqueness = :none
+ end
+ x.add_attribute(name: :type, type: :string) do |y|
+ y.multi_valued = false
+ y.description = "A label indicating the attribute's function, e.g., 'direct' or 'indirect'."
+ y.required = false
+ y.case_exact = false
+ y.canonical_values = ['direct', 'indirect']
+ y.mutability = :read_only
+ y.returned = :default
+ y.uniqueness = :none
+ end
+ end
+ schema.add_attribute(name: :entitlements, type: :complex) do |x|
+ x.multi_valued = true
+ x.description = "A list of entitlements for the User that represent a thing the User has."
+ x.required = false
+ x.mutability = :read_write
+ x.returned = :default
+ x.add_attribute(name: :value, type: :string) do |y|
+ y.multi_valued = false
+ y.description = "The value of an entitlement."
+ y.required = false
+ y.case_exact = false
+ y.mutability = :read_write
+ y.returned = :default
+ y.uniqueness = :none
+ end
+ x.add_attribute(name: :display, type: :string) do |y|
+ y.multi_valued = false
+ y.description = "A human-readable name, primarily used for display purposes. READ-ONLY."
+ y.required = false
+ y.case_exact = false
+ y.mutability = :read_write
+ y.returned = :default
+ y.uniqueness = :none
+ end
+ x.add_attribute(name: :type, type: :string) do |y|
+ y.multi_valued = false
+ y.description = "A label indicating the attribute's function."
+ y.required = false
+ y.case_exact = false
+ y.mutability = :read_write
+ y.returned = :default
+ y.uniqueness = :none
+ end
+ x.add_attribute(name: :primary, type: :boolean) do |y|
+ y.multi_valued = false
+ y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute. The primary attribute value 'true' MUST appear no more than once."
+ y.required = false
+ y.mutability = :read_write
+ y.returned = :default
+ end
+ end
schema
end
end
spec/scim/user_spec.rb
@@ -21,6 +21,8 @@ RSpec.describe Scim::Shady::User do
subject.ims << { value: 'bjensen', display: 'bjensen', type: 'xmpp', primary: true }
subject.photos << { value: 'https://gph.is/Zeq0fl', display: 'on the beach', type: 'photo', primary: true }
subject.addresses << { formatted: '123 street NE, Seattle, WA', street_address: '123 street NE', locality: 'Seattle', region: 'WA', postal_code: '12345', country: 'USA', type: 'work' }
+ subject.groups << { value: SecureRandom.uuid, '$ref' => FFaker::Internet.uri('https'), display: '', type: 'direct' }
+ subject.entitlements << { value: SecureRandom.uuid, display: 'thing', type: 'thing', primary: true }
end
specify { expect(subject.to_h[:userName]).to eql('bjensen') }