thecore_backend_commons 3.0.8 → 3.0.9

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: 4eafdf7afd79eee6e3186550a50f09383666bd115463885e4bb1a50547038473
4
- data.tar.gz: 461f1e9f3955d015de5d192577e6ffc88f1854d51246aef3fab8380be2063800
3
+ metadata.gz: f945a5a988302320da13aacff1e60ac457bcfa90e821f7d2f3bd8c504814217f
4
+ data.tar.gz: 17f5d7df875584740df6e1445cec02bda7e8222cfe7e33586c5681c054baead5
5
5
  SHA512:
6
- metadata.gz: ab0c2ad2a49925c006214187d554b0a2bec41c4e2a98a382c02c02e285c8e3889f2fb7778ef02b732d55dc513cf9d4b381fa9568e84848cda93b98d4aae57d04
7
- data.tar.gz: e5a136a0e3a2c89e25ce92e63fe38fa510a9ee3d836789c25780cd5dc05532238b2ef32b627949fb39449c7da3334f41c860ab475a846430657a8faf97b7d36d
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
@@ -1,6 +1,8 @@
1
1
  Rails.application.configure do
2
+
2
3
  config.after_initialize do
3
4
  Integer.send(:include, FixnumConcern)
4
5
  String.send(:include, StringConcern)
6
+ ApplicationCable::Connection.send(:include, CableConnectionConcern)
5
7
  end
6
8
  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.8
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-03-01 00:00:00.000000000 Z
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