Sha256: 2b6ffe3b91c4b89109fd0b5ddbf060ebc5b9f92efe3a67ca883a1322d7e3f820

Contents?: true

Size: 871 Bytes

Versions: 20

Compression:

Stored size: 871 Bytes

Contents

module KepplerFrontend
  # Policy for View model
  class ViewPolicy < ControllerPolicy
    attr_reader :user, :objects

    def initialize(user, objects)
      @user = user
      @objects = objects
    end

    def editor?
      keppler_admin? || user_can?(@objects, 'editor')
    end

    def editor_save?
      keppler_admin? || user_can?(@objects, 'editor_save')
    end

    def live_editor_save?
      keppler_admin? || user_can?(@objects, 'live_editor_save')
    end

    def select_theme_view?
      keppler_admin? || user_can?(@objects, 'select_theme_view')
    end

    def multimedia?
      keppler_admin? || user_can?(@objects, 'multimedia')
    end

    def upload_multimedia?
      keppler_admin? || user_can?(@objects, 'upload_multimedia')
    end

    def destroy_callback?
      keppler_admin? || user_can?(@objects, 'destroy_callback')
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
keppler-2.1.18 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.17 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.16 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.15 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.4 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.3 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.2 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.1 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1.pre.p1 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb
keppler-2.1 installer/core/rockets/keppler_frontend/app/policies/keppler_frontend/view_policy.rb