acl9 2.1.2 → 3.0.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.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/.travis.yml +4 -11
- data/Appraisals +4 -8
- data/Gemfile +0 -2
- data/Gemfile.lock +89 -102
- data/Rakefile +0 -2
- data/acl9.gemspec +1 -2
- data/gemfiles/{rails_4.0.gemfile → rails_5.0.gemfile} +2 -4
- data/gemfiles/{rails_4.1.gemfile → rails_5.1.gemfile} +2 -4
- data/lib/acl9/controller_extensions/generators.rb +2 -2
- data/lib/acl9/model_extensions.rb +1 -1
- data/lib/acl9/version.rb +1 -1
- data/lib/generators/acl9/setup/setup_generator.rb +10 -3
- data/lib/generators/acl9/setup/templates/create_role_tables.rb +10 -1
- data/lib/generators/acl9/setup/templates/role.rb +1 -1
- data/test/controllers/acl_action_override_test.rb +4 -4
- data/test/controllers/acl_helper_method_test.rb +2 -2
- data/test/controllers/acl_ivars_test.rb +2 -2
- data/test/controllers/acl_object_hash_test.rb +1 -1
- data/test/controllers/acl_query_mixin.rb +1 -1
- data/test/controllers/acl_subject_method_test.rb +1 -1
- data/test/controllers/arguments_checking_test.rb +4 -4
- data/test/dummy/app/controllers/acl_action_override.rb +5 -5
- data/test/dummy/app/controllers/acl_boolean_method.rb +6 -6
- data/test/dummy/app/controllers/acl_ivars.rb +3 -3
- data/test/dummy/app/controllers/empty_controller.rb +1 -1
- data/test/dummy/app/models/string_object_role.rb +3 -0
- data/test/dummy/app/models/string_user.rb +3 -0
- data/test/dummy/app/models/uuid.rb +1 -1
- data/test/dummy/config/environments/test.rb +2 -2
- data/test/dummy/config/routes.rb +12 -1
- data/test/dummy/db/migrate/20141117132218_create_tables.rb +66 -16
- data/test/models/roles_test.rb +5 -1
- data/test/test_helper.rb +19 -27
- metadata +11 -25
- data/gemfiles/rails_4.2.gemfile +0 -10
- data/test/dummy/config/environments/production.rb +0 -78
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 105b1a050bdefc20d0671c4035500f9abd99f8f588b69ed3ceb3357f61ea01e1
|
|
4
|
+
data.tar.gz: 2e5f73791a47de3e9fe4148c81868d6befcda7075163813eb86877c7e21084a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9caadac85342a7885a46581b4a60fc7c83d51b23c50f85e0e2121fa2d15fd4ab0383984f5f7b48076f18dd49409ad40e5292f9d8a2615aced3088f0f004c28b0
|
|
7
|
+
data.tar.gz: edec0e425c0dfaf67f934b9a79ae37e3fad11baeedb605c04ccf0533bc59d1e3c4851f41f2d909cec855310fe69f811f0ff9aec78755ee3fb8a52c61e47a698d
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.5.0
|
data/.travis.yml
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
cache: bundler
|
|
2
2
|
language: ruby
|
|
3
3
|
rvm:
|
|
4
|
-
- 2.
|
|
5
|
-
- 2.
|
|
6
|
-
- 2.2.3
|
|
7
|
-
- 2.3.0
|
|
4
|
+
- 2.4.3
|
|
5
|
+
- 2.5.0
|
|
8
6
|
- ruby-head
|
|
9
7
|
|
|
10
8
|
gemfile:
|
|
11
|
-
- gemfiles/
|
|
12
|
-
- gemfiles/
|
|
13
|
-
- gemfiles/rails_4.2.gemfile
|
|
9
|
+
- gemfiles/rails_5.0.gemfile
|
|
10
|
+
- gemfiles/rails_5.1.gemfile
|
|
14
11
|
|
|
15
12
|
matrix:
|
|
16
13
|
fast_finish: true
|
|
17
14
|
allow_failures:
|
|
18
15
|
- rvm: ruby-head
|
|
19
|
-
|
|
20
|
-
addons:
|
|
21
|
-
code_climate:
|
|
22
|
-
repo_token: 6701faf591ff926cd9b3ea7f07c5e72984d2b1e26b33caba26114a6bfe859a11
|
data/Appraisals
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
appraise "rails-
|
|
2
|
-
gem
|
|
1
|
+
appraise "rails-5.0" do
|
|
2
|
+
gem 'rails', '~> 5.0.0'
|
|
3
3
|
end
|
|
4
4
|
|
|
5
|
-
appraise "rails-
|
|
6
|
-
gem
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
appraise "rails-4.2" do
|
|
10
|
-
gem 'rails', '~> 4.2.0'
|
|
5
|
+
appraise "rails-5.1" do
|
|
6
|
+
gem 'rails', '~> 5.1.0'
|
|
11
7
|
end
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,128 +1,118 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
acl9 (2.1.
|
|
5
|
-
rails (
|
|
4
|
+
acl9 (2.1.2)
|
|
5
|
+
rails (>= 4.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: http://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
-
|
|
11
|
-
actionpack (=
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
actioncable (5.1.5)
|
|
11
|
+
actionpack (= 5.1.5)
|
|
12
|
+
nio4r (~> 2.0)
|
|
13
|
+
websocket-driver (~> 0.6.1)
|
|
14
|
+
actionmailer (5.1.5)
|
|
15
|
+
actionpack (= 5.1.5)
|
|
16
|
+
actionview (= 5.1.5)
|
|
17
|
+
activejob (= 5.1.5)
|
|
14
18
|
mail (~> 2.5, >= 2.5.4)
|
|
15
|
-
rails-dom-testing (~>
|
|
16
|
-
actionpack (
|
|
17
|
-
actionview (=
|
|
18
|
-
activesupport (=
|
|
19
|
-
rack (~>
|
|
20
|
-
rack-test (
|
|
21
|
-
rails-dom-testing (~>
|
|
19
|
+
rails-dom-testing (~> 2.0)
|
|
20
|
+
actionpack (5.1.5)
|
|
21
|
+
actionview (= 5.1.5)
|
|
22
|
+
activesupport (= 5.1.5)
|
|
23
|
+
rack (~> 2.0)
|
|
24
|
+
rack-test (>= 0.6.3)
|
|
25
|
+
rails-dom-testing (~> 2.0)
|
|
22
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
23
|
-
actionview (
|
|
24
|
-
activesupport (=
|
|
27
|
+
actionview (5.1.5)
|
|
28
|
+
activesupport (= 5.1.5)
|
|
25
29
|
builder (~> 3.1)
|
|
26
|
-
|
|
27
|
-
rails-dom-testing (~>
|
|
28
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
|
29
|
-
activejob (
|
|
30
|
-
activesupport (=
|
|
31
|
-
globalid (>= 0.3.
|
|
32
|
-
activemodel (
|
|
33
|
-
activesupport (=
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
erubi (~> 1.4)
|
|
31
|
+
rails-dom-testing (~> 2.0)
|
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
|
33
|
+
activejob (5.1.5)
|
|
34
|
+
activesupport (= 5.1.5)
|
|
35
|
+
globalid (>= 0.3.6)
|
|
36
|
+
activemodel (5.1.5)
|
|
37
|
+
activesupport (= 5.1.5)
|
|
38
|
+
activerecord (5.1.5)
|
|
39
|
+
activemodel (= 5.1.5)
|
|
40
|
+
activesupport (= 5.1.5)
|
|
41
|
+
arel (~> 8.0)
|
|
42
|
+
activesupport (5.1.5)
|
|
43
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
40
44
|
i18n (~> 0.7)
|
|
41
|
-
json (~> 1.7, >= 1.7.7)
|
|
42
45
|
minitest (~> 5.1)
|
|
43
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
|
44
46
|
tzinfo (~> 1.1)
|
|
45
|
-
|
|
46
|
-
appraisal (2.1.0)
|
|
47
|
+
appraisal (2.2.0)
|
|
47
48
|
bundler
|
|
48
49
|
rake
|
|
49
50
|
thor (>= 0.14.0)
|
|
50
|
-
arel (
|
|
51
|
-
builder (3.2.
|
|
52
|
-
byebug (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
loofah (2.0.3)
|
|
51
|
+
arel (8.0.0)
|
|
52
|
+
builder (3.2.3)
|
|
53
|
+
byebug (10.0.0)
|
|
54
|
+
concurrent-ruby (1.0.5)
|
|
55
|
+
crass (1.0.3)
|
|
56
|
+
erubi (1.7.1)
|
|
57
|
+
globalid (0.4.1)
|
|
58
|
+
activesupport (>= 4.2.0)
|
|
59
|
+
i18n (0.9.5)
|
|
60
|
+
concurrent-ruby (~> 1.0)
|
|
61
|
+
loofah (2.2.0)
|
|
62
|
+
crass (~> 1.0.2)
|
|
63
63
|
nokogiri (>= 1.5.9)
|
|
64
|
-
mail (2.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
rails-deprecated_sanitizer (1.0.3)
|
|
92
|
-
activesupport (>= 4.2.0.alpha)
|
|
93
|
-
rails-dom-testing (1.0.7)
|
|
94
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
|
95
|
-
nokogiri (~> 1.6.0)
|
|
96
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
|
64
|
+
mail (2.7.0)
|
|
65
|
+
mini_mime (>= 0.1.1)
|
|
66
|
+
method_source (0.9.0)
|
|
67
|
+
mini_mime (1.0.0)
|
|
68
|
+
mini_portile2 (2.3.0)
|
|
69
|
+
minitest (5.11.3)
|
|
70
|
+
nio4r (2.2.0)
|
|
71
|
+
nokogiri (1.8.2)
|
|
72
|
+
mini_portile2 (~> 2.3.0)
|
|
73
|
+
rack (2.0.4)
|
|
74
|
+
rack-test (0.8.3)
|
|
75
|
+
rack (>= 1.0, < 3)
|
|
76
|
+
rails (5.1.5)
|
|
77
|
+
actioncable (= 5.1.5)
|
|
78
|
+
actionmailer (= 5.1.5)
|
|
79
|
+
actionpack (= 5.1.5)
|
|
80
|
+
actionview (= 5.1.5)
|
|
81
|
+
activejob (= 5.1.5)
|
|
82
|
+
activemodel (= 5.1.5)
|
|
83
|
+
activerecord (= 5.1.5)
|
|
84
|
+
activesupport (= 5.1.5)
|
|
85
|
+
bundler (>= 1.3.0)
|
|
86
|
+
railties (= 5.1.5)
|
|
87
|
+
sprockets-rails (>= 2.0.0)
|
|
88
|
+
rails-dom-testing (2.0.3)
|
|
89
|
+
activesupport (>= 4.2.0)
|
|
90
|
+
nokogiri (>= 1.6)
|
|
97
91
|
rails-html-sanitizer (1.0.3)
|
|
98
92
|
loofah (~> 2.0)
|
|
99
|
-
railties (
|
|
100
|
-
actionpack (=
|
|
101
|
-
activesupport (=
|
|
93
|
+
railties (5.1.5)
|
|
94
|
+
actionpack (= 5.1.5)
|
|
95
|
+
activesupport (= 5.1.5)
|
|
96
|
+
method_source
|
|
102
97
|
rake (>= 0.8.7)
|
|
103
98
|
thor (>= 0.18.1, < 2.0)
|
|
104
|
-
rake (
|
|
105
|
-
|
|
106
|
-
docile (~> 1.1.0)
|
|
107
|
-
json (~> 1.8)
|
|
108
|
-
simplecov-html (~> 0.10.0)
|
|
109
|
-
simplecov-html (0.10.0)
|
|
110
|
-
sprockets (3.5.2)
|
|
99
|
+
rake (12.3.0)
|
|
100
|
+
sprockets (3.7.1)
|
|
111
101
|
concurrent-ruby (~> 1.0)
|
|
112
102
|
rack (> 1, < 3)
|
|
113
|
-
sprockets-rails (3.
|
|
103
|
+
sprockets-rails (3.2.1)
|
|
114
104
|
actionpack (>= 4.0)
|
|
115
105
|
activesupport (>= 4.0)
|
|
116
106
|
sprockets (>= 3.0.0)
|
|
117
|
-
sqlite3 (1.3.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
thor (0.19.1)
|
|
122
|
-
thread_safe (0.3.5)
|
|
123
|
-
tzinfo (1.2.2)
|
|
107
|
+
sqlite3 (1.3.13)
|
|
108
|
+
thor (0.20.0)
|
|
109
|
+
thread_safe (0.3.6)
|
|
110
|
+
tzinfo (1.2.5)
|
|
124
111
|
thread_safe (~> 0.1)
|
|
125
|
-
|
|
112
|
+
websocket-driver (0.6.5)
|
|
113
|
+
websocket-extensions (>= 0.1.0)
|
|
114
|
+
websocket-extensions (0.1.3)
|
|
115
|
+
yard (0.9.12)
|
|
126
116
|
|
|
127
117
|
PLATFORMS
|
|
128
118
|
ruby
|
|
@@ -131,11 +121,8 @@ DEPENDENCIES
|
|
|
131
121
|
acl9!
|
|
132
122
|
appraisal
|
|
133
123
|
byebug
|
|
134
|
-
codeclimate-test-reporter
|
|
135
|
-
minitap
|
|
136
124
|
sqlite3
|
|
137
|
-
tapout
|
|
138
125
|
yard
|
|
139
126
|
|
|
140
127
|
BUNDLED WITH
|
|
141
|
-
1.
|
|
128
|
+
1.16.1
|
data/Rakefile
CHANGED
data/acl9.gemspec
CHANGED
|
@@ -20,9 +20,8 @@ Gem::Specification.new do |s|
|
|
|
20
20
|
|
|
21
21
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
22
22
|
|
|
23
|
-
s.add_dependency "rails", '~>
|
|
23
|
+
s.add_dependency "rails", '~> 5.0'
|
|
24
24
|
|
|
25
|
-
s.add_development_dependency "codeclimate-test-reporter"
|
|
26
25
|
s.add_development_dependency "yard"
|
|
27
26
|
s.add_development_dependency 'sqlite3'
|
|
28
27
|
end
|
|
@@ -93,7 +93,7 @@ module Acl9
|
|
|
93
93
|
def install_on(controller_class, options)
|
|
94
94
|
super
|
|
95
95
|
|
|
96
|
-
controller_class.send(:
|
|
96
|
+
controller_class.send(:before_action, options, &self.to_proc)
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
def to_proc
|
|
@@ -124,7 +124,7 @@ module Acl9
|
|
|
124
124
|
def install_on(controller_class, options)
|
|
125
125
|
super
|
|
126
126
|
_add_method(controller_class)
|
|
127
|
-
controller_class.send(:
|
|
127
|
+
controller_class.send(:before_action, @method_name, options)
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
protected
|
data/lib/acl9/version.rb
CHANGED
|
@@ -10,9 +10,8 @@ module Acl9
|
|
|
10
10
|
argument :arg_role, type: :string, default: 'role', banner: "role"
|
|
11
11
|
argument :arg_objects, type: :array, default: [], banner: "objects..."
|
|
12
12
|
|
|
13
|
-
def
|
|
14
|
-
|
|
15
|
-
template "create_role_tables.rb", "db/migrate/#{next_migration_number}_create_#{role_name}_tables.rb"
|
|
13
|
+
def create_migration_file
|
|
14
|
+
migration_template "create_role_tables.rb", File.join(db_migrate_path, "create_#{role_name}_tables.rb")
|
|
16
15
|
end
|
|
17
16
|
|
|
18
17
|
def create_models
|
|
@@ -56,6 +55,14 @@ module Acl9
|
|
|
56
55
|
role_name.classify
|
|
57
56
|
end
|
|
58
57
|
|
|
58
|
+
def model_base_name
|
|
59
|
+
r5? ? ApplicationRecord : ActiveRecord::Base
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def r5?
|
|
63
|
+
Rails.gem_version >= Gem::Version.new(5)
|
|
64
|
+
end
|
|
65
|
+
|
|
59
66
|
def habtm_table
|
|
60
67
|
Acl9.config.default_join_table_name || [ subject_name, role_name ].map(&:pluralize).sort.join('_')
|
|
61
68
|
end
|
|
@@ -1,22 +1,31 @@
|
|
|
1
|
-
class Create<%= role_class_name %>Tables < ActiveRecord::Migration
|
|
1
|
+
class Create<%= role_class_name %>Tables < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
|
2
2
|
def change
|
|
3
3
|
create_table :<%= role_table_name %> do |t|
|
|
4
4
|
t.string :name, null: false
|
|
5
|
+
<% if r5? %>
|
|
6
|
+
t.references :authorizable, polymorphic: true
|
|
7
|
+
<% else %>
|
|
5
8
|
t.string :authorizable_type, null: true
|
|
6
9
|
t.integer :authorizable_id, null: true
|
|
10
|
+
<% end %>
|
|
7
11
|
t.boolean :system, default: false, null: false
|
|
8
12
|
t.timestamps null: false
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
add_index :<%= role_table_name %>, :name
|
|
16
|
+
|
|
17
|
+
<% unless r5? %>
|
|
12
18
|
add_index :<%= role_table_name %>, [:authorizable_type, :authorizable_id]
|
|
19
|
+
<% end -%>
|
|
13
20
|
|
|
14
21
|
create_table :<%= habtm_table %>, id: false do |t|
|
|
15
22
|
t.references :<%= subject_name %>, null: false
|
|
16
23
|
t.references :<%= role_name %>, null: false
|
|
17
24
|
end
|
|
18
25
|
|
|
26
|
+
<% unless r5? %>
|
|
19
27
|
add_index :<%= habtm_table %>, :<%= subject_name %>_id
|
|
20
28
|
add_index :<%= habtm_table %>, :<%= role_name %>_id
|
|
29
|
+
<% end %>
|
|
21
30
|
end
|
|
22
31
|
end
|
|
@@ -2,23 +2,23 @@ require 'test_helper'
|
|
|
2
2
|
|
|
3
3
|
class ACLActionOverrideTest < ActionController::TestCase
|
|
4
4
|
test "anon can index" do
|
|
5
|
-
assert get :check_allow, :
|
|
5
|
+
assert get :check_allow, params: { _action: :index }
|
|
6
6
|
assert_response :ok
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
test "anon can't show" do
|
|
10
|
-
assert get :check_allow, :
|
|
10
|
+
assert get :check_allow, params: { _action: :show }
|
|
11
11
|
assert_response :unauthorized
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
test "normal user can't edit" do
|
|
15
|
-
assert get :check_allow_with_foo, :
|
|
15
|
+
assert get :check_allow_with_foo, params: { _action: :edit, user_id: User.create.id }
|
|
16
16
|
assert_response :unauthorized
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
test "foo owner can edit" do
|
|
20
20
|
assert ( user = User.create ).has_role! :owner, Foo.first_or_create
|
|
21
|
-
assert get :check_allow_with_foo, :
|
|
21
|
+
assert get :check_allow_with_foo, params: { _action: :edit, user_id: user.id }
|
|
22
22
|
assert_response :ok
|
|
23
23
|
end
|
|
24
24
|
end
|
|
@@ -8,14 +8,14 @@ class ACLHelperMethodTest < ActionController::TestCase
|
|
|
8
8
|
test "foo owner allowed" do
|
|
9
9
|
assert @user.has_role! :owner, Foo.first_or_create
|
|
10
10
|
|
|
11
|
-
assert get :allow, :user_id
|
|
11
|
+
assert get :allow, params: { user_id: @user.id }
|
|
12
12
|
assert_select 'div', 'OK'
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
test "another user denied" do
|
|
16
16
|
assert @user.has_role! :owner
|
|
17
17
|
|
|
18
|
-
assert get :allow, :user_id
|
|
18
|
+
assert get :allow, params: { user_id: @user.id }
|
|
19
19
|
assert_select 'div', 'OK'
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -3,13 +3,13 @@ require 'test_helper'
|
|
|
3
3
|
class ACLIvarsTest < ActionController::TestCase
|
|
4
4
|
test "owner of foo destroys" do
|
|
5
5
|
assert ( user = User.create ).has_role! :owner, Bar
|
|
6
|
-
assert delete :destroy, :id
|
|
6
|
+
assert delete :destroy, params: { id: 1, user_id: user.id }
|
|
7
7
|
assert_response :ok
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
test "bartender at Foo destroys" do
|
|
11
11
|
assert ( user = User.create ).has_role! :bartender, Foo
|
|
12
|
-
assert delete :destroy, :id
|
|
12
|
+
assert delete :destroy, params: { id: 1, user_id: user.id }
|
|
13
13
|
assert_response :ok
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -3,7 +3,7 @@ require 'test_helper'
|
|
|
3
3
|
class ACLSubjectMethodTest < ActionController::TestCase
|
|
4
4
|
test "allow the only user to index" do
|
|
5
5
|
assert ( user = User.create ).has_role! :the_only_one
|
|
6
|
-
assert get :index, :user_id
|
|
6
|
+
assert get :index, params: { user_id: user.id }
|
|
7
7
|
assert_response :ok
|
|
8
8
|
end
|
|
9
9
|
|
|
@@ -25,18 +25,18 @@ class ArgumentsCheckingTest < ActionController::TestCase
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
test "raise ArgumentError with :
|
|
28
|
+
test "raise ArgumentError with helper: true and no method name" do
|
|
29
29
|
assert_raise ArgumentError do
|
|
30
30
|
class FailureController < ApplicationController
|
|
31
|
-
access_control :
|
|
31
|
+
access_control helper: true do end
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
test "raise ArgumentError with :
|
|
36
|
+
test "raise ArgumentError with helper: :method and a method name" do
|
|
37
37
|
assert_raise ArgumentError do
|
|
38
38
|
class FailureController < ApplicationController
|
|
39
|
-
access_control :meth, :
|
|
39
|
+
access_control :meth, helper: :another_meth do end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
class ACLActionOverride < ApplicationController
|
|
2
|
-
access_control :allowed?, :
|
|
3
|
-
allow all, :
|
|
4
|
-
deny all, :
|
|
5
|
-
allow :owner, :
|
|
2
|
+
access_control :allowed?, filter: false do
|
|
3
|
+
allow all, to: :index
|
|
4
|
+
deny all, to: :show
|
|
5
|
+
allow :owner, of: :foo, to: :edit
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def check_allow
|
|
@@ -10,6 +10,6 @@ class ACLActionOverride < ApplicationController
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def check_allow_with_foo
|
|
13
|
-
head allowed?(params[:_action], :
|
|
13
|
+
head allowed?(params[:_action], foo: Foo.first) ? :ok : :unauthorized
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
class ACLBooleanMethod < EmptyController
|
|
2
|
-
access_control :acl, :
|
|
3
|
-
allow all, :
|
|
4
|
-
allow :admin,
|
|
5
|
-
allow all,
|
|
6
|
-
allow all,
|
|
2
|
+
access_control :acl, filter: false do
|
|
3
|
+
allow all, to: [:index, :show], if: :true_meth
|
|
4
|
+
allow :admin, unless: :false_meth
|
|
5
|
+
allow all, if: :false_meth
|
|
6
|
+
allow all, unless: :true_meth
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
before_action :check_acl
|
|
10
10
|
|
|
11
11
|
def check_acl
|
|
12
12
|
if self.acl
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
class ACLIvars < EmptyController
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
before_action :set_ivars
|
|
4
4
|
|
|
5
5
|
access_control do
|
|
6
6
|
action :destroy do
|
|
7
|
-
allow :owner, :
|
|
8
|
-
allow :bartender, :
|
|
7
|
+
allow :owner, of: :foo
|
|
8
|
+
allow :bartender, at: Foo
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
11
|
|
|
@@ -13,8 +13,8 @@ Dummy::Application.configure do
|
|
|
13
13
|
config.eager_load = false
|
|
14
14
|
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
|
16
|
-
config.
|
|
17
|
-
config.
|
|
16
|
+
config.public_file_server.enabled = true
|
|
17
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
|
18
18
|
|
|
19
19
|
# Show full error reports and disable caching.
|
|
20
20
|
config.consider_all_requests_local = true
|
data/test/dummy/config/routes.rb
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
Dummy::Application.routes.draw do
|
|
2
|
-
|
|
2
|
+
resources :acl_action_override do
|
|
3
|
+
collection do
|
|
4
|
+
get :check_allow_with_foo
|
|
5
|
+
get :check_allow
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
resources :acl_boolean_method, :acl_block, :acl_ivars, :acl_method, :acl_method2, :acl_subject_method, :acl_arguments
|
|
10
|
+
|
|
11
|
+
get :acl_helper_method, to: "acl_helper_method#allow"
|
|
12
|
+
get :acl_objects_hash, to: "acl_objects_hash#allow"
|
|
13
|
+
|
|
3
14
|
end
|
|
@@ -1,22 +1,37 @@
|
|
|
1
|
-
class CreateTables < ActiveRecord::Migration
|
|
1
|
+
class CreateTables < ActiveRecord::Migration[ActiveRecord::Migration.current_version]
|
|
2
|
+
def self.r5?
|
|
3
|
+
Rails.gem_version >= Gem::Version.new(5)
|
|
4
|
+
end
|
|
5
|
+
def r5?
|
|
6
|
+
self.class.r5?
|
|
7
|
+
end
|
|
8
|
+
|
|
2
9
|
def change
|
|
3
10
|
create_table :roles do |t|
|
|
4
11
|
t.string :name, :limit => 40
|
|
5
12
|
t.boolean :system
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
if r5?
|
|
14
|
+
t.references :authorizable, polymorphic: true
|
|
15
|
+
else
|
|
16
|
+
t.string :authorizable_type, :limit => 40
|
|
17
|
+
t.integer :authorizable_id
|
|
18
|
+
end
|
|
8
19
|
t.timestamps null: false
|
|
9
20
|
end
|
|
10
21
|
|
|
11
|
-
|
|
22
|
+
unless r5?
|
|
23
|
+
add_index :roles, [:authorizable_type, :authorizable_id]
|
|
24
|
+
end
|
|
12
25
|
|
|
13
26
|
create_table :roles_users, id: false do |t|
|
|
14
27
|
t.references :user
|
|
15
28
|
t.references :role
|
|
16
29
|
end
|
|
17
30
|
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
unless r5?
|
|
32
|
+
add_index :roles_users, :user_id
|
|
33
|
+
add_index :roles_users, :role_id
|
|
34
|
+
end
|
|
20
35
|
|
|
21
36
|
create_table :users do |t|
|
|
22
37
|
t.string :name
|
|
@@ -39,6 +54,25 @@ class CreateTables < ActiveRecord::Migration
|
|
|
39
54
|
t.timestamps null: false
|
|
40
55
|
end
|
|
41
56
|
|
|
57
|
+
create_table :string_object_roles do |t|
|
|
58
|
+
t.string :name
|
|
59
|
+
t.boolean :system
|
|
60
|
+
t.string :authorizable_type
|
|
61
|
+
t.string :authorizable_id
|
|
62
|
+
t.timestamps null: false
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
create_table :string_object_roles_string_users, id: false do |t|
|
|
66
|
+
t.references :string_user, index: { name: "susor" }
|
|
67
|
+
t.references :string_object_role, index: { name: "sorsu" }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
create_table :string_users do |t|
|
|
71
|
+
t.string :name
|
|
72
|
+
t.timestamps null: false
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
|
|
42
76
|
create_table :accounts do |t|
|
|
43
77
|
t.string :name
|
|
44
78
|
t.timestamps null: false
|
|
@@ -47,20 +81,28 @@ class CreateTables < ActiveRecord::Migration
|
|
|
47
81
|
create_table :accesses do |t|
|
|
48
82
|
t.string :name
|
|
49
83
|
t.boolean :system
|
|
50
|
-
|
|
51
|
-
|
|
84
|
+
if r5?
|
|
85
|
+
t.references :authorizable, polymorphic: true
|
|
86
|
+
else
|
|
87
|
+
t.string :authorizable_type, :limit => 40
|
|
88
|
+
t.integer :authorizable_id
|
|
89
|
+
end
|
|
52
90
|
t.timestamps null: false
|
|
53
91
|
end
|
|
54
92
|
|
|
55
|
-
|
|
93
|
+
unless r5?
|
|
94
|
+
add_index :accesses, [:authorizable_type, :authorizable_id]
|
|
95
|
+
end
|
|
56
96
|
|
|
57
97
|
create_table :accesses_accounts, id: false do |t|
|
|
58
98
|
t.references :account
|
|
59
99
|
t.references :access
|
|
60
100
|
end
|
|
61
101
|
|
|
62
|
-
|
|
63
|
-
|
|
102
|
+
unless r5?
|
|
103
|
+
add_index :accesses_accounts, :access_id
|
|
104
|
+
add_index :accesses_accounts, :account_id
|
|
105
|
+
end
|
|
64
106
|
|
|
65
107
|
create_table :foo_bars do |t|
|
|
66
108
|
t.string :name
|
|
@@ -71,20 +113,28 @@ class CreateTables < ActiveRecord::Migration
|
|
|
71
113
|
create_table :other_roles do |t|
|
|
72
114
|
t.string :name, :limit => 40
|
|
73
115
|
t.boolean :system
|
|
74
|
-
|
|
75
|
-
|
|
116
|
+
if r5?
|
|
117
|
+
t.references :authorizable, polymorphic: true
|
|
118
|
+
else
|
|
119
|
+
t.string :authorizable_type, :limit => 40
|
|
120
|
+
t.integer :authorizable_id
|
|
121
|
+
end
|
|
76
122
|
t.timestamps null: false
|
|
77
123
|
end
|
|
78
124
|
|
|
79
|
-
|
|
125
|
+
unless r5?
|
|
126
|
+
add_index :other_roles, [:authorizable_type, :authorizable_id]
|
|
127
|
+
end
|
|
80
128
|
|
|
81
129
|
create_table :other_roles_users, id: false do |t|
|
|
82
130
|
t.references :user
|
|
83
131
|
t.references :role
|
|
84
132
|
end
|
|
85
133
|
|
|
86
|
-
|
|
87
|
-
|
|
134
|
+
unless r5?
|
|
135
|
+
add_index :other_roles_users, :user_id
|
|
136
|
+
add_index :other_roles_users, :role_id
|
|
137
|
+
end
|
|
88
138
|
|
|
89
139
|
create_table :other_users do |t|
|
|
90
140
|
t.string :name
|
data/test/models/roles_test.rb
CHANGED
|
@@ -243,12 +243,16 @@ class RolesTest < ActiveSupport::TestCase
|
|
|
243
243
|
end
|
|
244
244
|
|
|
245
245
|
test "should be able to get users that have a role on a authorized object with text primary key" do
|
|
246
|
+
|
|
247
|
+
assert @user = StringUser.create
|
|
248
|
+
assert @user2 = StringUser.create
|
|
249
|
+
|
|
246
250
|
assert uuid = Uuid.create( id: "C41642EE-2780-0001-189F-17F3101B26E0" )
|
|
247
251
|
|
|
248
252
|
assert @user.has_role! :owner, uuid
|
|
249
253
|
assert @user2.has_role! :owner, uuid
|
|
250
254
|
|
|
251
|
-
assert_equal 2, uuid.
|
|
255
|
+
assert_equal 2, uuid.string_users.count
|
|
252
256
|
end
|
|
253
257
|
|
|
254
258
|
test "should accept :symbols as role names" do
|
data/test/test_helper.rb
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
require "codeclimate-test-reporter"
|
|
2
|
-
CodeClimate::TestReporter.start
|
|
3
|
-
|
|
4
1
|
ENV["RAILS_ENV"] = "test"
|
|
5
2
|
|
|
6
3
|
require 'minitest/autorun'
|
|
7
|
-
require 'minitap'
|
|
8
|
-
|
|
9
|
-
if defined? Minitap
|
|
10
|
-
Minitest.reporter = Minitap::TapY
|
|
11
|
-
else
|
|
12
|
-
MiniTest::Unit.runner = MiniTest::TapY.new
|
|
13
|
-
end
|
|
14
4
|
|
|
15
5
|
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
|
16
6
|
require "rails/test_help"
|
|
@@ -20,27 +10,29 @@ Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
|
|
|
20
10
|
ActiveRecord::Migration.verbose = false
|
|
21
11
|
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
|
22
12
|
|
|
13
|
+
$VERBOSE = nil
|
|
14
|
+
|
|
23
15
|
class ActionController::TestCase
|
|
24
16
|
class << self
|
|
25
|
-
def test_allowed method, action, params=
|
|
26
|
-
test "allowed #{
|
|
17
|
+
def test_allowed method, action, params={}
|
|
18
|
+
test "allowed #{method} #{action}" do
|
|
27
19
|
if block_given?
|
|
28
20
|
yield user = User.create
|
|
29
|
-
|
|
21
|
+
params.merge! user_id: user.id
|
|
30
22
|
end
|
|
31
|
-
assert send( method, action, params
|
|
23
|
+
assert send( method, action, params: params )
|
|
32
24
|
assert_response :ok
|
|
33
25
|
end
|
|
34
26
|
end
|
|
35
27
|
|
|
36
|
-
def test_denied method, action, params=
|
|
37
|
-
test "denied #{
|
|
28
|
+
def test_denied method, action, params={}
|
|
29
|
+
test "denied #{method} #{action}" do
|
|
38
30
|
assert_raises Acl9::AccessDenied do
|
|
39
31
|
if block_given?
|
|
40
32
|
yield user = User.create
|
|
41
|
-
|
|
33
|
+
params.merge! user_id: user.id
|
|
42
34
|
end
|
|
43
|
-
assert send( method, action, params
|
|
35
|
+
assert send( method, action, params: params )
|
|
44
36
|
end
|
|
45
37
|
end
|
|
46
38
|
end
|
|
@@ -57,21 +49,21 @@ module BaseTests
|
|
|
57
49
|
def self.included(klass)
|
|
58
50
|
klass.class_eval do
|
|
59
51
|
test_allowed :get, :index
|
|
60
|
-
test_allowed :get, :show, :
|
|
52
|
+
test_allowed :get, :show, id: 1
|
|
61
53
|
test_denied :get, :new
|
|
62
|
-
test_denied :get, :edit, :
|
|
54
|
+
test_denied :get, :edit, id: 1
|
|
63
55
|
test_denied :post, :create
|
|
64
|
-
test_denied :put, :update, :
|
|
65
|
-
test_denied :patch, :update, :
|
|
66
|
-
test_denied :delete, :destroy, :
|
|
56
|
+
test_denied :put, :update, id: 1
|
|
57
|
+
test_denied :patch, :update, id: 1
|
|
58
|
+
test_denied :delete, :destroy, id: 1
|
|
67
59
|
|
|
68
60
|
admin = -> (user) { user.has_role! :admin }
|
|
69
61
|
test_allowed :get, :new, &admin
|
|
70
|
-
test_allowed :get, :edit, :
|
|
62
|
+
test_allowed :get, :edit, id: 1, &admin
|
|
71
63
|
test_allowed :post, :create, &admin
|
|
72
|
-
test_allowed :put, :update, :
|
|
73
|
-
test_allowed :patch, :update, :
|
|
74
|
-
test_allowed :delete, :destroy, :
|
|
64
|
+
test_allowed :put, :update, id: 1, &admin
|
|
65
|
+
test_allowed :patch, :update, id: 1, &admin
|
|
66
|
+
test_allowed :delete, :destroy, id: 1, &admin
|
|
75
67
|
end
|
|
76
68
|
end
|
|
77
69
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acl9
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- oleg dashevskii
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2018-03-14 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -17,28 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - "~>"
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '
|
|
20
|
+
version: '5.0'
|
|
21
21
|
type: :runtime
|
|
22
22
|
prerelease: false
|
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
|
24
24
|
requirements:
|
|
25
25
|
- - "~>"
|
|
26
26
|
- !ruby/object:Gem::Version
|
|
27
|
-
version: '
|
|
28
|
-
- !ruby/object:Gem::Dependency
|
|
29
|
-
name: codeclimate-test-reporter
|
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
|
31
|
-
requirements:
|
|
32
|
-
- - ">="
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: '0'
|
|
35
|
-
type: :development
|
|
36
|
-
prerelease: false
|
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - ">="
|
|
40
|
-
- !ruby/object:Gem::Version
|
|
41
|
-
version: '0'
|
|
27
|
+
version: '5.0'
|
|
42
28
|
- !ruby/object:Gem::Dependency
|
|
43
29
|
name: yard
|
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -106,9 +92,8 @@ files:
|
|
|
106
92
|
- bin/yard
|
|
107
93
|
- bin/yardoc
|
|
108
94
|
- bin/yri
|
|
109
|
-
- gemfiles/
|
|
110
|
-
- gemfiles/
|
|
111
|
-
- gemfiles/rails_4.2.gemfile
|
|
95
|
+
- gemfiles/rails_5.0.gemfile
|
|
96
|
+
- gemfiles/rails_5.1.gemfile
|
|
112
97
|
- lib/acl9.rb
|
|
113
98
|
- lib/acl9/controller_extensions.rb
|
|
114
99
|
- lib/acl9/controller_extensions/dsl_base.rb
|
|
@@ -178,6 +163,8 @@ files:
|
|
|
178
163
|
- test/dummy/app/models/other/role.rb
|
|
179
164
|
- test/dummy/app/models/other/user.rb
|
|
180
165
|
- test/dummy/app/models/role.rb
|
|
166
|
+
- test/dummy/app/models/string_object_role.rb
|
|
167
|
+
- test/dummy/app/models/string_user.rb
|
|
181
168
|
- test/dummy/app/models/user.rb
|
|
182
169
|
- test/dummy/app/models/uuid.rb
|
|
183
170
|
- test/dummy/config.ru
|
|
@@ -186,7 +173,6 @@ files:
|
|
|
186
173
|
- test/dummy/config/database.yml
|
|
187
174
|
- test/dummy/config/environment.rb
|
|
188
175
|
- test/dummy/config/environments/development.rb
|
|
189
|
-
- test/dummy/config/environments/production.rb
|
|
190
176
|
- test/dummy/config/environments/test.rb
|
|
191
177
|
- test/dummy/config/initializers/assets.rb
|
|
192
178
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
@@ -229,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
229
215
|
version: '0'
|
|
230
216
|
requirements: []
|
|
231
217
|
rubyforge_project:
|
|
232
|
-
rubygems_version: 2.
|
|
218
|
+
rubygems_version: 2.7.3
|
|
233
219
|
signing_key:
|
|
234
220
|
specification_version: 4
|
|
235
221
|
summary: Role-based authorization system for Rails with a concise DSL for securing
|
|
@@ -290,6 +276,8 @@ test_files:
|
|
|
290
276
|
- test/dummy/app/models/other/role.rb
|
|
291
277
|
- test/dummy/app/models/other/user.rb
|
|
292
278
|
- test/dummy/app/models/role.rb
|
|
279
|
+
- test/dummy/app/models/string_object_role.rb
|
|
280
|
+
- test/dummy/app/models/string_user.rb
|
|
293
281
|
- test/dummy/app/models/user.rb
|
|
294
282
|
- test/dummy/app/models/uuid.rb
|
|
295
283
|
- test/dummy/config.ru
|
|
@@ -298,7 +286,6 @@ test_files:
|
|
|
298
286
|
- test/dummy/config/database.yml
|
|
299
287
|
- test/dummy/config/environment.rb
|
|
300
288
|
- test/dummy/config/environments/development.rb
|
|
301
|
-
- test/dummy/config/environments/production.rb
|
|
302
289
|
- test/dummy/config/environments/test.rb
|
|
303
290
|
- test/dummy/config/initializers/assets.rb
|
|
304
291
|
- test/dummy/config/initializers/backtrace_silencers.rb
|
|
@@ -320,4 +307,3 @@ test_files:
|
|
|
320
307
|
- test/models/users_roles_and_subjects_with_namespaced_class_names_test.rb
|
|
321
308
|
- test/test_helper.rb
|
|
322
309
|
- test/version_test.rb
|
|
323
|
-
has_rdoc:
|
data/gemfiles/rails_4.2.gemfile
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
|
-
|
|
4
|
-
# Code is not reloaded between requests.
|
|
5
|
-
config.cache_classes = true
|
|
6
|
-
|
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
|
8
|
-
# your application in memory, allowing both threaded web servers
|
|
9
|
-
# and those relying on copy on write to perform better.
|
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
|
11
|
-
config.eager_load = true
|
|
12
|
-
|
|
13
|
-
# Full error reports are disabled and caching is turned on.
|
|
14
|
-
config.consider_all_requests_local = false
|
|
15
|
-
config.action_controller.perform_caching = true
|
|
16
|
-
|
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
|
20
|
-
# config.action_dispatch.rack_cache = true
|
|
21
|
-
|
|
22
|
-
# Disable Rails's static asset server (Apache or nginx will already do this).
|
|
23
|
-
config.serve_static_files = false
|
|
24
|
-
|
|
25
|
-
# Compress JavaScripts and CSS.
|
|
26
|
-
config.assets.js_compressor = :uglifier
|
|
27
|
-
# config.assets.css_compressor = :sass
|
|
28
|
-
|
|
29
|
-
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
|
30
|
-
config.assets.compile = false
|
|
31
|
-
|
|
32
|
-
# Generate digests for assets URLs.
|
|
33
|
-
config.assets.digest = true
|
|
34
|
-
|
|
35
|
-
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
|
36
|
-
|
|
37
|
-
# Specifies the header that your server uses for sending files.
|
|
38
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
39
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
40
|
-
|
|
41
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
42
|
-
# config.force_ssl = true
|
|
43
|
-
|
|
44
|
-
# Set to :debug to see everything in the log.
|
|
45
|
-
config.log_level = :info
|
|
46
|
-
|
|
47
|
-
# Prepend all log lines with the following tags.
|
|
48
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
|
49
|
-
|
|
50
|
-
# Use a different logger for distributed setups.
|
|
51
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
52
|
-
|
|
53
|
-
# Use a different cache store in production.
|
|
54
|
-
# config.cache_store = :mem_cache_store
|
|
55
|
-
|
|
56
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
57
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
|
58
|
-
|
|
59
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
|
60
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
61
|
-
# config.action_mailer.raise_delivery_errors = false
|
|
62
|
-
|
|
63
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
64
|
-
# the I18n.default_locale when a translation cannot be found).
|
|
65
|
-
config.i18n.fallbacks = true
|
|
66
|
-
|
|
67
|
-
# Send deprecation notices to registered listeners.
|
|
68
|
-
config.active_support.deprecation = :notify
|
|
69
|
-
|
|
70
|
-
# Disable automatic flushing of the log to improve performance.
|
|
71
|
-
# config.autoflush_log = false
|
|
72
|
-
|
|
73
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
74
|
-
config.log_formatter = ::Logger::Formatter.new
|
|
75
|
-
|
|
76
|
-
# Do not dump schema after migrations.
|
|
77
|
-
config.active_record.dump_schema_after_migration = false
|
|
78
|
-
end
|