thecore_backend_commons 3.1.3 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97741971ca6bd986ce48c1237ce588165731d323c11aa445db719d54bfc456b8
|
4
|
+
data.tar.gz: f2ca229b0010a509c2f1519588625f4a5873f7f949a732c701fe91a156667628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a3e601c21af2052e7c5399a8a3ce07c20e4e1b02b3163a81f91aa92c196288a619627e13ac9d4b2a1762283472e78fa1ae7334e168dae12eb3360e7d7b0a94d
|
7
|
+
data.tar.gz: '0709885ccaf4e4347f314e6599ca42f8da0ad982e9bb229c3d44dae3d4d29bc066ec4a3f4f190ce4c965e9906fbc93a0acf6d6dee95b37059edd57368e0c354f'
|
@@ -1,3 +1,3 @@
|
|
1
1
|
Rails.application.config.active_storage.configure :Disk, root: Rails.root.join("storage")
|
2
2
|
Rails.application.config.action_mailer.delivery_method = :smtp
|
3
|
-
Rails.application.config.action_cable.allowed_request_origins = [ ENV["FRONTEND_URL"].presence || /http:\/\/*/, ENV["BACKEND_URL"].presence || /http
|
3
|
+
Rails.application.config.action_cable.allowed_request_origins = [ ENV["FRONTEND_URL"].presence || /http:\/\/*/, ENV["BACKEND_URL"].presence || /http:\/\/*/, "https://localhost:8100" ].uniq
|
@@ -10,15 +10,23 @@ module ApplicationRecordConcern
|
|
10
10
|
after_rollback :message_ko
|
11
11
|
|
12
12
|
def validation_ko
|
13
|
-
ActionCable.server.broadcast("messages",
|
13
|
+
ActionCable.server.broadcast("messages", build_message(false, false, self.errors.full_messages.uniq)) if self.errors.any? && !is_model_forbidden
|
14
14
|
end
|
15
15
|
|
16
16
|
def message_ok
|
17
|
-
ActionCable.server.broadcast("messages",
|
17
|
+
ActionCable.server.broadcast("messages", build_message(true, true, [])) unless is_model_forbidden
|
18
18
|
end
|
19
19
|
|
20
20
|
def message_ko
|
21
|
-
ActionCable.server.broadcast("messages",
|
21
|
+
ActionCable.server.broadcast("messages", build_message(false, true, [])) unless is_model_forbidden
|
22
|
+
end
|
23
|
+
|
24
|
+
def is_model_forbidden
|
25
|
+
[ 'User', 'Role' ].include?(self.class.name)
|
26
|
+
end
|
27
|
+
|
28
|
+
def build_message success, valid, errors
|
29
|
+
{ topic: :record, action: detect_action, class: self.class.name, success: success, valid: valid, errors: errors, record: self}
|
22
30
|
end
|
23
31
|
|
24
32
|
def detect_action
|
@@ -12,7 +12,10 @@ module CableConnectionConcern
|
|
12
12
|
protected
|
13
13
|
|
14
14
|
def find_verified_user # this checks whether a user is authenticated with devise
|
15
|
-
|
15
|
+
m = request.query_parameters["token"]
|
16
|
+
|
17
|
+
body = ::HashWithIndifferentAccess.new(::JWT.decode(m, ::Rails.application.credentials.dig(:secret_key_base).presence||ENV["SECRET_KEY_BASE"], false)[0]) rescue nil
|
18
|
+
if verified_user = (env['warden'].user.presence || User.find_by(id: body[:user_id]))
|
16
19
|
verified_user
|
17
20
|
else
|
18
21
|
reject_unauthorized_connection
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thecore_backend_commons
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabriele Tassoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_auth_commons
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
|
-
rubygems_version: 3.
|
191
|
+
rubygems_version: 3.4.10
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: Thecore 3 foundations for the Web UI Backend.
|