Skip to content

Commit

Permalink
Logging weiter verbessert
Browse files Browse the repository at this point in the history
  • Loading branch information
bledig-osp committed Jul 15, 2011
1 parent cd1d36b commit 4868cc1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.6.1
0.6.2
32 changes: 18 additions & 14 deletions lib/tuersteher.rb
Expand Up @@ -170,10 +170,8 @@ def path_access?(user, path, method = :get)
if Tuersteher::TLogger.logger.debug?
if rule.nil?
s = 'denied'
elsif rule.deny?
s = "denied with #{rule}"
else
s = "granted with #{rule}"
s = "fired with #{rule}"
end
usr_id = user && user.respond_to?(:id) ? user.id : user.object_id
Tuersteher::TLogger.logger.debug("Tuersteher: path_access?(user.id=#{usr_id}, path=#{path}, method=#{method}) => #{s}")
Expand Down Expand Up @@ -391,7 +389,7 @@ def grant? path_or_model, method, login_ctx
end

def to_s
"Path[#{@negation&&'! '}#{@path}]"
"#{@negation && 'not.'}path('#{@path}')"
end
end

Expand All @@ -408,7 +406,7 @@ def grant? path_or_model, method, login_ctx
end

def to_s
"Model[#{@negation&&'! '}#{@clazz}]"
"#{@negation && 'not.'}model(#{@clazz})"
end
end

Expand All @@ -429,7 +427,8 @@ def grant? path_or_model, method, login_ctx
end

def to_s
"Role[#{@negation&&'! '}#{@roles.join(',')}]"
role_s = @roles.size == 1 ? "role(:#{@roles.first})" : "roles(#{@roles.map{|r| ":#{r}"}.join(',')})"
"#{@negation && 'not.'}#{role_s}"
end
end

Expand All @@ -445,7 +444,7 @@ def grant? path_or_model, method, login_ctx
end

def to_s
"Method[#{@negation&&'! '}#{@method}]"
"#{@negation && 'not.'}method(:#{@method})"
end
end

Expand Down Expand Up @@ -486,8 +485,8 @@ def grant? path_or_model, method, login_ctx
end

def to_s
val_s = @expected_value.nil? ? nil : "=#{@expected_value}"
"Extension[#{@negation&&'! '}#{@method}#{val_s}]"
val_s = @expected_value.nil? ? nil : ", #{@expected_value}"
"#{@negation && 'not.'}extension(:#{@method}#{val_s})"
end
end

Expand Down Expand Up @@ -581,11 +580,7 @@ def fired? path_or_model, method, login_ctx


def to_s
s = "#{self.class}["
s << 'DENY ' if @deny
s << @rule_spezifications.map(&:to_s).join(', ')
s << ']'
s
"Rule[#{@deny ? 'deny' : 'grant'}.#{@rule_spezifications.map(&:to_s).join('.')}]"
end
end # of BaseAccessRule

Expand All @@ -594,6 +589,7 @@ class PathAccessRule < BaseAccessRule

METHOD_NAMES = [:get, :edit, :put, :delete, :post, :all].freeze
attr_reader :path_spezification
@@_to_s = nil

# Zugriffsregel
#
Expand All @@ -617,11 +613,15 @@ def method(http_method)
self
end

def to_s
@@_to_s ||= super
end
end



class ModelAccessRule < BaseAccessRule
@@_to_s = nil

# erzeugt neue Object-Zugriffsregel
#
Expand All @@ -635,6 +635,10 @@ def initialize(clazz)
end
end


def to_s
@@_to_s ||= super
end
end

end

0 comments on commit 4868cc1

Please sign in to comment.