ae_declarative_authorization 0.7.1 → 0.8.0

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 (56) hide show
  1. checksums.yaml +5 -5
  2. data/Appraisals +31 -21
  3. data/CHANGELOG +189 -189
  4. data/Gemfile +7 -7
  5. data/Gemfile.lock +68 -60
  6. data/LICENSE.txt +20 -20
  7. data/README.md +620 -620
  8. data/README.rdoc +597 -597
  9. data/Rakefile +35 -33
  10. data/authorization_rules.dist.rb +20 -20
  11. data/declarative_authorization.gemspec +24 -24
  12. data/gemfiles/rails4252.gemfile +10 -10
  13. data/gemfiles/rails4252.gemfile.lock +126 -0
  14. data/gemfiles/rails4271.gemfile +10 -10
  15. data/gemfiles/rails4271.gemfile.lock +126 -0
  16. data/gemfiles/rails507.gemfile +11 -11
  17. data/gemfiles/rails507.gemfile.lock +136 -0
  18. data/gemfiles/rails516.gemfile +11 -0
  19. data/gemfiles/rails516.gemfile.lock +136 -0
  20. data/gemfiles/rails521.gemfile +11 -0
  21. data/gemfiles/rails521.gemfile.lock +144 -0
  22. data/init.rb +5 -5
  23. data/lib/declarative_authorization.rb +18 -18
  24. data/lib/declarative_authorization/authorization.rb +821 -821
  25. data/lib/declarative_authorization/helper.rb +78 -78
  26. data/lib/declarative_authorization/in_controller.rb +713 -713
  27. data/lib/declarative_authorization/in_model.rb +156 -156
  28. data/lib/declarative_authorization/maintenance.rb +215 -215
  29. data/lib/declarative_authorization/obligation_scope.rb +348 -345
  30. data/lib/declarative_authorization/railsengine.rb +5 -5
  31. data/lib/declarative_authorization/reader.rb +549 -549
  32. data/lib/declarative_authorization/test/helpers.rb +261 -261
  33. data/lib/declarative_authorization/version.rb +3 -3
  34. data/lib/generators/authorization/install/install_generator.rb +77 -77
  35. data/lib/generators/authorization/rules/rules_generator.rb +13 -13
  36. data/lib/generators/authorization/rules/templates/authorization_rules.rb +27 -27
  37. data/lib/tasks/authorization_tasks.rake +89 -89
  38. data/log/test.log +15246 -0
  39. data/pkg/ae_declarative_authorization-0.7.1.gem +0 -0
  40. data/pkg/ae_declarative_authorization-0.8.0.gem +0 -0
  41. data/test/authorization_test.rb +1121 -1121
  42. data/test/controller_filter_resource_access_test.rb +573 -573
  43. data/test/controller_test.rb +478 -478
  44. data/test/database.yml +3 -3
  45. data/test/dsl_reader_test.rb +178 -178
  46. data/test/functional/filter_access_to_with_id_in_scope_test.rb +88 -88
  47. data/test/functional/no_filter_access_to_test.rb +79 -79
  48. data/test/functional/params_block_arity_test.rb +39 -39
  49. data/test/helper_test.rb +248 -248
  50. data/test/maintenance_test.rb +46 -46
  51. data/test/model_test.rb +1840 -1840
  52. data/test/profiles/access_checking +20 -0
  53. data/test/schema.sql +60 -60
  54. data/test/test_helper.rb +174 -174
  55. data/test/test_support/minitest_compatibility.rb +26 -26
  56. metadata +17 -5
data/Rakefile CHANGED
@@ -1,33 +1,35 @@
1
- require 'rubygems'
2
- require 'bundler'
3
-
4
- begin
5
- Bundler.setup(:default, :development)
6
- rescue Bundler::BundlerError => e
7
- $stderr.puts e.message
8
- $stderr.puts "Run `bundle install` to install missing gems"
9
- exit e.status_code
10
- end
11
-
12
- require 'rake'
13
- require 'rake/testtask'
14
- require 'rdoc/task'
15
-
16
- task default: :test
17
-
18
- Rake::TestTask.new(:test) do |t|
19
- t.libs << 'lib' << 'test'
20
- t.pattern = 'test/**/*_test.rb'
21
- t.verbose = true
22
- t.warning = false
23
- end
24
-
25
- Rake::RDocTask.new(:rdoc) do |rdoc|
26
- rdoc.rdoc_dir = 'rdoc'
27
- rdoc.title = 'Authorization'
28
- rdoc.options << '--line-numbers' << '--inline-source'
29
- rdoc.options << '--charset' << 'utf-8'
30
- rdoc.rdoc_files.include('README.rdoc')
31
- rdoc.rdoc_files.include('CHANGELOG')
32
- rdoc.rdoc_files.include('lib/**/*.rb')
33
- end
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
10
+ end
11
+
12
+ require 'rake'
13
+ require 'rake/testtask'
14
+ require 'rdoc/task'
15
+
16
+ require 'bundler/gem_tasks'
17
+
18
+ task default: :test
19
+
20
+ Rake::TestTask.new(:test) do |t|
21
+ t.libs << 'lib' << 'test'
22
+ t.pattern = 'test/**/*_test.rb'
23
+ t.verbose = true
24
+ t.warning = false
25
+ end
26
+
27
+ Rake::RDocTask.new(:rdoc) do |rdoc|
28
+ rdoc.rdoc_dir = 'rdoc'
29
+ rdoc.title = 'Authorization'
30
+ rdoc.options << '--line-numbers' << '--inline-source'
31
+ rdoc.options << '--charset' << 'utf-8'
32
+ rdoc.rdoc_files.include('README.rdoc')
33
+ rdoc.rdoc_files.include('CHANGELOG')
34
+ rdoc.rdoc_files.include('lib/**/*.rb')
35
+ end
@@ -1,20 +1,20 @@
1
- authorization do
2
- role :guest do
3
- # add permissions for guests here, e.g.
4
- #has_permission_on :conferences, :to => :read
5
- end
6
-
7
- # permissions on other roles, such as
8
- #role :admin do
9
- # has_permission_on :conferences, :to => :manage
10
- #end
11
- end
12
-
13
- privileges do
14
- # default privilege hierarchies to facilitate RESTful Rails apps
15
- privilege :manage, :includes => [:create, :read, :update, :delete]
16
- privilege :read, :includes => [:index, :show]
17
- privilege :create, :includes => :new
18
- privilege :update, :includes => :edit
19
- privilege :delete, :includes => :destroy
20
- end
1
+ authorization do
2
+ role :guest do
3
+ # add permissions for guests here, e.g.
4
+ #has_permission_on :conferences, :to => :read
5
+ end
6
+
7
+ # permissions on other roles, such as
8
+ #role :admin do
9
+ # has_permission_on :conferences, :to => :manage
10
+ #end
11
+ end
12
+
13
+ privileges do
14
+ # default privilege hierarchies to facilitate RESTful Rails apps
15
+ privilege :manage, :includes => [:create, :read, :update, :delete]
16
+ privilege :read, :includes => [:index, :show]
17
+ privilege :create, :includes => :new
18
+ privilege :update, :includes => :edit
19
+ privilege :delete, :includes => :destroy
20
+ end
@@ -1,24 +1,24 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'declarative_authorization/version'
5
-
6
- Gem::Specification.new do |s|
7
- s.name = 'ae_declarative_authorization'
8
- s.version = DeclarativeAuthorization::VERSION
9
- s.platform = Gem::Platform::RUBY
10
- s.authors = ['AppFolio', 'Steffen Bartsch']
11
- s.email = 'dev@appfolio.com'
12
- s.description = 'ae_declarative_authorization is a Rails gem for maintainable authorization based on readable authorization rules.'
13
- s.summary = s.description
14
- s.homepage = 'http://github.com/appfolio/ae_declarative_authorization'
15
- s.licenses = ['MIT']
16
-
17
- s.files = Dir['**/*']
18
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
- s.require_paths = ['lib']
21
-
22
- s.add_dependency(%q<blockenspiel>, ['~> 0.5.0'])
23
- s.add_dependency(%q<rails>, ['>= 4.2.5.2', '< 5.1'])
24
- end
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'declarative_authorization/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = 'ae_declarative_authorization'
8
+ s.version = DeclarativeAuthorization::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ['AppFolio', 'Steffen Bartsch']
11
+ s.email = 'dev@appfolio.com'
12
+ s.description = 'ae_declarative_authorization is a Rails gem for maintainable authorization based on readable authorization rules.'
13
+ s.summary = s.description
14
+ s.homepage = 'http://github.com/appfolio/ae_declarative_authorization'
15
+ s.licenses = ['MIT']
16
+
17
+ s.files = Dir['**/*']
18
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
20
+ s.require_paths = ['lib']
21
+
22
+ s.add_dependency(%q<blockenspiel>, ['~> 0.5.0'])
23
+ s.add_dependency(%q<rails>, ['>= 4.2.5.2', '< 6'])
24
+ end
@@ -1,10 +1,10 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "appraisal", "~> 2.1"
6
- gem "mocha", "~> 1.0", require: false
7
- gem "sqlite3"
8
- gem "rails", "4.2.5.2"
9
-
10
- gemspec path: "../"
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.1"
6
+ gem "mocha", "~> 1.0", require: false
7
+ gem "sqlite3"
8
+ gem "rails", "4.2.5.2"
9
+
10
+ gemspec path: "../"
@@ -0,0 +1,126 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ ae_declarative_authorization (0.7.1)
5
+ blockenspiel (~> 0.5.0)
6
+ rails (>= 4.2.5.2, < 6)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (4.2.5.2)
12
+ actionpack (= 4.2.5.2)
13
+ actionview (= 4.2.5.2)
14
+ activejob (= 4.2.5.2)
15
+ mail (~> 2.5, >= 2.5.4)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ actionpack (4.2.5.2)
18
+ actionview (= 4.2.5.2)
19
+ activesupport (= 4.2.5.2)
20
+ rack (~> 1.6)
21
+ rack-test (~> 0.6.2)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (4.2.5.2)
25
+ activesupport (= 4.2.5.2)
26
+ builder (~> 3.1)
27
+ erubis (~> 2.7.0)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
+ activejob (4.2.5.2)
31
+ activesupport (= 4.2.5.2)
32
+ globalid (>= 0.3.0)
33
+ activemodel (4.2.5.2)
34
+ activesupport (= 4.2.5.2)
35
+ builder (~> 3.1)
36
+ activerecord (4.2.5.2)
37
+ activemodel (= 4.2.5.2)
38
+ activesupport (= 4.2.5.2)
39
+ arel (~> 6.0)
40
+ activesupport (4.2.5.2)
41
+ i18n (~> 0.7)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.2.0)
47
+ bundler
48
+ rake
49
+ thor (>= 0.14.0)
50
+ arel (6.0.4)
51
+ blockenspiel (0.5.0)
52
+ builder (3.2.3)
53
+ concurrent-ruby (1.0.5)
54
+ crass (1.0.4)
55
+ erubis (2.7.0)
56
+ globalid (0.4.1)
57
+ activesupport (>= 4.2.0)
58
+ i18n (0.9.5)
59
+ concurrent-ruby (~> 1.0)
60
+ json (1.8.6)
61
+ loofah (2.2.2)
62
+ crass (~> 1.0.2)
63
+ nokogiri (>= 1.5.9)
64
+ mail (2.7.0)
65
+ mini_mime (>= 0.1.1)
66
+ metaclass (0.0.4)
67
+ mini_mime (1.0.1)
68
+ mini_portile2 (2.3.0)
69
+ minitest (5.11.3)
70
+ mocha (1.7.0)
71
+ metaclass (~> 0.0.1)
72
+ nokogiri (1.8.4)
73
+ mini_portile2 (~> 2.3.0)
74
+ rack (1.6.10)
75
+ rack-test (0.6.3)
76
+ rack (>= 1.0)
77
+ rails (4.2.5.2)
78
+ actionmailer (= 4.2.5.2)
79
+ actionpack (= 4.2.5.2)
80
+ actionview (= 4.2.5.2)
81
+ activejob (= 4.2.5.2)
82
+ activemodel (= 4.2.5.2)
83
+ activerecord (= 4.2.5.2)
84
+ activesupport (= 4.2.5.2)
85
+ bundler (>= 1.3.0, < 2.0)
86
+ railties (= 4.2.5.2)
87
+ sprockets-rails
88
+ rails-deprecated_sanitizer (1.0.3)
89
+ activesupport (>= 4.2.0.alpha)
90
+ rails-dom-testing (1.0.9)
91
+ activesupport (>= 4.2.0, < 5.0)
92
+ nokogiri (~> 1.6)
93
+ rails-deprecated_sanitizer (>= 1.0.1)
94
+ rails-html-sanitizer (1.0.4)
95
+ loofah (~> 2.2, >= 2.2.2)
96
+ railties (4.2.5.2)
97
+ actionpack (= 4.2.5.2)
98
+ activesupport (= 4.2.5.2)
99
+ rake (>= 0.8.7)
100
+ thor (>= 0.18.1, < 2.0)
101
+ rake (12.3.1)
102
+ sprockets (3.7.2)
103
+ concurrent-ruby (~> 1.0)
104
+ rack (> 1, < 3)
105
+ sprockets-rails (3.2.1)
106
+ actionpack (>= 4.0)
107
+ activesupport (>= 4.0)
108
+ sprockets (>= 3.0.0)
109
+ sqlite3 (1.3.13)
110
+ thor (0.20.0)
111
+ thread_safe (0.3.6)
112
+ tzinfo (1.2.5)
113
+ thread_safe (~> 0.1)
114
+
115
+ PLATFORMS
116
+ ruby
117
+
118
+ DEPENDENCIES
119
+ ae_declarative_authorization!
120
+ appraisal (~> 2.1)
121
+ mocha (~> 1.0)
122
+ rails (= 4.2.5.2)
123
+ sqlite3
124
+
125
+ BUNDLED WITH
126
+ 1.16.3
@@ -1,10 +1,10 @@
1
- # This file was generated by Appraisal
2
-
3
- source "http://rubygems.org"
4
-
5
- gem "appraisal", "~> 2.1"
6
- gem "mocha", "~> 1.0", require: false
7
- gem "sqlite3"
8
- gem "rails", "4.2.7.1"
9
-
10
- gemspec path: "../"
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "appraisal", "~> 2.1"
6
+ gem "mocha", "~> 1.0", require: false
7
+ gem "sqlite3"
8
+ gem "rails", "4.2.7.1"
9
+
10
+ gemspec path: "../"
@@ -0,0 +1,126 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ ae_declarative_authorization (0.7.1)
5
+ blockenspiel (~> 0.5.0)
6
+ rails (>= 4.2.5.2, < 6)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (4.2.7.1)
12
+ actionpack (= 4.2.7.1)
13
+ actionview (= 4.2.7.1)
14
+ activejob (= 4.2.7.1)
15
+ mail (~> 2.5, >= 2.5.4)
16
+ rails-dom-testing (~> 1.0, >= 1.0.5)
17
+ actionpack (4.2.7.1)
18
+ actionview (= 4.2.7.1)
19
+ activesupport (= 4.2.7.1)
20
+ rack (~> 1.6)
21
+ rack-test (~> 0.6.2)
22
+ rails-dom-testing (~> 1.0, >= 1.0.5)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
24
+ actionview (4.2.7.1)
25
+ activesupport (= 4.2.7.1)
26
+ builder (~> 3.1)
27
+ erubis (~> 2.7.0)
28
+ rails-dom-testing (~> 1.0, >= 1.0.5)
29
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
30
+ activejob (4.2.7.1)
31
+ activesupport (= 4.2.7.1)
32
+ globalid (>= 0.3.0)
33
+ activemodel (4.2.7.1)
34
+ activesupport (= 4.2.7.1)
35
+ builder (~> 3.1)
36
+ activerecord (4.2.7.1)
37
+ activemodel (= 4.2.7.1)
38
+ activesupport (= 4.2.7.1)
39
+ arel (~> 6.0)
40
+ activesupport (4.2.7.1)
41
+ i18n (~> 0.7)
42
+ json (~> 1.7, >= 1.7.7)
43
+ minitest (~> 5.1)
44
+ thread_safe (~> 0.3, >= 0.3.4)
45
+ tzinfo (~> 1.1)
46
+ appraisal (2.2.0)
47
+ bundler
48
+ rake
49
+ thor (>= 0.14.0)
50
+ arel (6.0.4)
51
+ blockenspiel (0.5.0)
52
+ builder (3.2.3)
53
+ concurrent-ruby (1.0.5)
54
+ crass (1.0.4)
55
+ erubis (2.7.0)
56
+ globalid (0.4.1)
57
+ activesupport (>= 4.2.0)
58
+ i18n (0.9.5)
59
+ concurrent-ruby (~> 1.0)
60
+ json (1.8.6)
61
+ loofah (2.2.2)
62
+ crass (~> 1.0.2)
63
+ nokogiri (>= 1.5.9)
64
+ mail (2.7.0)
65
+ mini_mime (>= 0.1.1)
66
+ metaclass (0.0.4)
67
+ mini_mime (1.0.1)
68
+ mini_portile2 (2.3.0)
69
+ minitest (5.11.3)
70
+ mocha (1.7.0)
71
+ metaclass (~> 0.0.1)
72
+ nokogiri (1.8.4)
73
+ mini_portile2 (~> 2.3.0)
74
+ rack (1.6.10)
75
+ rack-test (0.6.3)
76
+ rack (>= 1.0)
77
+ rails (4.2.7.1)
78
+ actionmailer (= 4.2.7.1)
79
+ actionpack (= 4.2.7.1)
80
+ actionview (= 4.2.7.1)
81
+ activejob (= 4.2.7.1)
82
+ activemodel (= 4.2.7.1)
83
+ activerecord (= 4.2.7.1)
84
+ activesupport (= 4.2.7.1)
85
+ bundler (>= 1.3.0, < 2.0)
86
+ railties (= 4.2.7.1)
87
+ sprockets-rails
88
+ rails-deprecated_sanitizer (1.0.3)
89
+ activesupport (>= 4.2.0.alpha)
90
+ rails-dom-testing (1.0.9)
91
+ activesupport (>= 4.2.0, < 5.0)
92
+ nokogiri (~> 1.6)
93
+ rails-deprecated_sanitizer (>= 1.0.1)
94
+ rails-html-sanitizer (1.0.4)
95
+ loofah (~> 2.2, >= 2.2.2)
96
+ railties (4.2.7.1)
97
+ actionpack (= 4.2.7.1)
98
+ activesupport (= 4.2.7.1)
99
+ rake (>= 0.8.7)
100
+ thor (>= 0.18.1, < 2.0)
101
+ rake (12.3.1)
102
+ sprockets (3.7.2)
103
+ concurrent-ruby (~> 1.0)
104
+ rack (> 1, < 3)
105
+ sprockets-rails (3.2.1)
106
+ actionpack (>= 4.0)
107
+ activesupport (>= 4.0)
108
+ sprockets (>= 3.0.0)
109
+ sqlite3 (1.3.13)
110
+ thor (0.20.0)
111
+ thread_safe (0.3.6)
112
+ tzinfo (1.2.5)
113
+ thread_safe (~> 0.1)
114
+
115
+ PLATFORMS
116
+ ruby
117
+
118
+ DEPENDENCIES
119
+ ae_declarative_authorization!
120
+ appraisal (~> 2.1)
121
+ mocha (~> 1.0)
122
+ rails (= 4.2.7.1)
123
+ sqlite3
124
+
125
+ BUNDLED WITH
126
+ 1.16.3