Sha256: adca88617f9771ba1c594ca995f22f4af814e036b7b54c3e6772305c0f8ea4dd
Contents?: true
Size: 964 Bytes
Versions: 6
Compression:
Stored size: 964 Bytes
Contents
module CanTango module Permits class RolePermit < CanTango::Permit class Builder < CanTango::PermitEngine::Builder::Base include CanTango::Helpers::Debug # builds a list of Permits for each role of the current ability user (or account) # @return [Array<RoleGroupPermit::Base>] the role permits built for this ability def build if roles.empty? debug "Not building any RolePermit" return [] if roles.empty? end roles.inject([]) do |permits, role| debug "Building RolePermit for #{role}" (permits << create_permit(role)) if valid?(role.to_sym) permits end.compact end def name :role end protected def valid? role filter(role).valid? end def filter role CanTango::Filters::RoleFilter.new role end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems