Sha256: 69dab7e874e6ad9bcfe66093576757b3466d5b63e3cee358bf8142c3e0dff44e

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

require 'active_support/concern'

module Georgia
  module Concerns
    module ContentPolicy
      extend ActiveSupport::Concern

      included do

        def search?
          index?
        end

        def preview?
          content_user_permissions(:preview_pages).include?(true)
        end

        def copy?
          content_user_permissions(:copy_pages).include?(true)
        end

        def show?
          edit?
        end

        def new?
          create?
        end

        def edit?
          update?
        end

        def update?
          content_user_permissions(:update_pages).include?(true)
        end

        def destroy?
          content_user_permissions(:delete_pages).include?(true)
        end

        private

        def content_permissions
          Georgia.permissions[:content]
        end

        def content_user_permissions action
          user_permissions(content_permissions, action)
        end

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georgia-0.8.0 app/policies/georgia/concerns/content_policy.rb