rails-acu 3.0.3 → 3.0.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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.project +0 -0
- data/.rspec +0 -0
- data/.travis.yml +2 -2
- data/Gemfile +3 -0
- data/Gemfile.lock +6 -5
- data/MIT-LICENSE +0 -0
- data/README.md +8 -0
- data/Rakefile +0 -0
- data/lib/acu/configs.rb +0 -0
- data/lib/acu/engine.rb +0 -0
- data/lib/acu/errors.rb +0 -0
- data/lib/acu/helpers/helpers.rb +7 -1
- data/lib/acu/listeners.rb +0 -0
- data/lib/acu/monitor.rb +0 -0
- data/lib/acu/rules.rb +17 -2
- data/lib/acu/utilities.rb +0 -0
- data/lib/acu/version.rb +1 -1
- data/lib/generators/acu/install_generator.rb +0 -0
- data/lib/generators/templates/rules.rb +0 -0
- data/lib/generators/templates/setup.rb +0 -0
- data/lib/rails-acu.rb +0 -0
- data/rails-acu.gemspec +0 -0
- data/spec/dummy/Rakefile +0 -0
- data/spec/dummy/app/assets/config/manifest.js +0 -0
- data/spec/dummy/app/assets/javascripts/admin/booking/chats.js +0 -0
- data/spec/dummy/app/assets/javascripts/admin/booking/lists.js +0 -0
- data/spec/dummy/app/assets/javascripts/admin/manage.js +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +0 -0
- data/spec/dummy/app/assets/javascripts/books.js +0 -0
- data/spec/dummy/app/assets/javascripts/cable.js +0 -0
- data/spec/dummy/app/assets/javascripts/comments.js +0 -0
- data/spec/dummy/app/assets/javascripts/home.js +0 -0
- data/spec/dummy/app/assets/stylesheets/admin/booking/chats.css +0 -0
- data/spec/dummy/app/assets/stylesheets/admin/booking/lists.css +0 -0
- data/spec/dummy/app/assets/stylesheets/admin/manage.css +0 -0
- data/spec/dummy/app/assets/stylesheets/application.css +0 -0
- data/spec/dummy/app/assets/stylesheets/books.css +0 -0
- data/spec/dummy/app/assets/stylesheets/comments.css +0 -0
- data/spec/dummy/app/assets/stylesheets/home.css +0 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +0 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +0 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +0 -0
- data/spec/dummy/app/controllers/admin/booking/chats_controller.rb +0 -0
- data/spec/dummy/app/controllers/admin/booking/lists_controller.rb +0 -0
- data/spec/dummy/app/controllers/admin/manage_controller.rb +0 -0
- data/spec/dummy/app/controllers/application_controller.rb +0 -0
- data/spec/dummy/app/controllers/home_controller.rb +0 -0
- data/spec/dummy/app/helpers/admin/booking/chats_helper.rb +0 -0
- data/spec/dummy/app/helpers/admin/booking/lists_helper.rb +0 -0
- data/spec/dummy/app/helpers/admin/manage_helper.rb +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/helpers/home_helper.rb +0 -0
- data/spec/dummy/app/jobs/application_job.rb +0 -0
- data/spec/dummy/app/mailers/application_mailer.rb +0 -0
- data/spec/dummy/app/models/admin/booking.rb +0 -0
- data/spec/dummy/app/models/admin/booking/chat.rb +0 -0
- data/spec/dummy/app/models/admin/booking/list.rb +0 -0
- data/spec/dummy/app/models/application_record.rb +0 -0
- data/spec/dummy/app/models/user.rb +0 -0
- data/spec/dummy/app/models/user_type.rb +0 -0
- data/spec/dummy/app/views/admin/booking/chats/_form.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/chats/edit.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/chats/index.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/chats/new.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/chats/show.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/lists/_form.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/lists/edit.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/lists/index.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/lists/new.html.erb +0 -0
- data/spec/dummy/app/views/admin/booking/lists/show.html.erb +0 -0
- data/spec/dummy/app/views/admin/manage/add.html.erb +0 -0
- data/spec/dummy/app/views/admin/manage/delete.html.erb +0 -0
- data/spec/dummy/app/views/admin/manage/index.html.erb +0 -0
- data/spec/dummy/app/views/admin/manage/list.html.erb +0 -0
- data/spec/dummy/app/views/admin/manage/prove.html.erb +0 -0
- data/spec/dummy/app/views/admin/manage/show.html.erb +0 -0
- data/spec/dummy/app/views/home/contact.html.erb +0 -0
- data/spec/dummy/app/views/home/index.html.erb +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +0 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +0 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +0 -0
- data/spec/dummy/config.ru +0 -0
- data/spec/dummy/config/application.rb +0 -0
- data/spec/dummy/config/boot.rb +0 -0
- data/spec/dummy/config/cable.yml +0 -0
- data/spec/dummy/config/database.yml +0 -0
- data/spec/dummy/config/environment.rb +0 -0
- data/spec/dummy/config/environments/development.rb +0 -0
- data/spec/dummy/config/environments/production.rb +0 -0
- data/spec/dummy/config/environments/test.rb +0 -0
- data/spec/dummy/config/initializers/acu_rules.rb +0 -0
- data/spec/dummy/config/initializers/acu_setup.rb +0 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +0 -0
- data/spec/dummy/config/initializers/assets.rb +0 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -0
- data/spec/dummy/config/initializers/devise.rb +0 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/spec/dummy/config/initializers/inflections.rb +0 -0
- data/spec/dummy/config/initializers/mime_types.rb +0 -0
- data/spec/dummy/config/initializers/new_framework_defaults.rb +0 -0
- data/spec/dummy/config/initializers/session_store.rb +0 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/spec/dummy/config/locales/devise.en.yml +0 -0
- data/spec/dummy/config/locales/en.yml +0 -0
- data/spec/dummy/config/puma.rb +0 -0
- data/spec/dummy/config/routes.rb +0 -0
- data/spec/dummy/config/secrets.yml +0 -0
- data/spec/dummy/config/spring.rb +0 -0
- data/spec/dummy/db/migrate/20170329111257_create_books.rb +0 -0
- data/spec/dummy/db/migrate/20170329111323_create_comments.rb +0 -0
- data/spec/dummy/db/migrate/20170329114943_devise_create_users.rb +0 -0
- data/spec/dummy/db/migrate/20170329120950_create_admin_user_types.rb +0 -0
- data/spec/dummy/db/migrate/20170329121612_add_user_type_id_to_users.rb +0 -0
- data/spec/dummy/db/migrate/20170506054319_create_admin_booking_lists.rb +0 -0
- data/spec/dummy/db/migrate/20170506081928_create_admin_booking_chats.rb +0 -0
- data/spec/dummy/db/schema.rb +0 -0
- data/spec/dummy/db/seeds.rb +0 -0
- data/spec/dummy/public/404.html +0 -0
- data/spec/dummy/public/422.html +0 -0
- data/spec/dummy/public/500.html +0 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/spec/controllers/admin/booking/chats_controller_spec.rb +0 -0
- data/spec/dummy/spec/controllers/admin/booking/lists_controller_spec.rb +0 -0
- data/spec/dummy/spec/controllers/admin/manage_controller_spec.rb +0 -0
- data/spec/dummy/spec/controllers/application_controller_spec.rb +0 -0
- data/spec/dummy/spec/controllers/home_controller_spec.rb +26 -0
- data/spec/rails_helper.rb +0 -0
- data/spec/spec_helper.rb +0 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f50692b816fca643b3e84d4d1df13fe2ffabb6d
|
4
|
+
data.tar.gz: 0b84f06cdfc0d7f9afc943b518fa497252ebfba0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2a8d834f7029c6b280d84286212d8b8fc03602fd6d22e1d493b89106828f4c836d85b59325700bb84eebbf49c4a7d4808379561d699531b39ddc9e5a93deac5
|
7
|
+
data.tar.gz: 15e6e64d16586ee43948289b9e697ed487d27e0f5816ccaeb74f6c27a6a131e3c846caef39bf06b45e7bdf495c7eb7e51a54930e78129a89718200fe284ee70b
|
data/.gitignore
CHANGED
File without changes
|
data/.project
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -17,6 +17,9 @@ gemspec
|
|
17
17
|
# Git. Remember to move these dependencies to your gemspec before releasing
|
18
18
|
# your gem to rubygems.org.
|
19
19
|
|
20
|
+
# to fix security bug CVE-2018-3760
|
21
|
+
gem 'sprockets', '~> 3.7.2'
|
22
|
+
|
20
23
|
# To use a debugger
|
21
24
|
# gem 'byebug', group: [:development, :test]
|
22
25
|
|
data/Gemfile.lock
CHANGED
@@ -7,8 +7,8 @@ GIT
|
|
7
7
|
PATH
|
8
8
|
remote: .
|
9
9
|
specs:
|
10
|
-
rails-acu (3.0.
|
11
|
-
rails (
|
10
|
+
rails-acu (3.0.4)
|
11
|
+
rails (>= 5.0.0)
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
@@ -85,7 +85,7 @@ GEM
|
|
85
85
|
mimemagic (~> 0.3.2)
|
86
86
|
method_source (0.9.0)
|
87
87
|
mimemagic (0.3.2)
|
88
|
-
mini_mime (1.0.
|
88
|
+
mini_mime (1.0.1)
|
89
89
|
mini_portile2 (2.3.0)
|
90
90
|
minitest (5.11.3)
|
91
91
|
nio4r (2.3.1)
|
@@ -144,7 +144,7 @@ GEM
|
|
144
144
|
rspec-mocks (~> 3.7.0)
|
145
145
|
rspec-support (~> 3.7.0)
|
146
146
|
rspec-support (3.7.1)
|
147
|
-
sprockets (3.7.
|
147
|
+
sprockets (3.7.2)
|
148
148
|
concurrent-ruby (~> 1.0)
|
149
149
|
rack (> 1, < 3)
|
150
150
|
sprockets-rails (3.2.1)
|
@@ -173,10 +173,11 @@ DEPENDENCIES
|
|
173
173
|
rails-acu!
|
174
174
|
rails-controller-testing
|
175
175
|
rspec-rails (~> 3.5)
|
176
|
+
sprockets (~> 3.7.2)
|
176
177
|
sqlite3
|
177
178
|
|
178
179
|
RUBY VERSION
|
179
180
|
ruby 2.4.1p111
|
180
181
|
|
181
182
|
BUNDLED WITH
|
182
|
-
1.16.
|
183
|
+
1.16.2
|
data/MIT-LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -94,6 +94,14 @@ Acu::Rules.define do
|
|
94
94
|
allow :client
|
95
95
|
end
|
96
96
|
end
|
97
|
+
|
98
|
+
# negated entities (since v3.0.4)
|
99
|
+
namespace do
|
100
|
+
controller :profile do
|
101
|
+
# only owners can edit the profile page
|
102
|
+
deny :not_owner, on: [:edit]
|
103
|
+
end
|
104
|
+
end
|
97
105
|
end
|
98
106
|
```
|
99
107
|
|
data/Rakefile
CHANGED
File without changes
|
data/lib/acu/configs.rb
CHANGED
File without changes
|
data/lib/acu/engine.rb
CHANGED
File without changes
|
data/lib/acu/errors.rb
CHANGED
File without changes
|
data/lib/acu/helpers/helpers.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
def acu_is? symbol
|
2
2
|
flag = false
|
3
|
-
[symbol].flatten.each
|
3
|
+
[symbol].flatten.each do |s|
|
4
|
+
if s.to_s =~ /\Anot_/
|
5
|
+
flag |= not(Acu::Monitor.valid_for?(s.to_s.gsub(/\Anot_/, "").to_sym))
|
6
|
+
else
|
7
|
+
flag |= Acu::Monitor.valid_for? s
|
8
|
+
end
|
9
|
+
end
|
4
10
|
flag
|
5
11
|
end
|
6
12
|
|
data/lib/acu/listeners.rb
CHANGED
File without changes
|
data/lib/acu/monitor.rb
CHANGED
File without changes
|
data/lib/acu/rules.rb
CHANGED
@@ -111,6 +111,7 @@ module Acu
|
|
111
111
|
|
112
112
|
def op *symbol, opr, on
|
113
113
|
symbol = symbol.flatten
|
114
|
+
process_symbol *symbol
|
114
115
|
raise Errors::InvalidData.new("invalid argument") if not symbol or symbol.to_s.blank? or opr.to_s.blank?
|
115
116
|
raise Errors::AmbiguousRule.new("cannot have `on` argument inside the action `#{@_params[:action][:name]}`") if not on.empty? and (@_params[:action] and not @_params[:action].empty?)
|
116
117
|
raise Errors::InvalidData.new("the symbol `#{symbol}` is not defined by `whois`") if not symbol.all? { |s| @entities.include? s }
|
@@ -123,9 +124,23 @@ module Acu
|
|
123
124
|
end
|
124
125
|
end
|
125
126
|
|
126
|
-
def
|
127
|
+
def process_symbol *symbols
|
128
|
+
symbols.each do |symbol|
|
129
|
+
# check if negated symbol used?
|
130
|
+
if symbol.to_s.downcase =~ /\Anot_/ and not @entities.include?(symbol)
|
131
|
+
# remove the not symbol
|
132
|
+
not_symbol = (symbol.to_s.gsub /\Anot_/, "").to_sym
|
133
|
+
# add the negated symbol
|
134
|
+
whois(symbol, args: @entities[not_symbol][:args]) { |*args| not @entities[not_symbol][:callback].call(*args) }
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def build_rule *_rules
|
127
140
|
@rules[@_params.deep_dup] ||= {}
|
128
|
-
|
141
|
+
_rules.each do |rule|
|
142
|
+
@rules[@_params.deep_dup] = @rules[@_params.clone].merge(rule);
|
143
|
+
end
|
129
144
|
end
|
130
145
|
|
131
146
|
def build_rule_entry
|
data/lib/acu/utilities.rb
CHANGED
File without changes
|
data/lib/acu/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/lib/rails-acu.rb
CHANGED
File without changes
|
data/rails-acu.gemspec
CHANGED
File without changes
|
data/spec/dummy/Rakefile
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/config.ru
CHANGED
File without changes
|
File without changes
|
data/spec/dummy/config/boot.rb
CHANGED
File without changes
|
data/spec/dummy/config/cable.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/config/puma.rb
CHANGED
File without changes
|
data/spec/dummy/config/routes.rb
CHANGED
File without changes
|
File without changes
|
data/spec/dummy/config/spring.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/dummy/db/schema.rb
CHANGED
File without changes
|
data/spec/dummy/db/seeds.rb
CHANGED
File without changes
|
data/spec/dummy/public/404.html
CHANGED
File without changes
|
data/spec/dummy/public/422.html
CHANGED
File without changes
|
data/spec/dummy/public/500.html
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -428,6 +428,32 @@ RSpec.describe HomeController, type: :controller do
|
|
428
428
|
expect {get :contact}.to raise_error(Acu::Errors::AccessDenied)
|
429
429
|
expect(`tail -n 1 #{Acu::Configs.get :audit_log_file}`).to match /access DENIED to.*namespace=\[nil\].*controller=\["home"\].*action=\["contact"\].*as `:everyone`/
|
430
430
|
end
|
431
|
+
it "[negated entities]" do
|
432
|
+
Acu::Rules.define do
|
433
|
+
whois :everyone { true }
|
434
|
+
whois :client { false }
|
435
|
+
namespace do
|
436
|
+
controller :home do
|
437
|
+
deny :not_client, on: [:index, :contact]
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
expect {get :index}.to raise_error(Acu::Errors::AccessDenied)
|
442
|
+
expect(`tail -n 1 #{Acu::Configs.get :audit_log_file}`).to match /access DENIED to.*namespace=\[nil\].*controller=\["home"\].*action=\["index"\].*as `:not_client`/
|
443
|
+
expect {get :contact}.to raise_error(Acu::Errors::AccessDenied)
|
444
|
+
expect(`tail -n 1 #{Acu::Configs.get :audit_log_file}`).to match /access DENIED to.*namespace=\[nil\].*controller=\["home"\].*action=\["contact"\].*as `:not_client`/
|
445
|
+
Acu::Rules.define do
|
446
|
+
namespace do
|
447
|
+
controller :home do
|
448
|
+
allow :not_client, on: [:index, :contact]
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|
452
|
+
get :index
|
453
|
+
expect(`tail -n 1 #{Acu::Configs.get :audit_log_file}`).to match /access GRANTED to.*namespace=\[nil\].*controller=\["home"\].*action=\["index"\].*as `:not_client`/
|
454
|
+
get :contact
|
455
|
+
expect(`tail -n 1 #{Acu::Configs.get :audit_log_file}`).to match /access GRANTED to.*namespace=\[nil\].*controller=\["home"\].*action=\["contact"\].*as `:not_client`/
|
456
|
+
end
|
431
457
|
end
|
432
458
|
context "[bulk settings]" do
|
433
459
|
it "[allow/deny]" do
|
data/spec/rails_helper.rb
CHANGED
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-acu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dariush Hasanpour
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|