Commit cf2e56b

mokha <mokha@cisco.com>
2019-01-29 23:17:30
complete the scim enterprise user extension
1 parent f979a08
Changed files (2)
lib/scim/shady/enterprise_user.rb
@@ -56,6 +56,40 @@ module Scim
           x.returned = :default
           x.uniqueness = :none
         end
+        schema.add_attribute(name: :manager, type: :complex) do |x|
+          x.multi_valued = false
+          x.description = ""
+          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 = ""
+            y.required = false
+            y.case_exact = false
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: '$ref', type: :reference) do |y|
+            y.multi_valued = false
+            y.description = ""
+            y.required = false
+            y.case_exact = false
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: :display_name, type: :string) do |y|
+            y.multi_valued = false
+            y.description = ""
+            y.required = false
+            y.case_exact = false
+            y.mutability = :read_only
+            y.returned = :default
+            y.uniqueness = :none
+          end
+        end
         schema
       end
     end
spec/scim/enterprise_user_spec.rb
@@ -9,6 +9,7 @@ RSpec.describe Scim::Shady::EnterpriseUser do
     subject.name.middle_name = "Jane"
     subject.name.honorific_prefix = "Ms."
     subject.name.honorific_suffix = "III"
+    subject.password = SecureRandom.uuid
     subject.display_name = "Barbara Jensen"
     subject.nick_name = "Barb"
     subject.preferred_language = "en_US"
@@ -18,7 +19,11 @@ RSpec.describe Scim::Shady::EnterpriseUser do
     subject.employee_number = '1'
     subject.cost_center = SecureRandom.uuid
     subject.organization = SecureRandom.uuid
+    subject.division = SecureRandom.uuid
     subject.department = SecureRandom.uuid
+    subject.manager.value = SecureRandom.uuid
+    subject.manager.write_attribute('$ref', SecureRandom.uuid)
+    subject.manager.display_name = SecureRandom.uuid
   end
 
   specify { expect(subject).to be_valid }