mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:19:27 +08:00
b9d037770c
Extension of https://github.com/discourse/discourse/pull/20057 Admin can create a public session visible to everyone. An additional checkbox is displayed for staff members.
18 lines
402 B
Ruby
18 lines
402 B
Ruby
# frozen_string_literal: true
|
|
|
|
module SidebarGuardian
|
|
def can_create_public_sidebar_section?
|
|
@user.staff?
|
|
end
|
|
|
|
def can_edit_sidebar_section?(sidebar_section)
|
|
return @user.staff? if sidebar_section.public?
|
|
is_my_own?(sidebar_section)
|
|
end
|
|
|
|
def can_delete_sidebar_section?(sidebar_section)
|
|
return @user.staff? if sidebar_section.public?
|
|
is_my_own?(sidebar_section)
|
|
end
|
|
end
|