tuersteher 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/VERSION +1 -1
  2. data/lib/tuersteher.rb +18 -14
  3. data/spec/spec_helper.rb +1 -1
  4. metadata +10 -16
  5. data/.gitignore +0 -5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.2
data/lib/tuersteher.rb CHANGED
@@ -170,10 +170,8 @@ module Tuersteher
170
170
  if Tuersteher::TLogger.logger.debug?
171
171
  if rule.nil?
172
172
  s = 'denied'
173
- elsif rule.deny?
174
- s = "denied with #{rule}"
175
173
  else
176
- s = "granted with #{rule}"
174
+ s = "fired with #{rule}"
177
175
  end
178
176
  usr_id = user && user.respond_to?(:id) ? user.id : user.object_id
179
177
  Tuersteher::TLogger.logger.debug("Tuersteher: path_access?(user.id=#{usr_id}, path=#{path}, method=#{method}) => #{s}")
@@ -391,7 +389,7 @@ module Tuersteher
391
389
  end
392
390
 
393
391
  def to_s
394
- "Path[#{@negation&&'! '}#{@path}]"
392
+ "#{@negation && 'not.'}path('#{@path}')"
395
393
  end
396
394
  end
397
395
 
@@ -408,7 +406,7 @@ module Tuersteher
408
406
  end
409
407
 
410
408
  def to_s
411
- "Model[#{@negation&&'! '}#{@clazz}]"
409
+ "#{@negation && 'not.'}model(#{@clazz})"
412
410
  end
413
411
  end
414
412
 
@@ -429,7 +427,8 @@ module Tuersteher
429
427
  end
430
428
 
431
429
  def to_s
432
- "Role[#{@negation&&'! '}#{@roles.join(',')}]"
430
+ role_s = @roles.size == 1 ? "role(:#{@roles.first})" : "roles(#{@roles.map{|r| ":#{r}"}.join(',')})"
431
+ "#{@negation && 'not.'}#{role_s}"
433
432
  end
434
433
  end
435
434
 
@@ -445,7 +444,7 @@ module Tuersteher
445
444
  end
446
445
 
447
446
  def to_s
448
- "Method[#{@negation&&'! '}#{@method}]"
447
+ "#{@negation && 'not.'}method(:#{@method})"
449
448
  end
450
449
  end
451
450
 
@@ -486,8 +485,8 @@ module Tuersteher
486
485
  end
487
486
 
488
487
  def to_s
489
- val_s = @expected_value.nil? ? nil : "=#{@expected_value}"
490
- "Extension[#{@negation&&'! '}#{@method}#{val_s}]"
488
+ val_s = @expected_value.nil? ? nil : ", #{@expected_value}"
489
+ "#{@negation && 'not.'}extension(:#{@method}#{val_s})"
491
490
  end
492
491
  end
493
492
 
@@ -581,11 +580,7 @@ module Tuersteher
581
580
 
582
581
 
583
582
  def to_s
584
- s = "#{self.class}["
585
- s << 'DENY ' if @deny
586
- s << @rule_spezifications.map(&:to_s).join(', ')
587
- s << ']'
588
- s
583
+ "Rule[#{@deny ? 'deny' : 'grant'}.#{@rule_spezifications.map(&:to_s).join('.')}]"
589
584
  end
590
585
  end # of BaseAccessRule
591
586
 
@@ -594,6 +589,7 @@ module Tuersteher
594
589
 
595
590
  METHOD_NAMES = [:get, :edit, :put, :delete, :post, :all].freeze
596
591
  attr_reader :path_spezification
592
+ @@_to_s = nil
597
593
 
598
594
  # Zugriffsregel
599
595
  #
@@ -617,11 +613,15 @@ module Tuersteher
617
613
  self
618
614
  end
619
615
 
616
+ def to_s
617
+ @@_to_s ||= super
618
+ end
620
619
  end
621
620
 
622
621
 
623
622
 
624
623
  class ModelAccessRule < BaseAccessRule
624
+ @@_to_s = nil
625
625
 
626
626
  # erzeugt neue Object-Zugriffsregel
627
627
  #
@@ -635,6 +635,10 @@ module Tuersteher
635
635
  end
636
636
  end
637
637
 
638
+
639
+ def to_s
640
+ @@_to_s ||= super
641
+ end
638
642
  end
639
643
 
640
644
  end
data/spec/spec_helper.rb CHANGED
@@ -4,4 +4,4 @@ require File.expand_path(File.dirname(__FILE__) + "/../lib/tuersteher")
4
4
 
5
5
  # Logger auf stdout stellen
6
6
  Tuersteher::TLogger.logger = Logger.new(STDOUT)
7
- Tuersteher::TLogger.logger.level = Logger::ERROR
7
+ #Tuersteher::TLogger.logger.level = Logger::ERROR
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuersteher
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease: false
4
+ hash: 3
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bernd Ledig
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-14 00:00:00 +02:00
18
+ date: 2011-07-15 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -28,7 +28,6 @@ extensions: []
28
28
  extra_rdoc_files:
29
29
  - README.rdoc
30
30
  files:
31
- - .gitignore
32
31
  - Manifest
33
32
  - README.rdoc
34
33
  - Rakefile
@@ -51,8 +50,8 @@ homepage: http://github.com/bledig/tuersteher
51
50
  licenses: []
52
51
 
53
52
  post_install_message:
54
- rdoc_options:
55
- - --charset=UTF-8
53
+ rdoc_options: []
54
+
56
55
  require_paths:
57
56
  - lib
58
57
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -76,14 +75,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
75
  requirements: []
77
76
 
78
77
  rubyforge_project:
79
- rubygems_version: 1.3.7
78
+ rubygems_version: 1.6.2
80
79
  signing_key:
81
80
  specification_version: 3
82
81
  summary: Security-Layer for Rails-Application
83
- test_files:
84
- - spec/model_extensions_spec.rb
85
- - spec/acces_rules_storage_spec.rb
86
- - spec/spec_helper.rb
87
- - spec/model_access_rule_spec.rb
88
- - spec/access_rules_spec.rb
89
- - spec/path_access_rule_spec.rb
82
+ test_files: []
83
+
data/.gitignore DELETED
@@ -1,5 +0,0 @@
1
- pkg
2
- .idea
3
- tuersteher*.gem
4
- nbproject
5
- .rvmrc