declarative_authorization 0.5.6 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ ** RELEASE 0.5.7 (Mar 10, 2013)
2
+
3
+ * Ruby 2.0 compatibility [jhawthorn]
4
+
1
5
  ** RELEASE 0.5.6 (Sep 23, 2012)
2
6
 
3
7
  * Fix handling of stray object associations [jhawthorn]
@@ -515,7 +515,7 @@ sbartsch at tzi.org
515
515
 
516
516
  Thanks to John Joseph Bachir, Dennis Blöte, Eike Carls, Damian Caruso, Kai Chen, Erik Dahlstrand,
517
517
  Jeroen van Dijk, Alexander Dobriakov, Sebastian Dyck, Ari Epstein, Jeremy Friesen,
518
- Tim Harper, John Hawthorn, hollownest, Daniel Kristensen, Jeremy Kleindl,
518
+ Tim Harper, John Hawthorn, hollownest, Daniel Kristensen, Jeremy Kleindl, Joel Kociolek,
519
519
  Benjamin ter Kuile, Brad Langhorst, Brian Langenfeld,
520
520
  Georg Ledermann, Geoff Longman, Olly Lylo, Mark Mansour, Thomas Maurer, Kevin Moore,
521
521
  Tyler Pickett, Edward Rudd, Sharagoz,
@@ -127,7 +127,7 @@ module Authorization
127
127
  elsif auth_exception
128
128
  logger.info "Permission denied: #{auth_exception}"
129
129
  end
130
- if respond_to?(:permission_denied)
130
+ if respond_to?(:permission_denied, true)
131
131
  # permission_denied needs to render or redirect
132
132
  send(:permission_denied)
133
133
  else
@@ -176,11 +176,12 @@ module Authorization
176
176
  object = object_or_sym
177
177
  end
178
178
 
179
- {:user => current_user,
180
- :object => object,
179
+ result = {:object => object,
181
180
  :context => context,
182
181
  :skip_attribute_test => object.nil?,
183
182
  :bang => bang}.merge(options)
183
+ result[:user] = current_user unless result.key?(:user)
184
+ result
184
185
  end
185
186
 
186
187
  module ClassMethods
@@ -315,7 +316,7 @@ module Authorization
315
316
  # filter_access_to in child controllers with the same action.
316
317
  def all_filter_access_permissions # :nodoc:
317
318
  ancestors.inject([]) do |perms, mod|
318
- if mod.respond_to?(:filter_access_permissions)
319
+ if mod.respond_to?(:filter_access_permissions, true)
319
320
  perms +
320
321
  mod.filter_access_permissions.collect do |p1|
321
322
  p1.clone.remove_actions(perms.inject(Set.new) {|actions, p2| actions + p2.actions})
@@ -489,7 +490,7 @@ module Authorization
489
490
  load_parent_method = :"load_#{options[:nested_in].to_s.singularize}"
490
491
  shallow_exceptions = options[:shallow] ? {:except => members.keys} : {}
491
492
  before_filter shallow_exceptions do |controller|
492
- if controller.respond_to?(load_parent_method)
493
+ if controller.respond_to?(load_parent_method, true)
493
494
  controller.send(load_parent_method)
494
495
  else
495
496
  controller.send(:load_parent_controller_object, options[:nested_in])
@@ -499,7 +500,7 @@ module Authorization
499
500
  new_for_collection_method = :"new_#{controller_name.singularize}_for_collection"
500
501
  before_filter :only => collections.keys do |controller|
501
502
  # new_for_collection
502
- if controller.respond_to?(new_for_collection_method)
503
+ if controller.respond_to?(new_for_collection_method, true)
503
504
  controller.send(new_for_collection_method)
504
505
  else
505
506
  controller.send(:new_controller_object_for_collection,
@@ -511,7 +512,7 @@ module Authorization
511
512
  new_from_params_method = :"new_#{controller_name.singularize}_from_params"
512
513
  before_filter :only => new_actions.keys do |controller|
513
514
  # new_from_params
514
- if controller.respond_to?(new_from_params_method)
515
+ if controller.respond_to?(new_from_params_method, true)
515
516
  controller.send(new_from_params_method)
516
517
  else
517
518
  controller.send(:new_controller_object_from_params,
@@ -521,7 +522,7 @@ module Authorization
521
522
  load_method = :"load_#{controller_name.singularize}"
522
523
  before_filter :only => members.keys do |controller|
523
524
  # load controller object
524
- if controller.respond_to?(load_method)
525
+ if controller.respond_to?(load_method, true)
525
526
  controller.send(load_method)
526
527
  else
527
528
  controller.send(:load_controller_object, options[:context] || controller_name)
@@ -558,7 +559,7 @@ module Authorization
558
559
  def filter_access_permissions # :nodoc:
559
560
  unless filter_access_permissions?
560
561
  ancestors[1..-1].reverse.each do |mod|
561
- mod.filter_access_permissions if mod.respond_to?(:filter_access_permissions)
562
+ mod.filter_access_permissions if mod.respond_to?(:filter_access_permissions, true)
562
563
  end
563
564
  end
564
565
  class_variable_set(:@@declarative_authorization_permissions, {}) unless filter_access_permissions?
@@ -256,7 +256,7 @@ module Authorization
256
256
  else
257
257
  attribute_name = model.columns_hash["#{attribute}_id"] && :"#{attribute}_id" ||
258
258
  model.columns_hash[attribute.to_s] && attribute ||
259
- :id
259
+ model.primary_key
260
260
  attribute_table_alias = table_alias
261
261
  used_paths << path
262
262
  end
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: declarative_authorization
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.7
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 5
9
- - 6
10
- version: 0.5.6
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Steffen Bartsch
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-09-23 00:00:00 Z
12
+ date: 2013-03-10 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description:
22
15
  email: sbartsch@tzi.org
23
16
  executables: []
24
-
25
17
  extensions: []
26
-
27
- extra_rdoc_files:
18
+ extra_rdoc_files:
28
19
  - README.rdoc
29
20
  - CHANGELOG
30
- files:
21
+ files:
31
22
  - CHANGELOG
32
23
  - MIT-LICENSE
33
24
  - README.rdoc
@@ -74,38 +65,27 @@ files:
74
65
  - test/authorization_test.rb
75
66
  homepage: http://github.com/stffn/declarative_authorization
76
67
  licenses: []
77
-
78
68
  post_install_message:
79
69
  rdoc_options: []
80
-
81
- require_paths:
70
+ require_paths:
82
71
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
72
+ required_ruby_version: !ruby/object:Gem::Requirement
84
73
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 59
89
- segments:
90
- - 1
91
- - 8
92
- - 6
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
93
77
  version: 1.8.6
94
- required_rubygems_version: !ruby/object:Gem::Requirement
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
79
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
- version: "0"
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
103
84
  requirements: []
104
-
105
85
  rubyforge_project:
106
- rubygems_version: 1.8.15
86
+ rubygems_version: 1.8.23
107
87
  signing_key:
108
88
  specification_version: 3
109
- summary: declarative_authorization is a Rails plugin for maintainable authorization based on readable authorization rules.
89
+ summary: declarative_authorization is a Rails plugin for maintainable authorization
90
+ based on readable authorization rules.
110
91
  test_files: []
111
-