pundit: convert wiki pages to pundit.

This commit is contained in:
evazion
2020-03-17 04:36:05 -05:00
parent 5c6d26ea24
commit b3ff08fedf
7 changed files with 78 additions and 66 deletions

View File

@@ -0,0 +1,17 @@
class WikiPagePolicy < ApplicationPolicy
def update?
unbanned? && (can_edit_locked? || !record.is_locked?)
end
def revert?
update?
end
def can_edit_locked?
user.is_builder?
end
def permitted_attributes
[:title, :body, :other_names, :other_names_string, :is_deleted, (:is_locked if can_edit_locked?)].compact
end
end