mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: User group check should return true for system user for auto groups (#25357)
This is a temporary fix to address an issue where the system user is losing its automatic groups when the server is running. If any auto groups are provided, and the user is a system user, then we return true. The system user is admin, moderator, and TL4, so they usually have all auto groups. We can remove this when we get to the bottom of why the auto groups are being deleted.
This commit is contained in:
@@ -516,7 +516,9 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def in_any_groups?(group_ids)
|
||||
group_ids.include?(Group::AUTO_GROUPS[:everyone]) || (group_ids & belonging_to_group_ids).any?
|
||||
group_ids.include?(Group::AUTO_GROUPS[:everyone]) ||
|
||||
(is_system_user? && (Group.auto_groups_between(:admins, :trust_level_4) & group_ids).any?) ||
|
||||
(group_ids & belonging_to_group_ids).any?
|
||||
end
|
||||
|
||||
def belonging_to_group_ids
|
||||
|
||||
Reference in New Issue
Block a user