effective_resources 2.28.0 → 2.29.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf2ef756b2bbdecbc58084d754dc2174bbd3c6ac3bf3109bfeaac0b5eb90405d
|
4
|
+
data.tar.gz: ac73d16805a6a7b2a693d73cc22a0c5d06ea955079478f2beff574a07c8d7708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dde2d18c768d7940950d5aa0aaa78b41090d96a14067bb9f913027da55ba04a6b6d396fa8bacdcbc9bcddd1c64a203427c9096bd142da9ccbfe8c7ec321339d5
|
7
|
+
data.tar.gz: d834d2b0f76383055355aeb261d7871bfcefb983661e1c228fbcca8c5148730f0cf50dfdc859237f8091a63d197c995d7588638b059467ad4997d2ee85158487
|
@@ -81,7 +81,7 @@ module Effective
|
|
81
81
|
end
|
82
82
|
|
83
83
|
if respond_to?(:current_user) && resource.respond_to?(:created_by=)
|
84
|
-
resource.created_by ||= current_user
|
84
|
+
resource.created_by ||= (impersonation_user || current_user)
|
85
85
|
end
|
86
86
|
|
87
87
|
resource.assign_attributes(send(resource_params_method_name))
|
@@ -142,7 +142,7 @@ module Effective
|
|
142
142
|
end
|
143
143
|
|
144
144
|
if respond_to?(:current_user) && resource.respond_to?(:updated_by=)
|
145
|
-
resource.updated_by ||= current_user
|
145
|
+
resource.updated_by ||= (impersonation_user || current_user)
|
146
146
|
end
|
147
147
|
|
148
148
|
resource.assign_attributes(send(resource_params_method_name))
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Effective
|
2
|
+
module CrudController
|
3
|
+
module Users
|
4
|
+
|
5
|
+
# If we're impersonating, this is the original user
|
6
|
+
def impersonation_user
|
7
|
+
return unless current_user.present?
|
8
|
+
return unless session[:impersonation_user_id].present?
|
9
|
+
|
10
|
+
@impersonation_user ||= current_user.class.find(session[:impersonation_user_id])
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -10,6 +10,7 @@ module Effective
|
|
10
10
|
include Effective::CrudController::Respond
|
11
11
|
include Effective::CrudController::Save
|
12
12
|
include Effective::CrudController::Submits
|
13
|
+
include Effective::CrudController::Users
|
13
14
|
|
14
15
|
included do
|
15
16
|
define_callbacks :resource_render, :resource_before_save, :resource_after_save, :resource_after_commit, :resource_error
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- app/controllers/concerns/effective/crud_controller/respond.rb
|
198
198
|
- app/controllers/concerns/effective/crud_controller/save.rb
|
199
199
|
- app/controllers/concerns/effective/crud_controller/submits.rb
|
200
|
+
- app/controllers/concerns/effective/crud_controller/users.rb
|
200
201
|
- app/controllers/concerns/effective/flash_messages.rb
|
201
202
|
- app/controllers/concerns/effective/impersonation_controller/destroy.rb
|
202
203
|
- app/controllers/concerns/effective/impersonation_controller/impersonate.rb
|