Sha256: 9f66956081492e0b0aa5e56c3241385cc9ad7ddd3ef62b7459093961dd8112c9

Contents?: true

Size: 777 Bytes

Versions: 7

Compression:

Stored size: 777 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

        def name
          :user
        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

7 entries across 7 versions & 1 rubygems

Version Path
cantango-0.9.4.7 lib/cantango/permits/user_permit/builder.rb
cantango-0.9.4.6 lib/cantango/permits/user_permit/builder.rb
cantango-0.9.4.5 lib/cantango/permits/user_permit/builder.rb
cantango-0.9.4.3 lib/cantango/permits/user_permit/builder.rb
cantango-0.9.4.2 lib/cantango/permits/user_permit/builder.rb
cantango-0.9.4.1 lib/cantango/permits/user_permit/builder.rb
cantango-0.9.4 lib/cantango/permits/user_permit/builder.rb