Sha256: 630af9792de7f34c6465d55dc3c8e1657bf0c32b11a8afe0b07f2018b554cd73

Contents?: true

Size: 614 Bytes

Versions: 25

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

# Policy for Role model
class RolePolicy < ControllerPolicy
  attr_reader :user, :objects

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

  def clone?
    false
  end

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

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

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

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

Version data entries

25 entries across 24 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/app/policies/role_policy.rb
keppler-2.1.21 installer/core/app/policies/role_policy.rb
keppler-2.1.20 installer/core/app/policies/role_policy.rb
keppler-2.1.19 installer/core/app/policies/role_policy.rb
keppler-2.1.18 testing-with-2.1.18/app/policies/role_policy.rb
keppler-2.1.18 installer/core/app/policies/role_policy.rb
keppler-2.1.17 installer/core/app/policies/role_policy.rb
keppler-2.1.16 installer/core/app/policies/role_policy.rb
keppler-2.1.15 installer/core/app/policies/role_policy.rb
keppler-2.1.14 installer/core/app/policies/role_policy.rb
keppler-2.1.13 installer/core/app/policies/role_policy.rb
keppler-2.1.12 installer/core/app/policies/role_policy.rb
keppler-2.1.11 installer/core/app/policies/role_policy.rb
keppler-2.1.10 installer/core/app/policies/role_policy.rb
keppler-2.1.9 installer/core/app/policies/role_policy.rb
keppler-2.1.8 installer/core/app/policies/role_policy.rb
keppler-2.1.7 installer/core/app/policies/role_policy.rb
keppler-2.1.6 installer/core/app/policies/role_policy.rb
keppler-2.1.5 installer/core/app/policies/role_policy.rb
keppler-2.1.4 installer/core/app/policies/role_policy.rb