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

@@ -11,7 +11,6 @@ class WikiPage < ApplicationRecord
validates_presence_of :title
validates_presence_of :body, :unless => -> { is_deleted? || other_names.present? }
validate :validate_rename
validate :validate_not_locked
array_attribute :other_names
has_one :tag, :foreign_key => "name", :primary_key => "title"
@@ -116,12 +115,6 @@ class WikiPage < ApplicationRecord
extend SearchMethods
include ApiMethods
def validate_not_locked
if is_locked? && !CurrentUser.is_builder?
errors.add(:is_locked, "and cannot be updated")
end
end
def validate_rename
return unless title_changed?