diff --git a/app/controllers/scim_v2/users_controller.rb b/app/controllers/scim_v2/users_controller.rb index 6dab273..5096e6b 100644 --- a/app/controllers/scim_v2/users_controller.rb +++ b/app/controllers/scim_v2/users_controller.rb @@ -25,7 +25,7 @@ module Scim end def storage_scope - User.all + User.where("id >= ?", 0) end end end \ No newline at end of file diff --git a/lib/discourse_scim/group_mixin.rb b/lib/discourse_scim/group_mixin.rb index ce0ec1a..1a5a2d9 100644 --- a/lib/discourse_scim/group_mixin.rb +++ b/lib/discourse_scim/group_mixin.rb @@ -12,8 +12,8 @@ module DiscourseScim::GroupMixin { id: :id, displayName: :name, - members: [ # NB read-write, though individual items' attributes are immutable - list: :scim_users_and_groups, # See adapter accessors, earlier in this file + members: [ + list: :scim_users_and_groups, using: { value: :id }, @@ -46,11 +46,11 @@ module DiscourseScim::GroupMixin end def scim_users_and_groups - self.users.to_a + self.associated_groups.to_a + self.users.select{ |item| item.id >= 0 }.to_a + self.associated_groups.to_a end def scim_users_and_groups=(mixed_array) - self.users = mixed_array.select { |item| item.is_a?(User) } + self.users = mixed_array.select { |item| item.is_a?(User) && item.id >=0 } self.associated_groups = mixed_array.select { |item| item.is_a?(Group) } end