Sha256: 6a8e2d80286df0d060e04bd27600c1fd5c1a251d832131ef3911f0c1391deb2e

Contents?: true

Size: 732 Bytes

Versions: 9

Compression:

Stored size: 732 Bytes

Contents

module CanTango
  module Permits
    class UserPermit < 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<Permit::Base>] the role permits built for this ability
        def build
          puts debug_msg if CanTango.debug?
          [permit].compact
        end

        protected

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

        def permit
          @permit ||= create_permit(user.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/user_permit/builder.rb
cantango-0.8.9.5 lib/cantango/permits/user_permit/builder.rb
cantango-0.8.9.4 lib/cantango/permits/user_permit/builder.rb
cantango-0.8.9.3 lib/cantango/permits/user_permit/builder.rb
cantango-0.8.9.2 lib/cantango/permits/user_permit/builder.rb
cantango-0.8.9.1 lib/cantango/permits/user_permit/builder.rb
cantango-0.8.9 lib/cantango/permits/user_permit/builder.rb
cantango-0.8.8.1 lib/cantango/permits/user_permit/builder.rb
cantango-0.8.8 lib/cantango/permits/user_permit/builder.rb