activerecord-tenant-level-security 0.4.0 → 0.6.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: 60f9c934a6a5bdad1bfb2ac9ea2d3f961edbb099d2611d8630511ab4454bfeb3
4
- data.tar.gz: 9f2f5adc688fc7dbc983f108199c18332903e4ed97271fe7ad09275cb836c36a
3
+ metadata.gz: def87a150a6d3fe15b09121fe3d43aec96e367bde7179acb44ecd61f4d754533
4
+ data.tar.gz: eb5d065426f49c665ea202160aafcc10e46f82c40e0d951e4457152308261c12
5
5
  SHA512:
6
- metadata.gz: d96db12fb43d2df0302802d40297be218b77717f671d661ddc8a7c54d2930cdd230666c62980cb54e0750e70fdd53f86a3de8bcd00ec27affc3439164885105b
7
- data.tar.gz: f2e30cfe9a512ec32901a8a2d51c98dbd34c7bbe88018844c7c48d6e3c279b91e30598edaa9ef88c8e105336262179d980cdd9dcd64492615ca2ca93cbee612b
6
+ metadata.gz: 7a4f84edba75ba3152e78b18ab9e356c5b0a756d65892ad8dd83a9fa930088902d8f84b294591394051408315a46e5593505507b3b3bd0cdf50845c056f83067
7
+ data.tar.gz: e3da985f057236d469825316690c9b5469691196bd6c4fb6973c0db58f133434a118e4ffc8d4dab2db6c0c1fef306bd18d95c09b5c40b2d2358f6e4e86cc9769
data/.circleci/config.yml CHANGED
@@ -28,6 +28,6 @@ workflows:
28
28
  - test:
29
29
  matrix:
30
30
  parameters:
31
- ruby: ['ruby:3.2', 'ruby:3.3', 'ruby:3.4']
32
- rails: ['rails_7.1', 'rails_7.2', 'rails_8.0']
33
- postgres: ['postgres:13.21', 'postgres:14.18', 'postgres:15.13', 'postgres:16.9', 'postgres:17.5']
31
+ ruby: ['ruby:3.3', 'ruby:3.4', 'ruby:4.0']
32
+ rails: ['rails_7.2', 'rails_8.0', 'rails_8.1']
33
+ postgres: ['postgres:14.20', 'postgres:15.15', 'postgres:16.11', 'postgres:17.7', 'postgres:18.1']
data/CHANGELOG.md CHANGED
@@ -1,9 +1,22 @@
1
+ ## v0.6.0 (2026-03-11)
2
+
3
+ ### Breaking Changes
4
+ - [#37](https://github.com/kufu/activerecord-tenant-level-security/pull/37): Drop support for Ruby 3.2. Add support for Ruby 4.0.
5
+
6
+ ## v0.5.0 (2025-12-12)
7
+
8
+ ### Breaking Changes
9
+ - [#34](https://github.com/kufu/activerecord-tenant-level-security/pull/34): Drop support for Ruby 3.1 and Rails 7.0
10
+
11
+ ### Enhancements
12
+ - [#33](https://github.com/kufu/activerecord-tenant-level-security/pull/33): Cache tenant_id to reduce the risk of network errors
13
+
1
14
  ## v0.4.0 (2025-05-23)
2
15
 
3
16
  ### Breaking Changes
4
17
 
5
- - [#27](https://github.com/kufu/activerecord-tenant-level-security/pull/27): CI against Ruby 3.4, drop Ruby 3.1, Rails 7.1
6
- - Drop support for Ruby 3.1 and Rails 7.1
18
+ - [#27](https://github.com/kufu/activerecord-tenant-level-security/pull/27): CI against Ruby 3.4, drop Ruby 3.1, Rails 7.0
19
+ - Drop support for Ruby 3.1 and Rails 7.0
7
20
 
8
21
  ## v0.3.0 (2024-08-06)
9
22
 
data/README.md CHANGED
@@ -193,7 +193,25 @@ end
193
193
 
194
194
  ## Development
195
195
 
196
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
196
+ After checking out the repo, run `bin/setup` to install dependencies.
197
+
198
+ To run tests locally, start PostgreSQL with Docker Compose and then execute the test suite:
199
+
200
+ ```bash
201
+ docker compose up -d
202
+ bundle exec rake spec
203
+ ```
204
+
205
+ The test helper connects to PostgreSQL at `localhost:5432` with the `postgres` user/password (`postgres`), and creates the app role (`activerecord_tenant_level_security_test`) when needed.
206
+
207
+ If you want a clean database state (for example, when re-initializing roles), recreate the database volume:
208
+
209
+ ```bash
210
+ docker compose down -v
211
+ docker compose up -d
212
+ ```
213
+
214
+ You can also run `bin/console` for an interactive prompt that will allow you to experiment.
197
215
 
198
216
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
199
217
 
@@ -24,8 +24,8 @@ Gem::Specification.new do |spec|
24
24
  end
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "activerecord", ">= 7.1"
28
- spec.add_dependency "activesupport", ">= 7.1"
27
+ spec.add_dependency "activerecord", ">= 7.2"
28
+ spec.add_dependency "activesupport", ">= 7.2"
29
29
  spec.add_dependency "pg", ">= 1.0"
30
30
 
31
31
  spec.add_development_dependency "bundler", ">= 2.0"
data/compose.yml ADDED
@@ -0,0 +1,11 @@
1
+ services:
2
+ db:
3
+ image: postgres:17
4
+ ports:
5
+ - '5432:5432'
6
+ volumes:
7
+ - db:/var/lib/postgresql/data
8
+ environment:
9
+ POSTGRES_PASSWORD: 'postgres'
10
+ volumes:
11
+ db:
@@ -1,5 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem "rails", "~> 7.1.1"
3
+ gem "rails", "~> 8.1.0"
4
4
 
5
5
  gemspec path: "../"
@@ -3,9 +3,11 @@ module TenantLevelSecurity
3
3
  module Middleware
4
4
  class Client
5
5
  def call(worker_class, job, queue, redis_pool)
6
- tenant_id = TenantLevelSecurity.current_session_tenant_id
7
- if tenant_id.present?
8
- job['tenant_level_security'] ||= { id: tenant_id }
6
+ unless job.key?('tenant_level_security')
7
+ tenant_id = TenantLevelSecurity.current_session_tenant_id
8
+ if tenant_id.present?
9
+ job['tenant_level_security'] = { id: tenant_id }
10
+ end
9
11
  end
10
12
 
11
13
  yield
@@ -1,3 +1,3 @@
1
1
  module TenantLevelSecurity
2
- VERSION = '0.4.0'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-tenant-level-security
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SmartHR
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-23 00:00:00.000000000 Z
11
+ date: 2026-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '7.1'
19
+ version: '7.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '7.1'
26
+ version: '7.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '7.1'
33
+ version: '7.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '7.1'
40
+ version: '7.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pg
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -115,9 +115,10 @@ files:
115
115
  - activerecord-tenant-level-security.gemspec
116
116
  - bin/console
117
117
  - bin/setup
118
- - gemfiles/rails_7.1.gemfile
118
+ - compose.yml
119
119
  - gemfiles/rails_7.2.gemfile
120
120
  - gemfiles/rails_8.0.gemfile
121
+ - gemfiles/rails_8.1.gemfile
121
122
  - lib/activerecord-tenant-level-security.rb
122
123
  - lib/activerecord-tenant-level-security/command_recorder.rb
123
124
  - lib/activerecord-tenant-level-security/schema_dumper.rb
@@ -131,7 +132,7 @@ licenses:
131
132
  metadata:
132
133
  homepage_uri: https://github.com/kufu/activerecord-tenant-level-security
133
134
  source_code_uri: https://github.com/kufu/activerecord-tenant-level-security
134
- changelog_uri: https://github.com/kufu/activerecord-tenant-level-security/blob/v0.4.0/CHANGELOG.md
135
+ changelog_uri: https://github.com/kufu/activerecord-tenant-level-security/blob/v0.6.0/CHANGELOG.md
135
136
  post_install_message:
136
137
  rdoc_options: []
137
138
  require_paths:
@@ -147,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
148
  - !ruby/object:Gem::Version
148
149
  version: '0'
149
150
  requirements: []
150
- rubygems_version: 3.5.16
151
+ rubygems_version: 3.5.22
151
152
  signing_key:
152
153
  specification_version: 4
153
154
  summary: An Active Record extension for Multitenancy with PostgreSQL Row Level Security