mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 23:36:11 +08:00
FEATURE: hidden site setting to suppress unsecured categories from admins (#19098)
The hidden site setting `suppress_secured_categories_from_admin` will suppress visibility of categories without explicit access from admins in a few key areas (category drop downs and topic lists) It is not intended to be a security wall since admins can amend any site setting. Instead it is feature that allows hiding the categories from the UI. Admins will still be able to see topics in categories without explicit access using direct URLs or flags. Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
This commit is contained in:
@ -262,13 +262,13 @@ module TopicGuardian
|
||||
end
|
||||
|
||||
def filter_allowed_categories(records)
|
||||
unless is_admin?
|
||||
records = allowed_category_ids.size == 0 ?
|
||||
records.where('topics.category_id IS NULL') :
|
||||
records.where('topics.category_id IS NULL or topics.category_id IN (?)', allowed_category_ids)
|
||||
records = records.references(:categories)
|
||||
end
|
||||
records
|
||||
return records if is_admin? && !SiteSetting.suppress_secured_categories_from_admin
|
||||
|
||||
records = allowed_category_ids.size == 0 ?
|
||||
records.where('topics.category_id IS NULL') :
|
||||
records.where('topics.category_id IS NULL or topics.category_id IN (?)', allowed_category_ids)
|
||||
|
||||
records.references(:categories)
|
||||
end
|
||||
|
||||
def can_edit_featured_link?(category_id)
|
||||
|
Reference in New Issue
Block a user