Sha256: 1e5443f366ba3f512737cf602e14c10cd8882fcefbaa771cd7ce4a19142878b4

Contents?: true

Size: 480 Bytes

Versions: 10

Compression:

Stored size: 480 Bytes

Contents

module CmAdmin
  module PermissionHelper

    # Used in mode.rb while creating policies.
    def has_access_to?(ar_model, action)
      find_permission_by(ar_model, action).present?
    end

    # Checks if the current user permission has access to the specified model and action
    def find_permission_by(ar_model, action)
      CmCurrent.user_permissions.find { |permission| permission.ar_model_name == ar_model.name && permission.action_name == action.name }
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cm-admin-4.4.8 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.4.6 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.4.1 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.4.0 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.3.0 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.2.1 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.2.0 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.1.2 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.1.1 app/helpers/cm_admin/permission_helper.rb
cm-admin-4.1.0 app/helpers/cm_admin/permission_helper.rb