mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 03:32:17 +08:00
FEATURE: Site setting/UI to allow users to set their primary group (#8244)
* FEATURE: Site setting/ui to allow users to set their primary group * prettier and remove logic from account template * added 1 to 43 to make web_hook_user_serializer_spec pass
This commit is contained in:

committed by
GitHub

parent
0e1c5c6bba
commit
4eb54f08b2
@ -316,6 +316,14 @@ class Guardian
|
||||
user.groups.where(title: title).exists?
|
||||
end
|
||||
|
||||
def can_use_primary_group?(user, group_id = nil)
|
||||
return false if !user || !group_id
|
||||
group = Group.find_by(id: group_id.to_i)
|
||||
|
||||
user.group_ids.include?(group_id.to_i) &&
|
||||
(group ? !group.automatic : false)
|
||||
end
|
||||
|
||||
def can_change_primary_group?(user)
|
||||
user && is_staff?
|
||||
end
|
||||
|
Reference in New Issue
Block a user