thecore_backend_commons 3.0.8 → 3.0.9
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: f945a5a988302320da13aacff1e60ac457bcfa90e821f7d2f3bd8c504814217f
|
4
|
+
data.tar.gz: 17f5d7df875584740df6e1445cec02bda7e8222cfe7e33586c5681c054baead5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 045c8bebc2f8cfca9427e90955a5a6d0651f9a36b808fe848121699bf41e0495af70c14f6baa2e0ca9c07c5880085e60522be7225c3057b23eaff093315fbe03
|
7
|
+
data.tar.gz: '025857799451bfa92eb226751bc2605510e600ba1e605bfbcefdba4c772a1e754b06285ed3dd0942845c1667be25b928e816b00fead8719c85a57c2c3f55de04'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class ActivityLogChannel < ApplicationCable::Channel
|
2
|
+
def subscribed
|
3
|
+
stream_from "messages"
|
4
|
+
end
|
5
|
+
|
6
|
+
def unsubscribed
|
7
|
+
# Any cleanup needed when channel is unsubscribed
|
8
|
+
end
|
9
|
+
|
10
|
+
# https://cableready.stimulusreflex.com/troubleshooting/#verify-actioncable
|
11
|
+
|
12
|
+
def receive(data)
|
13
|
+
puts data["message"]
|
14
|
+
ActionCable.server.broadcast("messages", "ActionCable is connected")
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_support/concern'
|
2
|
+
|
3
|
+
module CableConnectionConcern
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
included do
|
6
|
+
identified_by :current_user
|
7
|
+
|
8
|
+
def connect
|
9
|
+
self.current_user = find_verified_user
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def find_verified_user # this checks whether a user is authenticated with devise
|
15
|
+
if verified_user = env['warden'].user
|
16
|
+
verified_user
|
17
|
+
else
|
18
|
+
reject_unauthorized_connection
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
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.0.
|
4
|
+
version: 3.0.9
|
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-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thecore_auth_commons
|
@@ -146,10 +146,12 @@ extra_rdoc_files: []
|
|
146
146
|
files:
|
147
147
|
- README.md
|
148
148
|
- Rakefile
|
149
|
+
- app/channels/activity_log_channel.rb
|
149
150
|
- config/initializers/abilities.rb
|
150
151
|
- config/initializers/add_to_db_migrations.rb
|
151
152
|
- config/initializers/after_initialize.rb
|
152
153
|
- config/initializers/application_config.rb
|
154
|
+
- config/initializers/concern_cable_connection.rb
|
153
155
|
- config/initializers/concern_integer.rb
|
154
156
|
- config/initializers/concern_string.rb
|
155
157
|
- config/initializers/extension_nil.rb
|