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



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

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.



657
658
659
# File 'lib/tuersteher.rb', line 657

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



675
676
677
678
679
# File 'lib/tuersteher.rb', line 675

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



681
682
683
# File 'lib/tuersteher.rb', line 681

def to_s
  @_to_s ||= super
end