mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
FEATURE: allow site owners to disable impersonation (#20783)
Site owners can now disable impersonation using the global setting `allow_impersonation` (Eg: DISCOURSE_ALLOW_IMPERSONATION: false) see: https://meta.discourse.org/t/thoughts-about-impersonate-user/258795
This commit is contained in:
@ -297,7 +297,7 @@ class Guardian
|
||||
|
||||
# Can we impersonate this user?
|
||||
def can_impersonate?(target)
|
||||
target &&
|
||||
GlobalSetting.allow_impersonation && target &&
|
||||
# You must be an admin to impersonate
|
||||
is_admin? &&
|
||||
# You may not impersonate other admins unless you are a dev
|
||||
|
Reference in New Issue
Block a user