vert-core 1.0.9 → 1.0.11

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: 5e9ceee576cdddacc533a45290cde686730de79c57c0a20b8398cf621c0fc65c
4
- data.tar.gz: 99d8f01a4d8de26934bfd1be229862e1662a75ae4676a6800c8b29fd7bcb48d5
3
+ metadata.gz: 82f52d9b506df3db8d9e850f37246afbc098ae3577c592e0a552fce56c79df51
4
+ data.tar.gz: c3d872ffbad8e25a96ad872d0c3e59c9f135d2b3b3f27d44cb9e807fab1bd1de
5
5
  SHA512:
6
- metadata.gz: 3a17deed08b37000bd9be258c3c7b5218c9bf112f8f144f08199fccad3341e7b696c31c145b80966ffa50faf3bfd784330ba848f2a641fcb51ba2447cd519362
7
- data.tar.gz: 881df24d6e3c2f8b50e2d3400feb771712f7a1f94f80bffe2e26444a7087dae4e008902f014921e3e4fd292e666b8ab4b6e9a5ecfe0e6a8bbdb695286ea3b90b
6
+ metadata.gz: cc70bbe75899d1c4c452da1df889a4d53870a3e510f23b7484cfe02b698a57bd00f907f2a90df3ff342e500c99f29a94f315945b091d6e80aca18d07093cf799
7
+ data.tar.gz: 7867103516fb0bc0583b09eee4eb228f61835317676a4c0f03e5baf1497330bcb43efda2da3b8a7e7d58377ad21247c21e834aef802ea6b226fe277a04532dd8
@@ -7,9 +7,9 @@ module Vert
7
7
  def set_context(tenant_id:, company_id: nil, user_id: nil)
8
8
  return unless tenant_id.present?
9
9
  connection = ActiveRecord::Base.connection
10
- connection.execute("SET LOCAL app.current_tenant_id = #{connection.quote(tenant_id.to_s)}")
11
- connection.execute("SET LOCAL app.current_company_id = #{connection.quote(company_id.to_s)}") if company_id.present?
12
- connection.execute("SET LOCAL app.current_user_id = #{connection.quote(user_id.to_s)}") if user_id.present?
10
+ connection.execute("SET app.current_tenant_id = #{connection.quote(tenant_id.to_s)}")
11
+ connection.execute("SET app.current_company_id = #{connection.quote(company_id.to_s)}") if company_id.present?
12
+ connection.execute("SET app.current_user_id = #{connection.quote(user_id.to_s)}") if user_id.present?
13
13
  Vert::Current.rls_configured = true
14
14
  rescue StandardError => e
15
15
  Rails.logger.error("[Vert::RLS] #{e.message}") if defined?(Rails)
@@ -21,6 +21,13 @@ module Vert
21
21
  Vert::Current.reset_all
22
22
  ConnectionHandler.reset_context if Vert.config.enable_rls
23
23
  end
24
+
25
+ # Convenience wrapper for consumers that want to explicitly mark
26
+ # the RLS-protected block. Context is already set by work_with_params,
27
+ # so this simply yields the block.
28
+ def with_rls_context
29
+ yield
30
+ end
24
31
  end
25
32
 
26
33
  class BaseConsumer
data/lib/vert/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vert
4
- VERSION = "1.0.9"
4
+ VERSION = "1.0.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vert-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vert Team