Sha256: 4278561d952ce6f96271ad04f76ab55b08d452a1be3b32b2d198fa8a1c73c9b4

Contents?: true

Size: 801 Bytes

Versions: 9

Compression:

Stored size: 801 Bytes

Contents

module CanTango
  module Permits
    class AccountPermit < CanTango::Permit
      class Builder < CanTango::PermitEngine::Builder::Base
        # class NoAvailableRoles < StandardError; end

        # 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
          return [] if !user_account
          puts debug_msg if CanTango.debug?          
          [permit].compact
        end

        protected

        def debug_msg
          permit ? "Building AccountPermit for #{user_account}, permit: #{permit}" : "Not building any AccountPermit"
        end 

        def permit
          create_permit(user_account.class.to_s)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cantango-0.9.3.2 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.9.5 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.9.4 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.9.3 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.9.2 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.9.1 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.9 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.8.1 lib/cantango/permits/account_permit/builder.rb
cantango-0.8.8 lib/cantango/permits/account_permit/builder.rb