Class: Tuersteher::PathAccessRule

Inherits:
BaseAccessRule show all
Defined in:
lib/tuersteher.rb

Constant Summary collapse

METHOD_NAMES =
[:get, :edit, :put, :delete, :post, :all].freeze

Instance Attribute Summary collapse

Attributes inherited from BaseAccessRule

#rule_spezifications

Instance Method Summary collapse

Methods inherited from BaseAccessRule

#deny, #deny?, #extension, #fired?, #grant, #not, #right, #role, #roles

Constructor Details

#initialize(path) ⇒ PathAccessRule

Zugriffsregel

path :all fuer beliebig, sonst String mit der http-path beginnen muss



665
666
667
668
669
670
671
672
# File 'lib/tuersteher.rb', line 665

def initialize(path)
  raise "wrong path '#{path}'! Must be a String or :all ." unless path==:all or path.is_a?(String)
  super()
  if path != :all # :all is only syntax sugar
    @path_spezification = PathSpecification.new(path, @negation)
    @rule_spezifications << @path_spezification
  end
end

Instance Attribute Details

#path_spezificationObject (readonly)

Returns the value of attribute path_spezification.



659
660
661
# File 'lib/tuersteher.rb', line 659

def path_spezification
  @path_spezification
end

Instance Method Details

#method(http_method) ⇒ Object

set http-methode http_method http-Method, allowed is :get, :put, :delete, :post, :all



677
678
679
680
681
# File 'lib/tuersteher.rb', line 677

def method(http_method)
  raise "wrong method '#{http_method}'! Must be #{METHOD_NAMES.join(', ')} !" unless METHOD_NAMES.include?(http_method)
  super
  self
end

#to_sObject



683
684
685
# File 'lib/tuersteher.rb', line 683

def to_s
  @_to_s ||= super
end