Sha256: f186795c7106d9c45a01725f934292862f8d9d559fd08d241625407292f3db01
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
module Georgia class UpdateRevision class Service attr_reader :revision def initialize current_user, page, revision, attributes={} @current_user = current_user @page = page @revision = revision @attributes = attributes end private def current_revision? @is_current_revision ||= (@page.current_revision == @revision) end def current_review? false # @is_current_review ||= (@revision.review? and @revision.revised_by?(@current_user)) end end class Admin < Service def call @revision.update(@attributes) end end class Editor < Admin end class Contributor < Service def call if current_revision? raise Pundit::NotAuthorizedError, 'You must be at least an Editor to update a published revision.' else @revision.update(@attributes) end end end class Guest < Service def call raise Pundit::NotAuthorizedError, 'You must be at least a Contributor to update a page.' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
georgia-0.8.0 | app/services/georgia/update_revision.rb |