class Tuersteher::PathSpecification

The Classes for the separate Rule-Specifications

Attributes

path[R]

Public Class Methods

new(path, negation) click to toggle source
# File lib/tuersteher.rb, line 398
def initialize path, negation
  @negation = negation
  self.path = path
end

Public Instance Methods

grant?(path_or_model, method, login_ctx) click to toggle source
# File lib/tuersteher.rb, line 414
def grant? path_or_model, method, login_ctx
  rc = @path_regex =~ path_or_model
  rc = !rc if @negation
  rc
end
path=(url_path) click to toggle source
# File lib/tuersteher.rb, line 403
def path= url_path
  @path = url_path
  # url_path in regex ^#{path} wandeln ausser bei "/",
  # dies darf keine Regex mit ^/ werden, da diese dann ja immer matchen wuerde
  if url_path == "/"
    @path_regex = /^\/$/
  else
    @path_regex = /^#{url_path}/
  end
end
to_s() click to toggle source
# File lib/tuersteher.rb, line 420
def to_s
  "#{@negation && 'not.'}path('#{@path}')"
end