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