spec/apps/dummy/app/models/mock_user.rb in scimitar-1.8.2 vs spec/apps/dummy/app/models/mock_user.rb in scimitar-1.10.0

- old
+ new

@@ -16,10 +16,11 @@ work_email_address home_email_address work_phone_number organization department + manager mock_groups } has_and_belongs_to_many :mock_groups @@ -46,10 +47,11 @@ return { id: :primary_key, externalId: :scim_uid, userName: :username, password: :password, + active: :is_active, name: { givenName: :first_name, familyName: :last_name }, emails: [ @@ -78,26 +80,32 @@ value: :work_phone_number, primary: false } }, ], - groups: [ # NB read-only, so no :find_with key + groups: [ { + # Read-only, so no :find_with key. There's no 'class' specified here + # either, to help test the "/Schemas" endpoint's reflection code. + # list: :mock_groups, using: { value: :id, display: :display_name } } ], - active: :is_active, # Custom extension schema - see configuration in # "spec/apps/dummy/config/initializers/scimitar.rb". # organization: :organization, department: :department, + primaryEmail: :scim_primary_email, + + manager: :manager, + userGroups: [ { list: :mock_groups, find_with: ->(value) { MockGroup.find(value["value"]) }, using: { @@ -122,11 +130,18 @@ 'name.familyName' => { column: :last_name }, 'groups' => { column: MockGroup.arel_table[:id] }, 'groups.value' => { column: MockGroup.arel_table[:id] }, 'emails' => { columns: [ :work_email_address, :home_email_address ] }, 'emails.value' => { columns: [ :work_email_address, :home_email_address ] }, - 'emails.type' => { ignore: true } # We can't filter on that; it'll just search all e-mails + 'emails.type' => { ignore: true }, # We can't filter on that; it'll just search all e-mails + 'primaryEmail' => { column: :scim_primary_email }, } + end + + # Custom attribute reader + # + def scim_primary_email + work_email_address end include Scimitar::Resources::Mixin end