Sha256: ca01588010c1ef7cfad3b0fd7ce4522369f9d8a23a7e150a44a233badad793aa
Contents?: true
Size: 662 Bytes
Versions: 1
Compression:
Stored size: 662 Bytes
Contents
require 'i_am_i_can/role/definition' require 'i_am_i_can/role/assignment' require 'i_am_i_can/role_group/definition' require 'i_am_i_can/role_group/assignment' module IAmICan module Role extend ActiveSupport::Concern class_methods do def which(name:, **conditions) find_by!(name: name, **conditions) end def names self.pluck(:name).map(&:to_sym) end end included do # def attributes # super.symbolize_keys # end # `can? :manage, User` / `can? :manage, obj: User` def can? action, o = nil, obj: o _permissions.matched?(action, obj) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
i_am_i_can-4.0.0 | lib/i_am_i_can/role.rb |