rls_multi_tenant 0.1.7 → 0.1.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: ef549a91c89a2d4c0b4ee20af9711d31fb807b3b61d115c6655e491a35ef1bcc
4
- data.tar.gz: 4aabdf36264d22878785a8e737b67c7dca87a4700989d149dda0e72b13cbc6be
3
+ metadata.gz: b45cd6b953bae2321b231e78d3883eba2432803c44e036e4d6845269aef3633b
4
+ data.tar.gz: cf4f8900c3577c532fb82638a4064b239dd99611136b282560d06c6ba2e396bf
5
5
  SHA512:
6
- metadata.gz: 31152dc5b94a7f4a9c12ec3eaf3aed96ca8fc8e1080e2918b68b85a65b9d9d8fa34f7ae8c7472b2daa77dafa5d00f368a362d2473732c940c26e860bc4a93155
7
- data.tar.gz: 1bbab04fd97a40d5f07254f0f75e1ed113950309d1029840238dc572a5739a4f76e808b1e14b95f936334079c1776112401be9bdbff76ece4e794d2d30c8ad8a
6
+ metadata.gz: eacdf26741563c4a9d4a25f6db59d55e1ebc8035f6804d4f19695178f9cf9da3bdd49e04f09173b33c4641a2ef3024987091250b4fc0d32a6736720ff56c1feb
7
+ data.tar.gz: 82257c569f87e8beff78a914ecfc0948a281835a10306e71ff8238ca71e403b25c32845ed7e710a2ef890eaa68ec9f525f130811c4c1a1bca6e1d4a3948028bd
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- require:
1
+ plugins:
2
2
  - rubocop-rails
3
3
  - rubocop-rspec
4
4
 
@@ -22,7 +22,7 @@ Style/FrozenStringLiteralComment:
22
22
  Style/ClassAndModuleChildren:
23
23
  Enabled: false
24
24
 
25
- Metrics/LineLength:
25
+ Layout/LineLength:
26
26
  Max: 120
27
27
 
28
28
  Metrics/BlockLength:
data/README.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # RLS Multi-Tenant
2
2
 
3
+ [![CI](https://github.com/codingways/rls_multi_tenant/actions/workflows/simple.yml/badge.svg)](https://github.com/codingways/rls_multi_tenant/actions/workflows/simple.yml)
4
+ [![Ruby](https://img.shields.io/badge/ruby-3.0%2B-red.svg)](https://www.ruby-lang.org/)
5
+ [![Rails](https://img.shields.io/badge/rails-6.0%2B-red.svg)](https://rubyonrails.org/)
6
+ [![Gem Version](https://badge.fury.io/rb/rls_multi_tenant.svg)](https://badge.fury.io/rb/rls_multi_tenant)
7
+ [![Downloads](https://img.shields.io/gem/dt/rls_multi_tenant.svg)](https://rubygems.org/gems/rls_multi_tenant)
8
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
9
+
3
10
  A Rails gem that provides PostgreSQL Row Level Security (RLS) based multi-tenancy for Rails applications.
4
11
 
5
12
  ## Features
@@ -23,9 +23,9 @@ class CreateAppUser < ActiveRecord::Migration[<%= Rails.version.to_f %>]
23
23
  execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO #{app_user};"
24
24
  execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE, SELECT ON SEQUENCES TO #{app_user};"
25
25
 
26
- # Grant permissions on system tables
27
- execute "GRANT SELECT ON TABLE schema_migrations TO #{app_user};"
28
- execute "GRANT SELECT ON TABLE ar_internal_metadata TO #{app_user};"
26
+ # Grant permissions on all existing tables
27
+ execute "GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO #{app_user};"
28
+ execute "GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO #{app_user};"
29
29
  end
30
30
 
31
31
  def down
@@ -35,6 +35,10 @@ class CreateAppUser < ActiveRecord::Migration[<%= Rails.version.to_f %>]
35
35
  execute "REVOKE ALL ON SCHEMA public FROM #{app_user};"
36
36
  execute "REVOKE CONNECT ON DATABASE #{ActiveRecord::Base.connection.current_database} FROM #{app_user};"
37
37
 
38
+ # Revoke permissions from all existing tables and sequences
39
+ execute "REVOKE ALL ON ALL TABLES IN SCHEMA public FROM #{app_user};"
40
+ execute "REVOKE ALL ON ALL SEQUENCES IN SCHEMA public FROM #{app_user};"
41
+
38
42
  # Revoke default permissions for future tables in public schema
39
43
  execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLES FROM #{app_user};"
40
44
  execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE USAGE, SELECT ON SEQUENCES FROM #{app_user};"
@@ -48,8 +48,8 @@ module RlsMultiTenant
48
48
  private
49
49
 
50
50
  def skip_validation?
51
- # Skip validation if we're running install generator
52
- return true if ARGV.any? { |arg| arg.include?('rls_multi_tenant:install') }
51
+ # Skip validation if we're running an install or setup generator
52
+ return true if ARGV.any? { |arg| arg.include?('rls_multi_tenant:install') || arg.include?('rls_multi_tenant:setup') }
53
53
 
54
54
  # Skip validation if we're in admin mode (set by db_as:admin task)
55
55
  return true if ENV['RLS_MULTI_TENANT_ADMIN_MODE'] == 'true'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RlsMultiTenant
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.9"
5
5
  end
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
34
34
  # Dependencies
35
35
  spec.add_dependency "rails", ">= 6.0", "< 9.0"
36
36
  spec.add_dependency "pg", ">= 1.0", "< 3.0"
37
+ spec.add_dependency "ostruct", ">= 0.1.0"
37
38
 
38
39
  # Development dependencies
39
40
  spec.add_development_dependency "rspec-rails", "~> 6.0"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rls_multi_tenant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coding Ways
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-09-16 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: rails
@@ -50,6 +49,20 @@ dependencies:
50
49
  - - "<"
51
50
  - !ruby/object:Gem::Version
52
51
  version: '3.0'
52
+ - !ruby/object:Gem::Dependency
53
+ name: ostruct
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: 0.1.0
59
+ type: :runtime
60
+ prerelease: false
61
+ version_requirements: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.1.0
53
66
  - !ruby/object:Gem::Dependency
54
67
  name: rspec-rails
55
68
  requirement: !ruby/object:Gem::Requirement
@@ -157,6 +170,7 @@ executables: []
157
170
  extensions: []
158
171
  extra_rdoc_files: []
159
172
  files:
173
+ - ".rspec"
160
174
  - ".rubocop.yml"
161
175
  - README.md
162
176
  - lib/rls_multi_tenant.rb
@@ -193,7 +207,6 @@ metadata:
193
207
  changelog_uri: https://github.com/codingways/rls_multi_tenant/blob/main/CHANGELOG.md
194
208
  bug_tracker_uri: https://github.com/codingways/rls_multi_tenant/issues
195
209
  documentation_uri: https://github.com/codingways/rls_multi_tenant#readme
196
- post_install_message:
197
210
  rdoc_options: []
198
211
  require_paths:
199
212
  - lib
@@ -208,8 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
221
  - !ruby/object:Gem::Version
209
222
  version: '0'
210
223
  requirements: []
211
- rubygems_version: 3.5.23
212
- signing_key:
224
+ rubygems_version: 3.6.9
213
225
  specification_version: 4
214
226
  summary: Rails gem for PostgreSQL Row Level Security (RLS) multi-tenant applications
215
227
  test_files: []