audit-log 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/lib/audit-log.rb +1 -1
- data/lib/audit-log/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f683b75551b46a4dd5799d3699c235765c742d7f0e36e0d51fb3b8f06354e1b
|
4
|
+
data.tar.gz: ccd650c70feeae9b584b5b566c95e5d7b4d1a7e1fb6496d20915cf7f9e1ebbfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32954d87892042d6871f9b66e2b808270aef6a167c0d6fab63f85ec3a0de538047890e99d8cd3493486176e9eae89cac16e750ed3838b39dcd9190f41793789b
|
7
|
+
data.tar.gz: 5f8e1a81880d4430bf07cb9af7c8acc5ff5caadcfcac63e5c8ffd87524c5c7cdb63ca204357ec318e40e1c7f7d4cb9f83ce3db69159d818f6aad2d584e215e2b
|
data/README.md
CHANGED
@@ -113,6 +113,25 @@ zh-CN:
|
|
113
113
|
approve_ticket: 审批工单
|
114
114
|
```
|
115
115
|
|
116
|
+
For track Warden (Devise) sign in behavirs:
|
117
|
+
|
118
|
+
config/initializes/devise.rb
|
119
|
+
|
120
|
+
```rb
|
121
|
+
Warden::Manager.after_authentication do |user, auth, opts|
|
122
|
+
request = ActionDispatch::Request.new(auth.env)
|
123
|
+
AuditLog.audit!(:sign_in, user, payload: opts, user: user, request: request)
|
124
|
+
end
|
125
|
+
|
126
|
+
Warden::Manager.before_failure do |env, opts|
|
127
|
+
request = ActionDispatch::Request.new(env)
|
128
|
+
email = request.params.dig(:user, :email)
|
129
|
+
user = User.find_by_email(email)
|
130
|
+
opts[:email] = email
|
131
|
+
AuditLog.audit!(:sign_in_failure, nil, payload: opts, request: request, user: user)
|
132
|
+
end
|
133
|
+
```
|
134
|
+
|
116
135
|
## License
|
117
136
|
|
118
137
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/audit-log.rb
CHANGED
@@ -46,7 +46,7 @@ module AuditLog
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# Get I18n action name options for select
|
49
|
-
def action_options(locale: I18n.
|
49
|
+
def action_options(locale: I18n.locale)
|
50
50
|
I18n.backend.send(:translations)[locale][:audit_log][:action].map { |k, v| [v, k.to_s] }
|
51
51
|
end
|
52
52
|
end
|
data/lib/audit-log/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audit-log
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kaminari
|