loggable_activity 0.2.1 → 0.5.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 +4 -4
- data/.rubocop.yml +29 -42
- data/.vscode/commands.json +2 -2
- data/.vscode/terminals.json +8 -8
- data/CHEAT_SHEET.md +31 -0
- data/MIT-LICENSE +21 -0
- data/README.md +31 -45
- data/Rakefile +6 -4
- data/app/assets/config/loggable_activity_manifest.js +4 -0
- data/app/assets/javascripts/loggable_activity/application.js +2 -0
- data/app/assets/stylesheets/loggable_activity/application.scss +20 -0
- data/app/controllers/concerns/.keep +0 -0
- data/app/controllers/loggable_activity/activities_controller.rb +12 -0
- data/app/controllers/loggable_activity/application_controller.rb +6 -0
- data/app/helpers/loggable_activity/activities_helper.rb +17 -0
- data/app/helpers/loggable_activity/application_helper.rb +6 -0
- data/app/jobs/loggable_activity/application_job.rb +6 -0
- data/app/mailers/loggable_activity/application_mailer.rb +8 -0
- data/app/models/loggable_activity/application_record.rb +7 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_first_page.html.erb +14 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_gap.html.erb +8 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_last_page.html.erb +13 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_next_page.html.erb +13 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_page.html.erb +14 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_paginator.html.erb +27 -0
- data/app/views/kaminari/kaminari-turbo-bootstrap/_prev_page.html.erb +14 -0
- data/app/views/layouts/loggable_activity/application.html.erb +19 -0
- data/app/views/loggable_activity/activities/_activities.html.erb +56 -0
- data/app/views/loggable_activity/activities/index.html.erb +7 -0
- data/app/views/loggable_activity/activities/show.html.erb +2 -0
- data/config/initializers/kaminari_config.rb +14 -0
- data/config/routes.rb +7 -0
- data/{lib/generators/loggable_activity/templates/create_loggable_activities.rb → db/migrate/20240702092648_create_loggable_activity_tables.rb} +18 -10
- data/git-org/HEAD +1 -0
- data/git-org/config +7 -0
- data/git-org/description +1 -0
- data/git-org/hooks/applypatch-msg.sample +15 -0
- data/git-org/hooks/commit-msg.sample +24 -0
- data/git-org/hooks/fsmonitor-watchman.sample +174 -0
- data/git-org/hooks/post-update.sample +8 -0
- data/git-org/hooks/pre-applypatch.sample +14 -0
- data/git-org/hooks/pre-commit.sample +49 -0
- data/git-org/hooks/pre-merge-commit.sample +13 -0
- data/git-org/hooks/pre-push.sample +53 -0
- data/git-org/hooks/pre-rebase.sample +169 -0
- data/git-org/hooks/pre-receive.sample +24 -0
- data/git-org/hooks/prepare-commit-msg.sample +42 -0
- data/git-org/hooks/push-to-checkout.sample +78 -0
- data/git-org/hooks/update.sample +128 -0
- data/git-org/info/exclude +6 -0
- data/lib/loggable_activity/activity.rb +3 -3
- data/lib/{schemas → loggable_activity}/config_schema.json +3 -3
- data/lib/loggable_activity/configuration.rb +51 -75
- data/lib/loggable_activity/data_owner.rb +0 -1
- data/lib/loggable_activity/encryption.rb +16 -7
- data/lib/loggable_activity/encryption_key.rb +4 -7
- data/lib/loggable_activity/engine.rb +27 -0
- data/lib/loggable_activity/error.rb +0 -10
- data/lib/loggable_activity/hooks.rb +10 -5
- data/lib/loggable_activity/payload.rb +8 -11
- data/lib/loggable_activity/sanitizer.rb +6 -2
- data/lib/loggable_activity/services/base_payloads_builder.rb +14 -5
- data/lib/loggable_activity/services/destroy_payloads_builder.rb +2 -1
- data/lib/loggable_activity/services/payloads_builder.rb +9 -2
- data/lib/loggable_activity/services/update_payloads_builder.rb +30 -2
- data/lib/loggable_activity/version.rb +1 -1
- data/lib/loggable_activity.rb +51 -14
- data/lib/tasks/loggable_activity_tasks.rake +6 -0
- metadata +129 -117
- data/.document +0 -1
- data/.nojekyll +0 -1
- data/.rspec +0 -3
- data/CONSIDERTIONS.md +0 -129
- data/GETTING-STARTED.md +0 -119
- data/LICENSE.txt +0 -21
- data/PAYLOAD_EXAMPLE.md +0 -63
- data/ROADMAP.md +0 -23
- data/docs/LoggableActivity/Activity.html +0 -555
- data/docs/LoggableActivity/Configuration.html +0 -330
- data/docs/LoggableActivity/ConfigurationError.html +0 -148
- data/docs/LoggableActivity/DataOwner.html +0 -138
- data/docs/LoggableActivity/Encryption.html +0 -234
- data/docs/LoggableActivity/EncryptionError.html +0 -145
- data/docs/LoggableActivity/EncryptionKey.html +0 -351
- data/docs/LoggableActivity/Error.html +0 -145
- data/docs/LoggableActivity/Hooks.html +0 -759
- data/docs/LoggableActivity/Payload.html +0 -432
- data/docs/LoggableActivity/Services/BasePayloadsBuilder.html +0 -442
- data/docs/LoggableActivity/Services/DestroyPayloadsBuilder.html +0 -395
- data/docs/LoggableActivity/Services/PayloadsBuilder.html +0 -342
- data/docs/LoggableActivity/Services/UpdatePayloadsBuilder.html +0 -490
- data/docs/LoggableActivity/Services.html +0 -93
- data/docs/LoggableActivity.html +0 -102
- data/docs/created.rid +0 -14
- data/docs/css/fonts.css +0 -167
- data/docs/css/rdoc.css +0 -687
- data/docs/fonts/Lato-Light.ttf +0 -0
- data/docs/fonts/Lato-LightItalic.ttf +0 -0
- data/docs/fonts/Lato-Regular.ttf +0 -0
- data/docs/fonts/Lato-RegularItalic.ttf +0 -0
- data/docs/fonts/SourceCodePro-Bold.ttf +0 -0
- data/docs/fonts/SourceCodePro-Regular.ttf +0 -0
- data/docs/images/add.png +0 -0
- data/docs/images/arrow_up.png +0 -0
- data/docs/images/brick.png +0 -0
- data/docs/images/brick_link.png +0 -0
- data/docs/images/bug.png +0 -0
- data/docs/images/bullet_black.png +0 -0
- data/docs/images/bullet_toggle_minus.png +0 -0
- data/docs/images/bullet_toggle_plus.png +0 -0
- data/docs/images/date.png +0 -0
- data/docs/images/delete.png +0 -0
- data/docs/images/find.png +0 -0
- data/docs/images/loadingAnimation.gif +0 -0
- data/docs/images/macFFBgHack.png +0 -0
- data/docs/images/package.png +0 -0
- data/docs/images/page_green.png +0 -0
- data/docs/images/page_white_text.png +0 -0
- data/docs/images/page_white_width.png +0 -0
- data/docs/images/plugin.png +0 -0
- data/docs/images/ruby.png +0 -0
- data/docs/images/tag_blue.png +0 -0
- data/docs/images/tag_green.png +0 -0
- data/docs/images/transparent.png +0 -0
- data/docs/images/wrench.png +0 -0
- data/docs/images/wrench_orange.png +0 -0
- data/docs/images/zoom.png +0 -0
- data/docs/index.html +0 -99
- data/docs/js/darkfish.js +0 -97
- data/docs/js/navigation.js +0 -105
- data/docs/js/navigation.js.gz +0 -0
- data/docs/js/search.js +0 -110
- data/docs/js/search_index.js +0 -1
- data/docs/js/search_index.js.gz +0 -0
- data/docs/js/searcher.js +0 -229
- data/docs/js/searcher.js.gz +0 -0
- data/docs/table_of_contents.html +0 -617
- data/help/loggable_activity_help.txt +0 -19
- data/lib/generators/.DS_Store +0 -0
- data/lib/generators/loggable_activity/.DS_Store +0 -0
- data/lib/generators/loggable_activity/install_generator.rb +0 -109
- data/lib/generators/loggable_activity/templates/.DS_Store +0 -0
- data/lib/generators/loggable_activity/templates/binary_ids/create_loggable_activities.rb +0 -30
- data/lib/generators/loggable_activity/templates/config/locales/loggable_activity.en.yml +0 -36
- data/lib/generators/loggable_activity/templates/config/loggable_activity.yaml +0 -29
- data/lib/generators/loggable_activity/templates/loggable_activity.en.yaml +0 -36
- data/pkg/loggable_activity-0.1.35.gem +0 -0
- data/sig/loggable_activity.rbs +0 -4
- /data/{.rspec_status → app/assets/images/loggable_activity/.keep} +0 -0
- /data/lib/{generators/loggable_activity/templates → loggable_activity/concerns}/current_user.rb +0 -0
@@ -7,7 +7,6 @@ module LoggableActivity
|
|
7
7
|
# When the record is deleted, the encryption key for the payload is also deleted.
|
8
8
|
# Payloads come in different types, each serving a specific purpose.
|
9
9
|
class Payload < ActiveRecord::Base
|
10
|
-
self.table_name = 'loggable_payloads'
|
11
10
|
validates :related_to_activity_as, presence: true
|
12
11
|
|
13
12
|
# Associations
|
@@ -63,14 +62,14 @@ module LoggableActivity
|
|
63
62
|
#
|
64
63
|
def attrs
|
65
64
|
return deleted_attrs if record.nil?
|
66
|
-
|
65
|
+
|
67
66
|
case related_to_activity_as
|
68
67
|
when *DECRYPT_ATTRS_TYPES
|
69
|
-
decrypted_attrs
|
68
|
+
decrypted_attrs.merge(public_attrs: public_attrs)
|
70
69
|
when *DECRYPT_UPDATE_ATTRS_TYPES
|
71
|
-
decrypted_update_attrs
|
70
|
+
decrypted_update_attrs + public_attrs['changes']
|
72
71
|
else
|
73
|
-
{}
|
72
|
+
{ public_attrs: public_attrs }
|
74
73
|
end
|
75
74
|
end
|
76
75
|
|
@@ -93,7 +92,7 @@ module LoggableActivity
|
|
93
92
|
#
|
94
93
|
# @return [String] The display name for the record.
|
95
94
|
def record_display_name
|
96
|
-
return I18n.t('
|
95
|
+
return I18n.t('loggable_activity.activity.deleted') if deleted?
|
97
96
|
|
98
97
|
::LoggableActivity::Encryption.decrypt(encrypted_record_name, secret_key)
|
99
98
|
end
|
@@ -118,7 +117,7 @@ module LoggableActivity
|
|
118
117
|
#
|
119
118
|
# @return [Hash] The hash with deleted attributes.
|
120
119
|
def deleted_attrs
|
121
|
-
encrypted_attrs.transform_values! { I18n.t('
|
120
|
+
encrypted_attrs.transform_keys(&:to_sym).transform_values! { I18n.t('loggable_activity.activity.deleted') }
|
122
121
|
end
|
123
122
|
|
124
123
|
# Decrypts the 'from' and 'to' attributes in the update payload.
|
@@ -139,7 +138,7 @@ module LoggableActivity
|
|
139
138
|
change.to_h do |key, value|
|
140
139
|
from = decrypt_attr(value['from'])
|
141
140
|
to = decrypt_attr(value['to'])
|
142
|
-
[key, { from:, to: }]
|
141
|
+
[key.to_sym, { from:, to: }]
|
143
142
|
end
|
144
143
|
end
|
145
144
|
|
@@ -147,9 +146,7 @@ module LoggableActivity
|
|
147
146
|
#
|
148
147
|
# @return [Hash] The decrypted attributes.
|
149
148
|
def decrypted_attrs
|
150
|
-
encrypted_attrs.
|
151
|
-
encrypted_attrs[key] = decrypt_attr(value)
|
152
|
-
end
|
149
|
+
encrypted_attrs.transform_keys(&:to_sym).transform_values { |value| decrypt_attr(value) }
|
153
150
|
end
|
154
151
|
|
155
152
|
# Decrypts a single attribute.
|
@@ -1,9 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module LoggableActivity
|
4
|
+
# This module is responsible for sanitizing activities.
|
5
|
+
# When an encryption keys deleted_at field is set, the key is deleted.
|
2
6
|
module Sanitizer
|
3
|
-
def self.run
|
7
|
+
def self.run
|
4
8
|
::LoggableActivity::EncryptionKey.where('delete_at < ?', DateTime.now).find_in_batches do |batch|
|
5
9
|
batch.each(&:delete)
|
6
10
|
end
|
7
11
|
end
|
8
12
|
end
|
9
|
-
end
|
13
|
+
end
|
@@ -10,6 +10,7 @@ module LoggableActivity
|
|
10
10
|
@record = record
|
11
11
|
@payloads = payloads
|
12
12
|
@loggable_attrs = record.class.loggable_attrs
|
13
|
+
@public_attrs = record.class.public_attrs
|
13
14
|
# @relation_config = record.relation_config
|
14
15
|
@relations = record.class.relations
|
15
16
|
@auto_log = record.class.auto_log
|
@@ -67,19 +68,21 @@ module LoggableActivity
|
|
67
68
|
return if encryption_key.deleted?
|
68
69
|
|
69
70
|
secret_key = encryption_key.secret_key
|
70
|
-
encrypted_attrs = encrypt_attributes(record, secret_key)
|
71
|
+
encrypted_attrs = encrypt_attributes(record, secret_key, options)
|
72
|
+
public_attrs = public_attributes(record)
|
71
73
|
|
72
74
|
build_payload(
|
73
75
|
record,
|
74
76
|
encryption_key,
|
75
77
|
encrypted_attrs,
|
78
|
+
public_attrs,
|
76
79
|
options
|
77
80
|
)
|
78
81
|
{ encryption_key:, encrypted_attrs: }
|
79
82
|
end
|
80
83
|
|
81
84
|
# Builds the payload for a record
|
82
|
-
def build_payload(record, encryption_key, encrypted_attrs, options = {})
|
85
|
+
def build_payload(record, encryption_key, encrypted_attrs, public_attrs, options = {})
|
83
86
|
return if encryption_key.deleted?
|
84
87
|
|
85
88
|
related_to_activity_as = options[:related_to_activity_as]
|
@@ -96,7 +99,8 @@ module LoggableActivity
|
|
96
99
|
related_to_activity_as:,
|
97
100
|
route: record.class.route,
|
98
101
|
current_payload:,
|
99
|
-
data_owner
|
102
|
+
data_owner:,
|
103
|
+
public_attrs:
|
100
104
|
)
|
101
105
|
unless payload.valid?
|
102
106
|
error_message = "Payload validation failed: #{payload.errors.full_messages.join(', ')}"
|
@@ -107,8 +111,9 @@ module LoggableActivity
|
|
107
111
|
end
|
108
112
|
|
109
113
|
# Encrypts the attributes for the record.
|
110
|
-
def encrypt_attributes(record, secret_key)
|
111
|
-
|
114
|
+
def encrypt_attributes(record, secret_key, options = {})
|
115
|
+
loggable_attrs = options[:loggable_attrs] || record.class.loggable_attrs
|
116
|
+
encrypt_attrs(record.attributes, loggable_attrs, secret_key)
|
112
117
|
end
|
113
118
|
|
114
119
|
# Encrypt one attributes for only loggable_attrs, configured
|
@@ -118,6 +123,10 @@ module LoggableActivity
|
|
118
123
|
end
|
119
124
|
end
|
120
125
|
|
126
|
+
def public_attributes(record)
|
127
|
+
record.attributes.slice(*record.class.public_attrs)
|
128
|
+
end
|
129
|
+
|
121
130
|
# Encrypt a single attribute.
|
122
131
|
def encrypt_attr(value, secret_key)
|
123
132
|
::LoggableActivity::Encryption.encrypt(value, secret_key)
|
@@ -112,12 +112,13 @@ module LoggableActivity
|
|
112
112
|
@payloads << ::LoggableActivity::Payload.new(
|
113
113
|
encryption_key:,
|
114
114
|
record_id: nil,
|
115
|
-
record_type:
|
115
|
+
record_type: record.class.name,
|
116
116
|
encrypted_record_name:,
|
117
117
|
encrypted_attrs:,
|
118
118
|
related_to_activity_as:,
|
119
119
|
data_owner: true,
|
120
120
|
route: '',
|
121
|
+
public_attrs: public_attributes(record),
|
121
122
|
current_payload: true
|
122
123
|
)
|
123
124
|
encryption_key
|
@@ -60,7 +60,7 @@ module LoggableActivity
|
|
60
60
|
data_owner = relation_config['data_owner']
|
61
61
|
options = { related_to_activity_as: 'has_many_payload', current_payload: true, data_owner: }
|
62
62
|
records.each do |record|
|
63
|
-
record.disable_hooks
|
63
|
+
record.disable_hooks!
|
64
64
|
build_encrypted_payload(record, options)
|
65
65
|
end
|
66
66
|
end
|
@@ -71,13 +71,20 @@ module LoggableActivity
|
|
71
71
|
record = @record.send(relation)
|
72
72
|
return if record.nil?
|
73
73
|
|
74
|
+
record.disable_hooks!
|
75
|
+
|
74
76
|
data_owner = relation_config['data_owner']
|
75
77
|
options =
|
76
|
-
{
|
78
|
+
{
|
79
|
+
related_to_activity_as: 'has_one_payload',
|
80
|
+
current_payload: true, data_owner:,
|
81
|
+
loggable_attrs: relation_config['loggable_attrs']
|
82
|
+
}
|
77
83
|
|
78
84
|
build_encrypted_payload(record, options)
|
79
85
|
end
|
80
86
|
|
87
|
+
# Builds the payload for a belongs_to relation.
|
81
88
|
def build_belongs_to_payload(relation_config)
|
82
89
|
relation = (relation_config['belongs_to']).to_s
|
83
90
|
record = @record.send(relation)
|
@@ -16,6 +16,7 @@ module LoggableActivity
|
|
16
16
|
# Builds the primary payload.
|
17
17
|
def build_primary_update_payload
|
18
18
|
previous_values, current_values = saved_changes(@record)
|
19
|
+
public_attrs = updated_public_attrs(current_values.slice(*@public_attrs), previous_values.slice(*@public_attrs))
|
19
20
|
previous_values = previous_values.slice(*@loggable_attrs)
|
20
21
|
current_values = current_values.slice(*@loggable_attrs)
|
21
22
|
options = { related_to_activity_as: 'primary_update_payload', current_payload: true, data_owner: true }
|
@@ -24,6 +25,7 @@ module LoggableActivity
|
|
24
25
|
@record,
|
25
26
|
current_values,
|
26
27
|
previous_values,
|
28
|
+
public_attrs,
|
27
29
|
options
|
28
30
|
)
|
29
31
|
end
|
@@ -92,6 +94,12 @@ module LoggableActivity
|
|
92
94
|
loggable_attrs = relation_config['loggable_attrs']
|
93
95
|
return if previous_values == current_values
|
94
96
|
|
97
|
+
public_attributes = relation_config['public_attrs']
|
98
|
+
public_attrs = updated_public_attrs(
|
99
|
+
current_values.slice(*public_attributes),
|
100
|
+
previous_values.slice(*public_attributes)
|
101
|
+
)
|
102
|
+
|
95
103
|
previous_values = previous_values.slice(*loggable_attrs)
|
96
104
|
data_owner = relation_config['data_owner']
|
97
105
|
options = { related_to_activity_as: 'has_many_update_payload', current_payload: true, data_owner: }
|
@@ -100,6 +108,7 @@ module LoggableActivity
|
|
100
108
|
record,
|
101
109
|
current_values,
|
102
110
|
previous_values,
|
111
|
+
public_attrs,
|
103
112
|
options
|
104
113
|
)
|
105
114
|
end
|
@@ -119,9 +128,14 @@ module LoggableActivity
|
|
119
128
|
return nil if record.nil?
|
120
129
|
|
121
130
|
previous_values, current_values = changes_to_save(record)
|
122
|
-
loggable_attrs =
|
131
|
+
loggable_attrs = relation_config['loggable_attrs']
|
123
132
|
return if previous_values == current_values
|
124
133
|
|
134
|
+
public_attrs = updated_public_attrs(
|
135
|
+
current_values.slice(*record.class.public_attrs),
|
136
|
+
previous_values.slice(*record.class.public_attrs)
|
137
|
+
)
|
138
|
+
|
125
139
|
previous_values = previous_values.slice(*loggable_attrs)
|
126
140
|
current_values = current_values.slice(*loggable_attrs)
|
127
141
|
data_owner = relation_config['data_owner']
|
@@ -131,6 +145,7 @@ module LoggableActivity
|
|
131
145
|
record,
|
132
146
|
current_values,
|
133
147
|
previous_values,
|
148
|
+
public_attrs,
|
134
149
|
options
|
135
150
|
)
|
136
151
|
end
|
@@ -148,8 +163,20 @@ module LoggableActivity
|
|
148
163
|
{ changes: }
|
149
164
|
end
|
150
165
|
|
166
|
+
def updated_public_attrs(current_values, previous_values)
|
167
|
+
changes = []
|
168
|
+
|
169
|
+
previous_values.each do |key, from_value|
|
170
|
+
from = from_value
|
171
|
+
to_value = current_values[key]
|
172
|
+
to = to_value
|
173
|
+
changes << { key => { from:, to: } }
|
174
|
+
end
|
175
|
+
{ changes: }
|
176
|
+
end
|
177
|
+
|
151
178
|
# Builds the encrypted update payload for a record.
|
152
|
-
def build_encrypted_update_payload(record, current_values, previous_values, options = {})
|
179
|
+
def build_encrypted_update_payload(record, current_values, previous_values, public_attrs, options = {})
|
153
180
|
encryption_key = ::LoggableActivity::EncryptionKey.for_record(record)
|
154
181
|
|
155
182
|
encrypted_attrs = encrypted_update_attrs(
|
@@ -162,6 +189,7 @@ module LoggableActivity
|
|
162
189
|
record,
|
163
190
|
encryption_key,
|
164
191
|
encrypted_attrs,
|
192
|
+
public_attrs,
|
165
193
|
options
|
166
194
|
)
|
167
195
|
end
|
data/lib/loggable_activity.rb
CHANGED
@@ -1,16 +1,53 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
3
|
+
require 'loggable_activity/version'
|
4
|
+
require 'loggable_activity/engine'
|
5
|
+
require 'loggable_activity/hooks'
|
6
|
+
require 'loggable_activity/activity'
|
7
|
+
require 'loggable_activity/configuration'
|
8
|
+
require 'loggable_activity/encryption'
|
9
|
+
require 'loggable_activity/encryption_key'
|
10
|
+
require 'loggable_activity/data_owner'
|
11
|
+
require 'loggable_activity/payload'
|
12
|
+
require 'loggable_activity/error'
|
13
|
+
require 'loggable_activity/sanitizer'
|
14
|
+
require 'loggable_activity/services/base_payloads_builder'
|
15
|
+
require 'loggable_activity/services/payloads_builder'
|
16
|
+
require 'loggable_activity/services/update_payloads_builder'
|
17
|
+
require 'loggable_activity/services/destroy_payloads_builder'
|
18
|
+
require 'loggable_activity/concerns/current_user'
|
19
|
+
require 'kaminari'
|
20
|
+
|
21
|
+
# LoggableActivity
|
22
|
+
#
|
23
|
+
# The LoggableActivity module provides a comprehensive solution for tracking and logging
|
24
|
+
# user activities within a Rails application. It offers a flexible and extensible framework
|
25
|
+
# for capturing, encrypting, and storing activity data, ensuring that sensitive information
|
26
|
+
# is handled securely.
|
27
|
+
#
|
28
|
+
# Features:
|
29
|
+
# - Activity Logging: Captures user actions across the application, providing insights into user behavior.
|
30
|
+
# - Encryption: Ensures that logged data is encrypted, safeguarding user privacy and data security.
|
31
|
+
# - Configuration: Offers customizable options to tailor the logging mechanism to specific application needs.
|
32
|
+
# - Extensibility: Designed to be extensible, allowing developers to add custom logging capabilities as needed.
|
33
|
+
#
|
34
|
+
# Components:
|
35
|
+
# - Hooks: Mechanisms to hook into application events for logging.
|
36
|
+
# - Activity: The core model representing logged activities.
|
37
|
+
# - Configuration: Manages configuration settings for the logging mechanism.
|
38
|
+
# - Encryption: Handles the encryption and decryption of logged data.
|
39
|
+
# - DataOwner: Identifies the owner of the logged data.
|
40
|
+
# - Payload: Structures the data to be logged.
|
41
|
+
# - Error: Defines custom error types for the logging process.
|
42
|
+
# - Sanitizer: Provides data sanitization utilities.
|
43
|
+
# - Services: Contains services for building and managing payloads.
|
44
|
+
# - Concerns: Includes concerns for integrating with application models and controllers.
|
45
|
+
#
|
46
|
+
# Usage:
|
47
|
+
# To use LoggableActivity, include it in your Rails application and configure it according to your needs.
|
48
|
+
#
|
49
|
+
# This module is designed to be both powerful and easy to integrate, providing a solid foundation for activity logging.
|
50
|
+
module LoggableActivity
|
51
|
+
mattr_accessor :actor_class
|
52
|
+
mattr_accessor :config_file_path
|
53
|
+
end
|