rails_audit 1.0.0 → 1.0.4
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/LICENSE +20 -165
- data/README.md +17 -5
- data/app/controllers/auditor/admin/approvals_controller.rb +44 -0
- data/app/controllers/auditor/admin/audits_controller.rb +11 -0
- data/app/controllers/auditor/admin/base_controller.rb +4 -0
- data/app/controllers/auditor/admin/verifications_controller.rb +61 -0
- data/app/controllers/auditor/admin/verifiers_controller.rb +69 -0
- data/app/controllers/auditor/controller/application.rb +32 -0
- data/app/models/auditor/approval.rb +5 -0
- data/app/models/auditor/audit.rb +5 -0
- data/app/models/auditor/ext/audited.rb +58 -0
- data/app/models/auditor/ext/verifiable.rb +10 -0
- data/app/models/auditor/ext/verified.rb +25 -0
- data/app/models/auditor/model/approval.rb +59 -0
- data/app/models/auditor/model/approving.rb +65 -0
- data/app/models/auditor/model/audit.rb +25 -0
- data/app/models/auditor/model/verification.rb +32 -0
- data/app/models/auditor/model/verifier.rb +20 -0
- data/app/models/auditor/verification.rb +5 -0
- data/app/models/auditor/verifier.rb +5 -0
- data/app/models/auditor.rb +11 -0
- data/app/views/auditor/_approvals.html.erb +14 -0
- data/app/views/auditor/_checks.html.erb +16 -0
- data/app/views/auditor/admin/approvals/_filter.html.erb +7 -0
- data/app/views/auditor/admin/approvals/_form.html.erb +6 -0
- data/app/views/auditor/admin/approvals/_index.html.erb +10 -0
- data/app/views/auditor/admin/approvals/_show_table.html.erb +28 -0
- data/app/views/auditor/admin/approvals/_table.html.erb +28 -0
- data/app/views/auditor/admin/approvals/index.js.erb +3 -0
- data/app/views/auditor/admin/audits/_button.html.erb +0 -0
- data/app/views/auditor/admin/audits/_index_tbody.html.erb +38 -0
- data/app/views/auditor/admin/audits/_index_thead.html.erb +4 -0
- data/app/views/auditor/admin/audits/index.html.erb +7 -0
- data/app/views/auditor/admin/verifications/_edit_form.html.erb +7 -0
- data/app/views/auditor/admin/verifications/_filter_form.html.erb +5 -0
- data/app/views/auditor/admin/verifications/_index_tbody.html.erb +4 -0
- data/app/views/auditor/admin/verifications/_index_thead.html.erb +5 -0
- data/app/views/auditor/admin/verifications/_new_form.html.erb +7 -0
- data/app/views/auditor/admin/verifications/_show_table.html.erb +16 -0
- data/app/views/auditor/admin/verifiers/_edit_form.html.erb +3 -0
- data/app/views/auditor/admin/verifiers/_filter_form.html.erb +9 -0
- data/app/views/auditor/admin/verifiers/_form.html.erb +5 -0
- data/app/views/auditor/admin/verifiers/_index_tbody.html.erb +3 -0
- data/app/views/auditor/admin/verifiers/_index_thead.html.erb +4 -0
- data/app/views/auditor/admin/verifiers/_member_field.html.erb +1 -0
- data/app/views/auditor/admin/verifiers/_new_form.html.erb +3 -0
- data/app/views/auditor/admin/verifiers/_show_table.html.erb +24 -0
- data/app/views/auditor/admin/verifiers/members.turbo_stream.erb +3 -0
- data/config/locales/en.yml +12 -0
- data/config/locales/zh.controller.yml +13 -0
- data/config/locales/zh.enum.yml +7 -0
- data/config/locales/zh.yml +21 -0
- data/config/routes.rb +22 -2
- data/lib/rails_audit/config.rb +14 -0
- data/lib/rails_audit/engine.rb +15 -6
- data/lib/rails_audit.rb +3 -2
- data/test/controllers/audit/admin/approvals_controller_test.rb +36 -0
- data/test/dummy/Gemfile +54 -0
- data/test/dummy/Gemfile.lock +382 -0
- data/test/dummy/README.md +8 -1
- data/test/dummy/app/assets/images/default_avatar.jpg +0 -0
- data/test/dummy/app/assets/images/logo.png +0 -0
- data/test/dummy/app/assets/javascripts/admin/application.js +1 -0
- data/test/dummy/app/assets/javascripts/application.js +11 -2
- data/test/dummy/app/assets/javascripts/phone.js +5 -0
- data/test/dummy/app/assets/stylesheets/css.scss +4 -0
- data/test/dummy/app/controllers/active_storage/base_controller.rb +19 -0
- data/test/dummy/app/controllers/admin_controller.rb +3 -0
- data/test/dummy/app/controllers/application_controller.rb +10 -1
- data/test/dummy/app/controllers/home_controller.rb +0 -5
- data/test/dummy/app/controllers/me_controller.rb +4 -0
- data/test/dummy/app/controllers/my_controller.rb +4 -0
- data/test/dummy/app/models/auth/user.rb +7 -0
- data/test/dummy/app/views/home/index.css +3 -0
- data/test/dummy/app/views/home/index.html.erb +0 -0
- data/test/dummy/app/views/layouts/_right_menu.html.erb +0 -20
- data/test/dummy/bin/bundle +1 -1
- data/test/dummy/bin/setup +1 -1
- data/test/dummy/bin/vite +19 -0
- data/test/dummy/bin/yarn +11 -0
- data/test/dummy/config/application.rb +12 -5
- data/test/dummy/config/boot.rb +8 -4
- data/test/dummy/config/credentials/development.key +1 -0
- data/test/dummy/config/credentials/test.key +1 -0
- data/test/dummy/config/credentials.yml.enc +1 -0
- data/test/dummy/config/database.yml +16 -0
- data/test/dummy/config/environment.rb +0 -2
- data/test/dummy/config/environments/development.rb +19 -32
- data/test/dummy/config/environments/production.rb +1 -13
- data/test/dummy/config/environments/test.rb +5 -0
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/new_framework_defaults.rb +0 -4
- data/test/dummy/config/locales/en.yml +1 -22
- data/test/dummy/config/master.key +1 -0
- data/test/dummy/config/puma.rb +28 -41
- data/test/dummy/config/routes.rb +9 -2
- data/test/dummy/config/storage.yml +11 -0
- data/test/dummy/config/vite/base.js +5 -0
- data/test/dummy/config/vite/development.js +12 -0
- data/test/dummy/config/vite/production.js +6 -0
- data/test/dummy/config.ru +2 -0
- data/test/dummy/lib/deploy.rb +115 -0
- data/test/dummy/package.json +23 -2
- data/test/dummy/postcss.config.js +11 -0
- data/test/dummy/yarn.lock +2140 -4
- data/test/factories/approvals.rb +7 -0
- data/test/factories/infos.rb +8 -0
- data/test/{the_audit_test.rb → rails_audit_test.rb} +3 -1
- data/test/test_helper.rb +9 -16
- metadata +151 -97
- data/app/controllers/admin/audits_controller.rb +0 -12
- data/app/models/rails_audit/audit.rb +0 -14
- data/app/models/rails_audit/concerns/auditable.rb +0 -59
- data/app/models/rails_audit/history.rb +0 -36
- data/app/models/rails_audit/major_record.rb +0 -14
- data/app/models/rails_audit/minor_record.rb +0 -15
- data/app/views/admin/audits/_index.html.erb +0 -9
- data/app/views/admin/audits/_table.html.erb +0 -61
- data/app/views/admin/audits/index.html.erb +0 -3
- data/app/views/admin/audits/index.js.erb +0 -8
- data/db/migrate/20170314035239_create_audits.rb +0 -20
- data/lib/rails_audit/controller_helper.rb +0 -39
- data/lib/rails_audit/version.rb +0 -3
- data/lib/tasks/the_history_tasks.rake +0 -4
- data/test/dummy/app/assets/config/manifest.js +0 -3
- data/test/dummy/app/assets/javascripts/cable.js +0 -13
- data/test/dummy/app/assets/stylesheets/application.css +0 -5
- data/test/dummy/app/controllers/admin/base_controller.rb +0 -7
- data/test/dummy/app/controllers/my/base_controller.rb +0 -7
- data/test/dummy/app/models/application_record.rb +0 -3
- data/test/dummy/app/models/user.rb +0 -3
- data/test/dummy/app/views/layouts/_navbar.html.erb +0 -18
- data/test/dummy/app/views/layouts/application.html.erb +0 -19
- data/test/dummy/app/views/layouts/mailer.html.erb +0 -13
- data/test/dummy/app/views/layouts/mailer.text.erb +0 -1
- data/test/dummy/bin/update +0 -29
- data/test/dummy/config/database.yml.mysql +0 -14
- data/test/dummy/config/database.yml.sqlite3 +0 -12
- data/test/dummy/config/initializers/assets.rb +0 -6
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20180525090830_create_active_storage_tables.active_storage.rb +0 -26
- data/test/dummy/log/development.log +0 -2
@@ -1,20 +0,0 @@
|
|
1
|
-
class CreateAudits < ActiveRecord::Migration[5.1]
|
2
|
-
def change
|
3
|
-
|
4
|
-
create_table :audits do |t|
|
5
|
-
t.references :auditable, polymorphic: true
|
6
|
-
t.references :operator, polymorphic: true
|
7
|
-
t.string :action
|
8
|
-
t.string :audited_changes, limit: 4096
|
9
|
-
t.string :related_changes, limit: 4096
|
10
|
-
t.string :unconfirmed_changes, limit: 4096
|
11
|
-
t.string :note, limit: 1024
|
12
|
-
t.string :remote_ip
|
13
|
-
t.string :controller_path
|
14
|
-
t.string :action_name
|
15
|
-
t.string :extra, limit: 4096
|
16
|
-
t.datetime :created_at, index: true, null: false
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module RailsAudit::ControllerHelper
|
2
|
-
|
3
|
-
def mark_audits(**options)
|
4
|
-
record_classes = options.select { |k, _|
|
5
|
-
record_class = k.to_s.safe_constantize
|
6
|
-
record_class && record_class.ancestors.include?(ActiveRecord::Base)
|
7
|
-
}
|
8
|
-
|
9
|
-
record_classes.each do |record_symbol, includes|
|
10
|
-
record_class = record_symbol.to_s.constantize
|
11
|
-
valid_ivars.find do |ivar|
|
12
|
-
record = instance_variable_get(ivar)
|
13
|
-
if record.is_a? record_class
|
14
|
-
record.save_audits current_operator: rails_audit_user,
|
15
|
-
include: includes,
|
16
|
-
note: options[:note],
|
17
|
-
controller_path: controller_path,
|
18
|
-
action_name: action_name,
|
19
|
-
remote_ip: request.remote_ip,
|
20
|
-
extra: options[:extra]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def rails_audit_user
|
27
|
-
current_user
|
28
|
-
end
|
29
|
-
|
30
|
-
def valid_ivars
|
31
|
-
_except = self._protected_ivars.to_a + [:@marked_for_same_origin_verification]
|
32
|
-
self.instance_variables - _except
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
ActiveSupport.on_load :action_controller_base do
|
38
|
-
include RailsAudit::ControllerHelper
|
39
|
-
end
|
data/lib/rails_audit/version.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
// Action Cable provides the framework to deal with WebSockets in Rails.
|
2
|
-
// You can generate new channels where WebSocket features live using the rails generate channel command.
|
3
|
-
//
|
4
|
-
//= require action_cable
|
5
|
-
//= require_self
|
6
|
-
//= require_tree ./channels
|
7
|
-
|
8
|
-
(function() {
|
9
|
-
this.App || (this.App = {});
|
10
|
-
|
11
|
-
App.cable = ActionCable.createConsumer();
|
12
|
-
|
13
|
-
}).call(this);
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<header class="ui inverted site borderless menu">
|
2
|
-
<div class="ui container">
|
3
|
-
|
4
|
-
<% if current_user %>
|
5
|
-
<%= link_to root_path, class: 'item header' do %>
|
6
|
-
<span>MDPI</span>
|
7
|
-
<% end %>
|
8
|
-
<%= link_to 'Team', members_path, class: active_helper(controller: '/members') %>
|
9
|
-
<% else %>
|
10
|
-
<%= link_to 'MDPI', root_path, class: 'item header' %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= render 'layouts/right_menu' %>
|
14
|
-
|
15
|
-
</div>
|
16
|
-
</header>
|
17
|
-
|
18
|
-
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%= csrf_meta_tags %>
|
6
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
7
|
-
<%= css_load media: 'all' %>
|
8
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
9
|
-
<%= js_ready 'data-turbolinks-track': 'reload' %>
|
10
|
-
</head>
|
11
|
-
|
12
|
-
<body>
|
13
|
-
<%= render 'layouts/navbar' %>
|
14
|
-
<main class="ui container">
|
15
|
-
<%= yield %>
|
16
|
-
</main>
|
17
|
-
<%= js_load %>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= yield %>
|
data/test/dummy/bin/update
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
require 'fileutils'
|
4
|
-
include FileUtils
|
5
|
-
|
6
|
-
# path to your application root.
|
7
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
-
|
9
|
-
def system!(*args)
|
10
|
-
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
-
end
|
12
|
-
|
13
|
-
chdir APP_ROOT do
|
14
|
-
# This script is a way to update your development environment automatically.
|
15
|
-
# Add necessary update steps to this file.
|
16
|
-
|
17
|
-
puts '== Installing dependencies =='
|
18
|
-
system! 'gem install bundler --conservative'
|
19
|
-
system('bundle check') || system!('bundle install')
|
20
|
-
|
21
|
-
puts "\n== Updating database =="
|
22
|
-
system! 'bin/rails db:migrate'
|
23
|
-
|
24
|
-
puts "\n== Removing old logs and tempfiles =="
|
25
|
-
system! 'bin/rails log:clear tmp:clear'
|
26
|
-
|
27
|
-
puts "\n== Restarting application server =="
|
28
|
-
system! 'bin/rails restart'
|
29
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rails secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure the secrets in this file are kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
|
13
|
-
development:
|
14
|
-
secret_key_base: d1994ea3a3510e902411b78cb185a1c527a7f8d811264e578909fbc5910e36b7bd9501db720d6b7253178cf7ea05afb254cc9780123013d7de2f78b3926c7983
|
15
|
-
|
16
|
-
test:
|
17
|
-
secret_key_base: a0f9c1a6efa5a3110639533cf661793521048ba80f861c70dc024657e7fb5ec016f7582f65c811f88722c669582d2d396d0029887e88e939c89cd69a063c8656
|
18
|
-
|
19
|
-
# Do not keep production secrets in the repository,
|
20
|
-
# instead read values from the environment.
|
21
|
-
production:
|
22
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# This migration comes from active_storage (originally 20170806125915)
|
2
|
-
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
3
|
-
def change
|
4
|
-
create_table :active_storage_blobs do |t|
|
5
|
-
t.string :key, null: false
|
6
|
-
t.string :filename, null: false
|
7
|
-
t.string :content_type
|
8
|
-
t.text :metadata
|
9
|
-
t.bigint :byte_size, null: false
|
10
|
-
t.string :checksum, null: false
|
11
|
-
t.datetime :created_at, null: false
|
12
|
-
|
13
|
-
t.index [ :key ], unique: true
|
14
|
-
end
|
15
|
-
|
16
|
-
create_table :active_storage_attachments do |t|
|
17
|
-
t.string :name, null: false
|
18
|
-
t.references :record, null: false, polymorphic: true, index: false
|
19
|
-
t.references :blob, null: false
|
20
|
-
|
21
|
-
t.datetime :created_at, null: false
|
22
|
-
|
23
|
-
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,2 +0,0 @@
|
|
1
|
-
DEPRECATION WARNING: ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2. (called from <top (required)> at /Users/qin/work/engine/rails_audit/test/dummy/config/initializers/new_framework_defaults.rb:21)
|
2
|
-
DEPRECATION WARNING: ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2. (called from <top (required)> at /Users/qin/work/engine/rails_audit/test/dummy/config/initializers/new_framework_defaults.rb:21)
|