2023-02-02 22:44:40 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module SidebarGuardian
|
2023-02-21 16:55:44 -05:00
|
|
|
def can_create_public_sidebar_section?
|
|
|
|
@user.staff?
|
|
|
|
end
|
|
|
|
|
2023-02-02 22:44:40 -05:00
|
|
|
def can_edit_sidebar_section?(sidebar_section)
|
2023-02-21 16:55:44 -05:00
|
|
|
return @user.staff? if sidebar_section.public?
|
2023-02-02 22:44:40 -05:00
|
|
|
is_my_own?(sidebar_section)
|
|
|
|
end
|
|
|
|
|
|
|
|
def can_delete_sidebar_section?(sidebar_section)
|
2023-02-21 16:55:44 -05:00
|
|
|
return @user.staff? if sidebar_section.public?
|
2023-02-02 22:44:40 -05:00
|
|
|
is_my_own?(sidebar_section)
|
|
|
|
end
|
|
|
|
end
|