rails-acu 1.2.1 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5e4832b86ac7f688e4f9a710bc490471b33dc8e
4
- data.tar.gz: fd9a65c185a13acf5e40b03037aedf246cc9229c
3
+ metadata.gz: addca3a90dcfe917856a671ff499f15acf1e7c38
4
+ data.tar.gz: 9d3eaf5dc3196adb7e1cf99d53ca363caace2ddc
5
5
  SHA512:
6
- metadata.gz: 0a15a8d3858a25f9cc9e121b736632c8cc2d16f5ffd68ac107b4f66d3720242a69f076f6c48ded26f276ceb56e0d4f6cef16aed6d2706341dbe657d22e780457
7
- data.tar.gz: 57d389156e2682b7ba1959842ba943f5dd2dcec89cb5b5679c4ca821cdcb8947b327196904d8bec72e69d862caa3d130bbf8e18aba51329e1c587644fb914d19
6
+ metadata.gz: '069d76042fbf8fd75a26e36e8da8fb3e05d477af281e5e9a457afeea10a1c0e4a61b0f4cd781997e9d675ba851b3ec19f202a052103751c3c0df13aba30b63e9'
7
+ data.tar.gz: 3eb795d9641a9c1f37cec2a3687731baf009fb5268b96a200cb7e061400d728ef8dc8b2203b723b6aff7be6ebb38059d09c8d7ab9d881b2549fcb5c832d5b734
data/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- rails-acu (1.2.1)
10
+ rails-acu (1.3.0)
11
11
  rails (~> 5.0.0, >= 5.0.0)
12
12
 
13
13
  GEM
data/README.md CHANGED
@@ -124,10 +124,6 @@ One of the files that `acu:install` command will generate is `acu_setup.rb` whic
124
124
 
125
125
  ```ruby
126
126
  Acu.setup do |config|
127
- # name it to the Base Application Controller that your project
128
- # is going to use as a base of all of your controllers.
129
- config.base_controller = :ApplicationController
130
-
131
127
  # to tighten the security this is enabled by default
132
128
  # i.e if it checked to be true, then if a request didn't match to any of rules, it will get passed through
133
129
  # otherwise the requests which don't fit into any of rules, the request is denied by default
@@ -159,7 +155,6 @@ Here are the details of the configurations:
159
155
 
160
156
  | Name | Default | Description |
161
157
  | ----- |-------| ------ |
162
- | base_controller | `:ApplicationController` | In order that ACU gem to work it will attach some utilities to the base controller of all controllers, so if your base controller's name is something else change it. |
163
158
  | allow_by_default | `false` | Set it `true` if you want to grant access to requests that doesn't fit to any rules you have defined (**Warning:** please be advised, setting it `true` may cause a security hole in your website if you don't cover the rules perfectly!). |
164
159
  | audit_log_file | | The audit log file, useful for rules debugging! |
165
160
  | use_cache | `false` | ACU can utilize the `Rails.cache` to make the rules matching much faster by caching them, but if caching is enabled and you change the please make user you have cleared the ACU caches by `Acu::Monitor.clear_cache`. |
data/lib/acu/configs.rb CHANGED
@@ -1,9 +1,6 @@
1
1
  module Acu
2
2
  module Configs
3
3
 
4
- mattr_accessor :base_controller
5
- @@base_controller = 'ApplicationController'
6
-
7
4
  mattr_accessor :allow_by_default
8
5
  @@allow_by_default = false
9
6
 
data/lib/acu/injectors.rb CHANGED
@@ -5,7 +5,7 @@ module Acu
5
5
  class << self
6
6
 
7
7
  ActiveSupport::Notifications.subscribe "start_processing.action_controller" do |**args|
8
- eval((Acu::Configs.get :base_controller).to_s).class_eval do
8
+ eval(args[:controller]).class_eval do
9
9
  before_action { Monitor::gaurd }
10
10
  end
11
11
  end
data/lib/acu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Acu
2
- VERSION = '1.2.1'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -1,8 +1,4 @@
1
1
  Acu.setup do |config|
2
- # name it to the Base Application Controller that your project
3
- # is going to use as a base of all of your controllers.
4
- config.base_controller = :ApplicationController
5
-
6
2
  # to tighten the security this is enabled by default
7
3
  # i.e if it checked to be true, then if a request didn't match to any of rules, it will get passed through
8
4
  # otherwise the requests which don't fit into any of rules, the request is denied by default
@@ -1,8 +1,4 @@
1
1
  Acu.setup do |config|
2
- # name it to the Base Application Controller that your project
3
- # is going to use as a base of all of your controllers.
4
- config.base_controller = :ApplicationController
5
-
6
2
  # to tighten the security this is enabled by default
7
3
  # i.e if it checked to be true, then if a request didn't match to any of rules, it will get passed through
8
4
  # otherwise the requests which don't fit into any of rules, we be denied by default
@@ -7,7 +7,6 @@ RSpec.describe Admin::ManageController, type: :controller do
7
7
  Acu::Rules.reset
8
8
  # reset configs
9
9
  Acu.setup do |config|
10
- config.base_controller = :ApplicationController
11
10
  config.allow_by_default = false
12
11
  config.audit_log_file = '/tmp/acu-rspec.log'
13
12
  end
@@ -7,7 +7,6 @@ RSpec.describe HomeController, type: :controller do
7
7
  Acu::Rules.reset
8
8
  # reset configs
9
9
  Acu.setup do |config|
10
- config.base_controller = :ApplicationController
11
10
  config.allow_by_default = false
12
11
  config.audit_log_file = '/tmp/acu-rspec.log'
13
12
  config.use_cache = false
@@ -24,11 +23,6 @@ RSpec.describe HomeController, type: :controller do
24
23
  end
25
24
 
26
25
  context 'Acu::Config' do
27
- it '.base_controller' do
28
- setup base_controller: ":FooBarController"
29
- expect {get :index}.to raise_error(NameError)
30
- end
31
-
32
26
  it '.allow_by_default = false' do
33
27
  expect {get :index}.to raise_error(Acu::Errors::AccessDenied)
34
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-acu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dariush Hasanpour
@@ -61,7 +61,6 @@ files:
61
61
  - lib/generators/templates/rules.rb
62
62
  - lib/generators/templates/setup.rb
63
63
  - lib/rails-acu.rb
64
- - rails-acu-1.2.0.gem
65
64
  - rails-acu.gemspec
66
65
  - spec/dummy/Rakefile
67
66
  - spec/dummy/app/assets/config/manifest.js
data/rails-acu-1.2.0.gem DELETED
Binary file