tuersteher 0.6.5 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/tuersteher.rb +6 -5
  3. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.5
1
+ 0.6.6
data/lib/tuersteher.rb CHANGED
@@ -133,7 +133,7 @@ module Tuersteher
133
133
 
134
134
  # definiert Model-basierende Zugriffsregel
135
135
  #
136
- # model_class: Model-Klassenname oder :all fuer alle
136
+ # model_class: Model-Klassenname(als CLass oder String) oder :all fuer alle
137
137
  def model model_class
138
138
  if block_given?
139
139
  @current_rule_class = ModelAccessRule
@@ -312,7 +312,7 @@ module Tuersteher
312
312
 
313
313
  ar_storage = AccessRulesStorage.instance
314
314
  unless ar_storage.ready?
315
- # bei nicht production-env, dann check-intervall auf 5 sek setzen
315
+ # bei nicht production-env check-intervall auf 5 sek setzen
316
316
  ar_storage.check_intervall = 5 if Rails.env!='production'
317
317
  # set root-path as prefix for all path rules
318
318
  prefix = respond_to?(:root_path) && root_path
@@ -422,11 +422,12 @@ module Tuersteher
422
422
 
423
423
  class ModelSpecification
424
424
  def initialize clazz, negation
425
+ clazz = clazz.name if clazz.is_a?(Class)
425
426
  @clazz, @negation = clazz, negation
426
427
  end
427
428
 
428
429
  def grant? path_or_model, method, login_ctx
429
- m_class = path_or_model.instance_of?(Class) ? path_or_model : path_or_model.class
430
+ m_class = path_or_model.instance_of?(Class) ? path_or_model.name : path_or_model.class.name
430
431
  rc = @clazz == m_class
431
432
  rc = !rc if @negation
432
433
  rc
@@ -650,10 +651,10 @@ module Tuersteher
650
651
 
651
652
  # erzeugt neue Object-Zugriffsregel
652
653
  #
653
- # clazz Model-Klassenname oder :all fuer alle
654
+ # clazz Model-Klassenname(als Class oder String) oder :all fuer alle
654
655
  #
655
656
  def initialize(clazz)
656
- raise "wrong clazz '#{clazz}'! Must be a Class or :all ." unless clazz==:all or clazz.is_a?(Class)
657
+ raise "wrong clazz '#{clazz}'! Must be a Class/String or :all ." unless clazz==:all or clazz.is_a?(Class) or clazz.is_a?(String)
657
658
  super()
658
659
  if clazz != :all # :all is only syntax sugar
659
660
  @rule_spezifications << ModelSpecification.new(clazz, @negation)
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: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 5
10
- version: 0.6.5
9
+ - 6
10
+ version: 0.6.6
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-09-08 00:00:00 +02:00
18
+ date: 2011-10-29 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21