DEV: Only return users with a non-negative ID
This commit is contained in:
parent
b93a0ae663
commit
5f590e1c54
2 changed files with 5 additions and 5 deletions
|
@ -25,7 +25,7 @@ module Scim
|
|||
end
|
||||
|
||||
def storage_scope
|
||||
User.all
|
||||
User.where("id >= ?", 0)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue