web47core 0.7.1 → 0.7.7
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13c5bfc15e45ddc49167d2f71c698abe48c22d7b974ba18096509bc9d9288118
|
4
|
+
data.tar.gz: a8f8f18537be2bf61f7ce7e7bae6b1b552f9dfd51314c250be663971bc355855
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c988580b2939046e514b84e517998a36e2d6f87ed4b9a2388f3ab3f04f55dec4c9cf6cb2215407f92d5ea49999f631c4e02ad5a373ae293e53ca37307e8fd91f
|
7
|
+
data.tar.gz: 84291d6a8153f65b925e9f280b7152f3b2396520fee0c87f40f382f6a223d5bf0e927e3a85e9838ebc460939280974b54bbed4cac23ceba0957301eee311e4cc
|
data/app/helpers/core_helper.rb
CHANGED
@@ -60,15 +60,16 @@ module CoreHelper
|
|
60
60
|
# 3. Length 5-10 only show the first and last character
|
61
61
|
# 4. Otherwise show the first and last three characters
|
62
62
|
def mask_value(value, default: '************')
|
63
|
-
return default if value.blank?
|
63
|
+
return default if value.blank? || !value.respond_to?(:to_s)
|
64
64
|
|
65
|
-
|
65
|
+
string_value = value.to_s
|
66
|
+
case string_value.length
|
66
67
|
when 1..4
|
67
|
-
"#{
|
68
|
+
"#{string_value.first}***********"
|
68
69
|
when 5..10
|
69
|
-
"#{
|
70
|
+
"#{string_value.first}**********#{string_value.last}"
|
70
71
|
else
|
71
|
-
"#{
|
72
|
+
"#{string_value[0..2]}**********#{string_value[-3..-1]}"
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
@@ -75,11 +75,7 @@ module CoreSystemConfiguration
|
|
75
75
|
|
76
76
|
module ClassMethods
|
77
77
|
def configuration
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
def reset
|
82
|
-
@configuration = nil
|
78
|
+
SystemConfiguration.find_or_create_by!(environment: Rails.env)
|
83
79
|
end
|
84
80
|
|
85
81
|
def smtp_configuration
|
@@ -249,13 +245,4 @@ module CoreSystemConfiguration
|
|
249
245
|
def slack_configured?
|
250
246
|
slack_api_url.present?
|
251
247
|
end
|
252
|
-
|
253
|
-
# private
|
254
|
-
|
255
|
-
#
|
256
|
-
# Clear the cache when the object is saved
|
257
|
-
#
|
258
|
-
# def clear_cache
|
259
|
-
# Rails.cache.delete "SystemConfiguration::#{Rails.env}"
|
260
|
-
# end
|
261
248
|
end
|
@@ -22,9 +22,9 @@ module StandardModel
|
|
22
22
|
#
|
23
23
|
# Relationships
|
24
24
|
#
|
25
|
-
belongs_to :last_modified_by,
|
26
|
-
belongs_to :created_by,
|
27
|
-
has_many Web47core::Config.audit_model_log_symbol, dependent: :nullify
|
25
|
+
belongs_to :last_modified_by, polymorphic: true, dependent: :nullify, optional: true
|
26
|
+
belongs_to :created_by, polymorphic: true, dependent: :nullify, optional: true
|
27
|
+
has_many Web47core::Config.audit_model_log_symbol, dependent: :nullify, inverse_of: :model
|
28
28
|
#
|
29
29
|
# Callbacks
|
30
30
|
#
|
@@ -98,9 +98,10 @@ module StandardModel
|
|
98
98
|
# Record the creation with this user
|
99
99
|
#
|
100
100
|
def create_and_log(user, attributes)
|
101
|
-
attributes[:last_modified_by_id] = user.id
|
102
|
-
attributes[:created_by_id] = user.id
|
103
101
|
model = create(attributes)
|
102
|
+
model.last_modified_by = user
|
103
|
+
model.created_by = user
|
104
|
+
model.save
|
104
105
|
log_change(user, model, attributes) if model.valid?
|
105
106
|
model
|
106
107
|
end
|
@@ -109,9 +110,10 @@ module StandardModel
|
|
109
110
|
# Record the creation with this user
|
110
111
|
#
|
111
112
|
def create_and_log!(user, attributes)
|
112
|
-
attributes[:last_modified_by_id] = user.id
|
113
|
-
attributes[:created_by_id] = user.id
|
114
113
|
model = create!(attributes)
|
114
|
+
model.last_modified_by = user
|
115
|
+
model.created_by = user
|
116
|
+
model.save!
|
115
117
|
log_change(user, model, attributes)
|
116
118
|
model
|
117
119
|
end
|
@@ -209,7 +211,7 @@ module StandardModel
|
|
209
211
|
return self if attributes.blank?
|
210
212
|
|
211
213
|
action = audit_action
|
212
|
-
|
214
|
+
self.last_modified_by = user
|
213
215
|
result = update(attributes)
|
214
216
|
log_change(user, attributes, action) if valid?
|
215
217
|
result
|
@@ -224,7 +226,7 @@ module StandardModel
|
|
224
226
|
return self if attributes.blank?
|
225
227
|
|
226
228
|
action = audit_action
|
227
|
-
|
229
|
+
self.last_modified_by = user
|
228
230
|
result = update!(attributes)
|
229
231
|
log_change(user, attributes, action)
|
230
232
|
result
|
data/lib/web47core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web47core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schroeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|