pg_rls 1.0.1 → 1.0.3
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 +4 -4
- data/.idea/.gitignore +8 -0
- data/.idea/git_toolbox_prj.xml +15 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/pg_rls.iml +237 -0
- data/.idea/vcs.xml +6 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +20 -0
- data/app/models/pg_rls/current.rb +2 -0
- data/app/models/pg_rls/tenant/searchable.rb +1 -1
- data/app/models/pg_rls/tenant/securable.rb +7 -30
- data/lib/pg_rls/active_record/connection_adapters/rls_tenant.rb +27 -0
- data/lib/pg_rls/active_record/connection_adapters.rb +1 -0
- data/lib/pg_rls/version.rb +1 -1
- data/rbs_collection.lock.yaml +113 -1
- data/sig/generators/pg_rls/active_record/active_record_generator.rbs +2 -2
- data/sig/pg_rls/active_record/connection_adapters/postgre_sql/grant_rls_user_privileges.rbs +1 -1
- data/sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_functions.rbs +6 -6
- data/sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_triggers.rbs +1 -1
- data/sig/pg_rls/active_record/connection_adapters/postgre_sql/rls_user_statements.rbs +15 -15
- data/sig/pg_rls/active_record/connection_adapters/postgre_sql/schema_statements.rbs +2 -2
- data/sig/pg_rls/active_record/connection_adapters.rbs +6 -9
- data/sig/pg_rls/active_record/database_shards.rbs +3 -3
- data/sig/pg_rls/active_support/string_ext.rbs +5 -5
- data/sig/pg_rls.rbs +2 -2
- data/sig/support/active_record.rbs +13 -22
- data/sig/support/active_support.rbs +1 -1
- data/sig/support/rails.rbs +5 -5
- metadata +11 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a75a646d5cd7efb87d4a4343d3577a307b2a4c8750a9a536d448205f3e4c59b8
|
|
4
|
+
data.tar.gz: 0b5f950a922336c4b8e343a21611dc1f299c934da8829a0b0d9f37862f04ef3e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9697b3afdb0b1489fbcf349c44c751f5fc8c495a8a3e10f59c91f2d23be4cc7576f44960c21964817c3d1dea7dbef88954907fdb0fb3641c1ada2eb3f723742b
|
|
7
|
+
data.tar.gz: e8894ef39e132e970d7527ed01057e737900be8f44014331442eb2e4397aa6b805f563ff89c38c575b355a480258305c0a446fd890d707b34735f6dee9068579
|
data/.idea/.gitignore
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GitToolBoxProjectSettings">
|
|
4
|
+
<option name="commitMessageIssueKeyValidationOverride">
|
|
5
|
+
<BoolValueOverride>
|
|
6
|
+
<option name="enabled" value="true" />
|
|
7
|
+
</BoolValueOverride>
|
|
8
|
+
</option>
|
|
9
|
+
<option name="commitMessageValidationEnabledOverride">
|
|
10
|
+
<BoolValueOverride>
|
|
11
|
+
<option name="enabled" value="true" />
|
|
12
|
+
</BoolValueOverride>
|
|
13
|
+
</option>
|
|
14
|
+
</component>
|
|
15
|
+
</project>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
data/.idea/pg_rls.iml
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="FacetManager">
|
|
4
|
+
<facet type="RailsFacetType" name="Ruby on Rails">
|
|
5
|
+
<configuration>
|
|
6
|
+
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_SUPPORT_REMOVED" VALUE="false" />
|
|
7
|
+
<RAILS_FACET_CONFIG_ID NAME="RAILS_TESTS_SOURCES_PATCHED" VALUE="true" />
|
|
8
|
+
<RAILS_FACET_CONFIG_ID NAME="RAILS_FACET_APPLICATION_ROOT" VALUE="$MODULE_DIR$" />
|
|
9
|
+
</configuration>
|
|
10
|
+
</facet>
|
|
11
|
+
</component>
|
|
12
|
+
<component name="ModuleRunConfigurationManager">
|
|
13
|
+
<shared />
|
|
14
|
+
</component>
|
|
15
|
+
<component name="NewModuleRootManager">
|
|
16
|
+
<content url="file://$MODULE_DIR$">
|
|
17
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
|
18
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
19
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
20
|
+
<excludeFolder url="file://$MODULE_DIR$/.bundle" />
|
|
21
|
+
<excludeFolder url="file://$MODULE_DIR$/components" />
|
|
22
|
+
<excludeFolder url="file://$MODULE_DIR$/log" />
|
|
23
|
+
<excludeFolder url="file://$MODULE_DIR$/public/packs" />
|
|
24
|
+
<excludeFolder url="file://$MODULE_DIR$/public/system" />
|
|
25
|
+
<excludeFolder url="file://$MODULE_DIR$/test/dummy/tmp/cache" />
|
|
26
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
27
|
+
<excludeFolder url="file://$MODULE_DIR$/vendor/bundle" />
|
|
28
|
+
<excludeFolder url="file://$MODULE_DIR$/vendor/cache" />
|
|
29
|
+
</content>
|
|
30
|
+
<orderEntry type="inheritedJdk" />
|
|
31
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="actioncable (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="actionmailbox (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="actionmailer (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="actionpack (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="actiontext (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="actionview (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="activejob (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="activemodel (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="activerecord (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="activestorage (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="ast (v2.4.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
44
|
+
<orderEntry type="library" scope="PROVIDED" name="base64 (v0.2.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
45
|
+
<orderEntry type="library" scope="PROVIDED" name="benchmark (v0.4.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
46
|
+
<orderEntry type="library" scope="PROVIDED" name="bigdecimal (v3.1.8, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
47
|
+
<orderEntry type="library" scope="PROVIDED" name="bootsnap (v1.18.4, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
48
|
+
<orderEntry type="library" scope="PROVIDED" name="builder (v3.3.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
49
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.5.16, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
50
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.9.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
51
|
+
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.3, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
52
|
+
<orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.4, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
53
|
+
<orderEntry type="library" scope="PROVIDED" name="connection_pool (v2.4.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
54
|
+
<orderEntry type="library" scope="PROVIDED" name="crass (v1.0.6, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
55
|
+
<orderEntry type="library" scope="PROVIDED" name="csv (v3.3.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
56
|
+
<orderEntry type="library" scope="PROVIDED" name="database_cleaner-active_record (v2.2.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
57
|
+
<orderEntry type="library" scope="PROVIDED" name="database_cleaner-core (v2.0.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
58
|
+
<orderEntry type="library" scope="PROVIDED" name="date (v3.4.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
59
|
+
<orderEntry type="library" scope="PROVIDED" name="docile (v1.4.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
60
|
+
<orderEntry type="library" scope="PROVIDED" name="drb (v2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
61
|
+
<orderEntry type="library" scope="PROVIDED" name="erubi (v1.13.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
62
|
+
<orderEntry type="library" scope="PROVIDED" name="ffi (v1.17.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
63
|
+
<orderEntry type="library" scope="PROVIDED" name="fileutils (v1.7.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
64
|
+
<orderEntry type="library" scope="PROVIDED" name="formatador (v1.1.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
65
|
+
<orderEntry type="library" scope="PROVIDED" name="globalid (v1.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
66
|
+
<orderEntry type="library" scope="PROVIDED" name="guard (v2.18.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
67
|
+
<orderEntry type="library" scope="PROVIDED" name="guard-compat (v1.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
68
|
+
<orderEntry type="library" scope="PROVIDED" name="guard-minitest (v2.4.6, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
69
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v1.14.6, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
70
|
+
<orderEntry type="library" scope="PROVIDED" name="io-console (v0.7.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
71
|
+
<orderEntry type="library" scope="PROVIDED" name="irb (v1.14.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
72
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v2.7.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
73
|
+
<orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.3, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
74
|
+
<orderEntry type="library" scope="PROVIDED" name="listen (v3.9.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
75
|
+
<orderEntry type="library" scope="PROVIDED" name="logger (v1.6.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
76
|
+
<orderEntry type="library" scope="PROVIDED" name="loofah (v2.24.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
77
|
+
<orderEntry type="library" scope="PROVIDED" name="lumberjack (v1.2.10, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
78
|
+
<orderEntry type="library" scope="PROVIDED" name="mail (v2.8.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
79
|
+
<orderEntry type="library" scope="PROVIDED" name="marcel (v1.0.4, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
80
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v1.1.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
81
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_mime (v1.1.5, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
82
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.25.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
83
|
+
<orderEntry type="library" scope="PROVIDED" name="msgpack (v1.7.3, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
84
|
+
<orderEntry type="library" scope="PROVIDED" name="nenv (v0.3.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
85
|
+
<orderEntry type="library" scope="PROVIDED" name="net-imap (v0.5.8, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
86
|
+
<orderEntry type="library" scope="PROVIDED" name="net-pop (v0.1.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
87
|
+
<orderEntry type="library" scope="PROVIDED" name="net-protocol (v0.2.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
88
|
+
<orderEntry type="library" scope="PROVIDED" name="net-smtp (v0.5.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
89
|
+
<orderEntry type="library" scope="PROVIDED" name="nio4r (v2.7.4, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
90
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.18.9, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
91
|
+
<orderEntry type="library" scope="PROVIDED" name="notiffany (v0.1.3, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
92
|
+
<orderEntry type="library" scope="PROVIDED" name="parallel (v1.26.3, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
93
|
+
<orderEntry type="library" scope="PROVIDED" name="parser (v3.3.5.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
94
|
+
<orderEntry type="library" scope="PROVIDED" name="pg (v1.5.8, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
95
|
+
<orderEntry type="library" scope="PROVIDED" name="pry (v0.14.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
96
|
+
<orderEntry type="library" scope="PROVIDED" name="psych (v5.1.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
97
|
+
<orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
98
|
+
<orderEntry type="library" scope="PROVIDED" name="rack (v3.1.16, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
99
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-session (v2.1.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
100
|
+
<orderEntry type="library" scope="PROVIDED" name="rack-test (v2.2.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
101
|
+
<orderEntry type="library" scope="PROVIDED" name="rackup (v2.1.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
102
|
+
<orderEntry type="library" scope="PROVIDED" name="rails (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
103
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.3.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
104
|
+
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.6.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
105
|
+
<orderEntry type="library" scope="PROVIDED" name="railties (v7.2.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
106
|
+
<orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
107
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
108
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
109
|
+
<orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.11.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
110
|
+
<orderEntry type="library" scope="PROVIDED" name="rbs (v3.6.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
111
|
+
<orderEntry type="library" scope="PROVIDED" name="rdoc (v6.7.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
112
|
+
<orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.9.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
113
|
+
<orderEntry type="library" scope="PROVIDED" name="reline (v0.5.10, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
114
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop (v1.66.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
115
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.32.3, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
116
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.22.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
117
|
+
<orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.6.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
118
|
+
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
119
|
+
<orderEntry type="library" scope="PROVIDED" name="securerandom (v0.3.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
120
|
+
<orderEntry type="library" scope="PROVIDED" name="shellany (v0.0.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
121
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.22.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
122
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.13.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
123
|
+
<orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
124
|
+
<orderEntry type="library" scope="PROVIDED" name="steep (v1.8.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
125
|
+
<orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
126
|
+
<orderEntry type="library" scope="PROVIDED" name="strscan (v3.1.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
127
|
+
<orderEntry type="library" scope="PROVIDED" name="terminal-table (v3.0.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
128
|
+
<orderEntry type="library" scope="PROVIDED" name="thor (v1.4.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
129
|
+
<orderEntry type="library" scope="PROVIDED" name="timeout (v0.4.1, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
130
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
131
|
+
<orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v2.6.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
132
|
+
<orderEntry type="library" scope="PROVIDED" name="useragent (v0.16.11, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
133
|
+
<orderEntry type="library" scope="PROVIDED" name="warden (v1.2.9, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
134
|
+
<orderEntry type="library" scope="PROVIDED" name="webrick (v1.8.2, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
135
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.8.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
136
|
+
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
137
|
+
<orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.7.0, RVM: ruby-3.3.5 [global]) [gem]" level="application" />
|
|
138
|
+
</component>
|
|
139
|
+
<component name="RailsPaths" isManagedAutomatically="true">
|
|
140
|
+
<entry key="app">
|
|
141
|
+
<value>file://$MODULE_DIR$/app</value>
|
|
142
|
+
</entry>
|
|
143
|
+
<entry key="app/assets">
|
|
144
|
+
<value>file://$MODULE_DIR$/app/assets</value>
|
|
145
|
+
</entry>
|
|
146
|
+
<entry key="app/channels">
|
|
147
|
+
<value>file://$MODULE_DIR$/app/channels</value>
|
|
148
|
+
</entry>
|
|
149
|
+
<entry key="app/controllers">
|
|
150
|
+
<value>file://$MODULE_DIR$/app/controllers</value>
|
|
151
|
+
</entry>
|
|
152
|
+
<entry key="app/helpers">
|
|
153
|
+
<value>file://$MODULE_DIR$/app/helpers</value>
|
|
154
|
+
</entry>
|
|
155
|
+
<entry key="app/mailers">
|
|
156
|
+
<value>file://$MODULE_DIR$/app/mailers</value>
|
|
157
|
+
</entry>
|
|
158
|
+
<entry key="app/models">
|
|
159
|
+
<value>file://$MODULE_DIR$/app/models</value>
|
|
160
|
+
</entry>
|
|
161
|
+
<entry key="app/views">
|
|
162
|
+
<value>file://$MODULE_DIR$/app/views</value>
|
|
163
|
+
</entry>
|
|
164
|
+
<entry key="config">
|
|
165
|
+
<value>file://$MODULE_DIR$/config</value>
|
|
166
|
+
</entry>
|
|
167
|
+
<entry key="config/cable">
|
|
168
|
+
<value>file://$MODULE_DIR$/config/cable.yml</value>
|
|
169
|
+
</entry>
|
|
170
|
+
<entry key="config/database">
|
|
171
|
+
<value>file://$MODULE_DIR$/config/database.yml</value>
|
|
172
|
+
</entry>
|
|
173
|
+
<entry key="config/environment">
|
|
174
|
+
<value>file://$MODULE_DIR$/config/environment.rb</value>
|
|
175
|
+
</entry>
|
|
176
|
+
<entry key="config/environments">
|
|
177
|
+
<value>file://$MODULE_DIR$/config/environments</value>
|
|
178
|
+
</entry>
|
|
179
|
+
<entry key="config/initializers">
|
|
180
|
+
<value>file://$MODULE_DIR$/config/initializers</value>
|
|
181
|
+
</entry>
|
|
182
|
+
<entry key="config/locales">
|
|
183
|
+
<value>file://$MODULE_DIR$/config/locales</value>
|
|
184
|
+
</entry>
|
|
185
|
+
<entry key="config/routes">
|
|
186
|
+
<value>file://$MODULE_DIR$/config/routes</value>
|
|
187
|
+
</entry>
|
|
188
|
+
<entry key="config/routes.rb">
|
|
189
|
+
<value>file://$MODULE_DIR$/config/routes.rb</value>
|
|
190
|
+
</entry>
|
|
191
|
+
<entry key="config/secrets">
|
|
192
|
+
<value>file://$MODULE_DIR$/config</value>
|
|
193
|
+
</entry>
|
|
194
|
+
<entry key="db">
|
|
195
|
+
<value>file://$MODULE_DIR$/db</value>
|
|
196
|
+
</entry>
|
|
197
|
+
<entry key="db/migrate">
|
|
198
|
+
<value>file://$MODULE_DIR$/db/migrate</value>
|
|
199
|
+
</entry>
|
|
200
|
+
<entry key="db/seeds.rb">
|
|
201
|
+
<value>file://$MODULE_DIR$/db/seeds.rb</value>
|
|
202
|
+
</entry>
|
|
203
|
+
<entry key="lib">
|
|
204
|
+
<value>file://$MODULE_DIR$/lib</value>
|
|
205
|
+
</entry>
|
|
206
|
+
<entry key="lib/assets">
|
|
207
|
+
<value>file://$MODULE_DIR$/lib/assets</value>
|
|
208
|
+
</entry>
|
|
209
|
+
<entry key="lib/tasks">
|
|
210
|
+
<value>file://$MODULE_DIR$/lib/tasks</value>
|
|
211
|
+
</entry>
|
|
212
|
+
<entry key="lib/templates">
|
|
213
|
+
<value>file://$MODULE_DIR$/lib/templates</value>
|
|
214
|
+
</entry>
|
|
215
|
+
<entry key="log">
|
|
216
|
+
<value>file://$MODULE_DIR$/log/development.log</value>
|
|
217
|
+
</entry>
|
|
218
|
+
<entry key="public">
|
|
219
|
+
<value>file://$MODULE_DIR$/public</value>
|
|
220
|
+
</entry>
|
|
221
|
+
<entry key="public/javascripts">
|
|
222
|
+
<value>file://$MODULE_DIR$/public/javascripts</value>
|
|
223
|
+
</entry>
|
|
224
|
+
<entry key="public/stylesheets">
|
|
225
|
+
<value>file://$MODULE_DIR$/public/stylesheets</value>
|
|
226
|
+
</entry>
|
|
227
|
+
<entry key="tmp">
|
|
228
|
+
<value>file://$MODULE_DIR$/tmp</value>
|
|
229
|
+
</entry>
|
|
230
|
+
<entry key="vendor">
|
|
231
|
+
<value>file://$MODULE_DIR$/vendor</value>
|
|
232
|
+
</entry>
|
|
233
|
+
<entry key="vendor/assets">
|
|
234
|
+
<value>file://$MODULE_DIR$/vendor/assets</value>
|
|
235
|
+
</entry>
|
|
236
|
+
</component>
|
|
237
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
|
|
2
2
|
# [Released]
|
|
3
3
|
|
|
4
|
+
## [1.0.3] - 2026-10-03
|
|
5
|
+
|
|
6
|
+
### Fixes
|
|
7
|
+
|
|
8
|
+
- **A connection handed between threads could keep another tenant.** `Tenant#set_rls` skipped the `SET` when the
|
|
9
|
+
thread had set that connection before, going by a per-thread record of the connections it had set. If a connection
|
|
10
|
+
changed threads while that record still listed it — released mid-request, or used across threads, as in system
|
|
11
|
+
tests where the test thread and the server's threads share a pool — the first thread got it back already switched
|
|
12
|
+
by another one and ran as that tenant. Apps that hold the connection for the whole request (pg_rls's own
|
|
13
|
+
`PgRls::Record.connection` calls lease it) were not exposed. The tenant is now recorded on the connection itself
|
|
14
|
+
(`rls_tenant_id`), so the `SET` is skipped only when the connection is already on that tenant: no more statements
|
|
15
|
+
than before, and none skipped that were needed.
|
|
16
|
+
- A reconnect or a reset (`DISCARD ALL`) drops the session's tenant; the connection now knows it and sets it again.
|
|
17
|
+
- `Tenant.reset_rls_used_connections` takes the tenant off the connection it is given, whichever thread set it.
|
|
18
|
+
|
|
19
|
+
### Removed
|
|
20
|
+
|
|
21
|
+
- `Tenant.rls_connection_object_cache_by_thread` and its writer, the per-thread record the fix replaces.
|
|
22
|
+
|
|
4
23
|
## [1.0.1] - 2024-10-10
|
|
5
24
|
|
|
6
25
|
### Major Changes
|
|
@@ -20,3 +39,4 @@
|
|
|
20
39
|
### [0.2.1] - 2024-09-29
|
|
21
40
|
|
|
22
41
|
- Initial release
|
|
42
|
+
|
|
@@ -18,6 +18,7 @@ module PgRls
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def tenant=(tenant)
|
|
21
|
+
PgRls.current_attributes.each { |key| @attributes[key] = nil }
|
|
21
22
|
add_tenant_to_history
|
|
22
23
|
super
|
|
23
24
|
tenant&.set_rls
|
|
@@ -40,6 +41,7 @@ module PgRls
|
|
|
40
41
|
|
|
41
42
|
def restore_most_recent_tenant
|
|
42
43
|
@attributes[:tenant] = @attributes[:tenant_history].pop
|
|
44
|
+
return unless PgRls::Record.connection.present?
|
|
43
45
|
return PgRls::Tenant.reset_rls_used_connections if @attributes[:tenant].nil?
|
|
44
46
|
|
|
45
47
|
@attributes[:tenant].set_rls
|
|
@@ -15,28 +15,23 @@ module PgRls
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
class_methods do
|
|
18
|
+
# Takes the tenant off a connection, when it has one (PgRls::ActiveRecord::ConnectionAdapters::RlsTenant).
|
|
18
19
|
def reset_rls_used_connections(connection = PgRls::Record.connection)
|
|
19
|
-
return connection if
|
|
20
|
+
return connection if connection.rls_tenant_id.nil?
|
|
20
21
|
|
|
21
22
|
connection.exec_query("SET rls.tenant_id TO DEFAULT")
|
|
22
|
-
|
|
23
|
+
connection.rls_tenant_id = nil
|
|
23
24
|
connection
|
|
24
25
|
end
|
|
25
|
-
|
|
26
|
-
def rls_connection_object_cache_by_thread=(value)
|
|
27
|
-
::ActiveSupport::IsolatedExecutionState[:active_record_rls_used_connections] = value
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def rls_connection_object_cache_by_thread
|
|
31
|
-
::ActiveSupport::IsolatedExecutionState[:active_record_rls_used_connections]
|
|
32
|
-
end
|
|
33
26
|
end
|
|
34
27
|
|
|
28
|
+
# Sets the connection's session to this tenant, unless it already is: what decides is the tenant the
|
|
29
|
+
# connection itself is on, never which thread set it last.
|
|
35
30
|
def set_rls(connection = PgRls::Record.connection)
|
|
36
|
-
self
|
|
37
|
-
return self if reused_connection?(connection)
|
|
31
|
+
return self if connection.rls_tenant_id == tenant_id
|
|
38
32
|
|
|
39
33
|
connection.exec_query("SET rls.tenant_id = '#{tenant_id}'")
|
|
34
|
+
connection.rls_tenant_id = tenant_id
|
|
40
35
|
|
|
41
36
|
self
|
|
42
37
|
end
|
|
@@ -44,24 +39,6 @@ module PgRls
|
|
|
44
39
|
def readonly?
|
|
45
40
|
true
|
|
46
41
|
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
def new_tenant?
|
|
51
|
-
!rls_used_connections.add?(tenant_id).nil?
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def reused_connection?(conn)
|
|
55
|
-
rls_used_connections.add?(conn.object_id).nil?
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def rls_used_connections
|
|
59
|
-
if self.class.rls_connection_object_cache_by_thread.nil?
|
|
60
|
-
self.class.rls_connection_object_cache_by_thread = Set.new([tenant_id])
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
self.class.rls_connection_object_cache_by_thread
|
|
64
|
-
end
|
|
65
42
|
end
|
|
66
43
|
end
|
|
67
44
|
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module PgRls
|
|
4
|
+
module ActiveRecord
|
|
5
|
+
module ConnectionAdapters
|
|
6
|
+
# Which tenant a connection's session is set to.
|
|
7
|
+
#
|
|
8
|
+
# It belongs to the connection rather than to the thread that set it: a pooled connection moves between
|
|
9
|
+
# threads, and a thread going by its own record of what it once set would skip a connection another thread
|
|
10
|
+
# has since switched to another tenant — and run as that tenant.
|
|
11
|
+
module RlsTenant
|
|
12
|
+
attr_accessor :rls_tenant_id
|
|
13
|
+
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
# A new session has no tenant, whatever the connection's last one had: this runs on every connect,
|
|
17
|
+
# reconnect and reset (DISCARD ALL).
|
|
18
|
+
def configure_connection
|
|
19
|
+
super
|
|
20
|
+
self.rls_tenant_id = nil
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(PgRls::ActiveRecord::ConnectionAdapters::RlsTenant)
|
data/lib/pg_rls/version.rb
CHANGED
data/rbs_collection.lock.yaml
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
path: ".gem_rbs_collection"
|
|
3
3
|
gems:
|
|
4
|
+
- name: actioncable
|
|
5
|
+
version: '7.1'
|
|
6
|
+
source:
|
|
7
|
+
type: git
|
|
8
|
+
name: ruby/gem_rbs_collection
|
|
9
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
10
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
11
|
+
repo_dir: gems
|
|
12
|
+
- name: actionmailer
|
|
13
|
+
version: '7.0'
|
|
14
|
+
source:
|
|
15
|
+
type: git
|
|
16
|
+
name: ruby/gem_rbs_collection
|
|
17
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
18
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
19
|
+
repo_dir: gems
|
|
4
20
|
- name: actionpack
|
|
5
21
|
version: '7.2'
|
|
6
22
|
source:
|
|
@@ -9,6 +25,14 @@ gems:
|
|
|
9
25
|
revision: 218cf130d31f63e110e350efc3fa265311b0f238
|
|
10
26
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
11
27
|
repo_dir: gems
|
|
28
|
+
- name: actiontext
|
|
29
|
+
version: '7.2'
|
|
30
|
+
source:
|
|
31
|
+
type: git
|
|
32
|
+
name: ruby/gem_rbs_collection
|
|
33
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
34
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
35
|
+
repo_dir: gems
|
|
12
36
|
- name: actionview
|
|
13
37
|
version: '6.0'
|
|
14
38
|
source:
|
|
@@ -17,6 +41,14 @@ gems:
|
|
|
17
41
|
revision: 218cf130d31f63e110e350efc3fa265311b0f238
|
|
18
42
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
19
43
|
repo_dir: gems
|
|
44
|
+
- name: activejob
|
|
45
|
+
version: '6.0'
|
|
46
|
+
source:
|
|
47
|
+
type: git
|
|
48
|
+
name: ruby/gem_rbs_collection
|
|
49
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
50
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
51
|
+
repo_dir: gems
|
|
20
52
|
- name: activemodel
|
|
21
53
|
version: '7.0'
|
|
22
54
|
source:
|
|
@@ -33,6 +65,14 @@ gems:
|
|
|
33
65
|
revision: c718a9d97695937f952c72aec0c09632e1342201
|
|
34
66
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
35
67
|
repo_dir: gems
|
|
68
|
+
- name: activestorage
|
|
69
|
+
version: '7.0'
|
|
70
|
+
source:
|
|
71
|
+
type: git
|
|
72
|
+
name: ruby/gem_rbs_collection
|
|
73
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
74
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
75
|
+
repo_dir: gems
|
|
36
76
|
- name: activesupport
|
|
37
77
|
version: '7.0'
|
|
38
78
|
source:
|
|
@@ -41,6 +81,14 @@ gems:
|
|
|
41
81
|
revision: c718a9d97695937f952c72aec0c09632e1342201
|
|
42
82
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
43
83
|
repo_dir: gems
|
|
84
|
+
- name: benchmark
|
|
85
|
+
version: '0'
|
|
86
|
+
source:
|
|
87
|
+
type: stdlib
|
|
88
|
+
- name: cgi
|
|
89
|
+
version: '0'
|
|
90
|
+
source:
|
|
91
|
+
type: stdlib
|
|
44
92
|
- name: concurrent-ruby
|
|
45
93
|
version: '1.1'
|
|
46
94
|
source:
|
|
@@ -57,6 +105,14 @@ gems:
|
|
|
57
105
|
version: '0'
|
|
58
106
|
source:
|
|
59
107
|
type: stdlib
|
|
108
|
+
- name: globalid
|
|
109
|
+
version: '1.1'
|
|
110
|
+
source:
|
|
111
|
+
type: git
|
|
112
|
+
name: ruby/gem_rbs_collection
|
|
113
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
114
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
115
|
+
repo_dir: gems
|
|
60
116
|
- name: io-console
|
|
61
117
|
version: '0'
|
|
62
118
|
source:
|
|
@@ -65,14 +121,46 @@ gems:
|
|
|
65
121
|
version: '0'
|
|
66
122
|
source:
|
|
67
123
|
type: stdlib
|
|
124
|
+
- name: mail
|
|
125
|
+
version: '2.8'
|
|
126
|
+
source:
|
|
127
|
+
type: git
|
|
128
|
+
name: ruby/gem_rbs_collection
|
|
129
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
130
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
131
|
+
repo_dir: gems
|
|
132
|
+
- name: marcel
|
|
133
|
+
version: '1.0'
|
|
134
|
+
source:
|
|
135
|
+
type: git
|
|
136
|
+
name: ruby/gem_rbs_collection
|
|
137
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
138
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
139
|
+
repo_dir: gems
|
|
140
|
+
- name: mini_mime
|
|
141
|
+
version: '0.1'
|
|
142
|
+
source:
|
|
143
|
+
type: git
|
|
144
|
+
name: ruby/gem_rbs_collection
|
|
145
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
146
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
147
|
+
repo_dir: gems
|
|
68
148
|
- name: monitor
|
|
69
149
|
version: '0'
|
|
70
150
|
source:
|
|
71
151
|
type: stdlib
|
|
72
|
-
- name:
|
|
152
|
+
- name: net-protocol
|
|
73
153
|
version: '0'
|
|
74
154
|
source:
|
|
75
155
|
type: stdlib
|
|
156
|
+
- name: net-smtp
|
|
157
|
+
version: '0.5'
|
|
158
|
+
source:
|
|
159
|
+
type: git
|
|
160
|
+
name: ruby/gem_rbs_collection
|
|
161
|
+
revision: 10d80b1f45dd4241d64d40b49e622cd5d3cfa903
|
|
162
|
+
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
163
|
+
repo_dir: gems
|
|
76
164
|
- name: nokogiri
|
|
77
165
|
version: '1.11'
|
|
78
166
|
source:
|
|
@@ -81,6 +169,18 @@ gems:
|
|
|
81
169
|
revision: 218cf130d31f63e110e350efc3fa265311b0f238
|
|
82
170
|
remote: https://github.com/ruby/gem_rbs_collection.git
|
|
83
171
|
repo_dir: gems
|
|
172
|
+
- name: pathname
|
|
173
|
+
version: '0'
|
|
174
|
+
source:
|
|
175
|
+
type: stdlib
|
|
176
|
+
- name: pp
|
|
177
|
+
version: '0'
|
|
178
|
+
source:
|
|
179
|
+
type: stdlib
|
|
180
|
+
- name: prettyprint
|
|
181
|
+
version: '0'
|
|
182
|
+
source:
|
|
183
|
+
type: stdlib
|
|
84
184
|
- name: rails-dom-testing
|
|
85
185
|
version: '2.0'
|
|
86
186
|
source:
|
|
@@ -113,6 +213,14 @@ gems:
|
|
|
113
213
|
version: '0'
|
|
114
214
|
source:
|
|
115
215
|
type: stdlib
|
|
216
|
+
- name: stringio
|
|
217
|
+
version: '0'
|
|
218
|
+
source:
|
|
219
|
+
type: stdlib
|
|
220
|
+
- name: tempfile
|
|
221
|
+
version: '0'
|
|
222
|
+
source:
|
|
223
|
+
type: stdlib
|
|
116
224
|
- name: thor
|
|
117
225
|
version: '1.2'
|
|
118
226
|
source:
|
|
@@ -125,6 +233,10 @@ gems:
|
|
|
125
233
|
version: '0'
|
|
126
234
|
source:
|
|
127
235
|
type: stdlib
|
|
236
|
+
- name: timeout
|
|
237
|
+
version: '0'
|
|
238
|
+
source:
|
|
239
|
+
type: stdlib
|
|
128
240
|
- name: tsort
|
|
129
241
|
version: '0'
|
|
130
242
|
source:
|
|
@@ -46,7 +46,7 @@ module PgRls
|
|
|
46
46
|
def revoke_existing_table_privileges_sql: ((String | Symbol), (String | Symbol)) -> String
|
|
47
47
|
|
|
48
48
|
def revoke_existing_sequence_privileges_sql: ((String | Symbol), (String | Symbol)) -> String
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
def role_applicable_sql_statement: ((String | Symbol), (String | Symbol)) -> String
|
|
51
51
|
end
|
|
52
52
|
end
|
|
@@ -8,21 +8,21 @@ module PgRls
|
|
|
8
8
|
include SqlHelperMethod
|
|
9
9
|
|
|
10
10
|
def function_exists?: (String) -> bool
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
def create_rls_functions: () -> void
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
def drop_rls_functions: () -> void
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
private
|
|
17
17
|
|
|
18
18
|
def create_function: (String, String) -> Array[PG::Result]
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
def drop_function: (String) -> Array[PG::Result]
|
|
21
21
|
|
|
22
22
|
def create_tenant_id_setter_function: () -> void
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
def create_tenant_id_update_blocker_function: () -> void
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
def create_rls_exception: () -> void
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -9,37 +9,37 @@ module PgRls
|
|
|
9
9
|
include SqlHelperMethod
|
|
10
10
|
|
|
11
11
|
def create_rls_role: (String, String) -> void
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
def drop_rls_role: (String) -> void
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
def user_exists?: (String) -> bool
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
def drop_rls_user: (String) -> void
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
def create_rls_user: (String, String) -> void
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
def create_rls_group: (?(String | Symbol)) -> void
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
def drop_rls_group: (?(String | Symbol)) -> void
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
def assign_user_to_group: (String) -> void
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
def remove_user_from_group: (String) -> void
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
private
|
|
30
30
|
|
|
31
31
|
def user_exists_sql: (String) -> String
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
def drop_rls_user_sql: (String) -> String
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
def create_rls_user_sql: (String, String) -> String
|
|
36
|
-
|
|
36
|
+
|
|
37
37
|
def create_rls_group_sql: ((String | Symbol)) -> String
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
def drop_rls_group_sql: ((String | Symbol)) -> String
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
def assign_user_to_group_sql: (String) -> String
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
def remove_user_from_group_sql: (String) -> String
|
|
44
44
|
end
|
|
45
45
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
#
|
|
2
|
+
#
|
|
3
3
|
|
|
4
4
|
module PgRls
|
|
5
5
|
module ActiveRecord
|
|
@@ -29,7 +29,7 @@ module PgRls
|
|
|
29
29
|
def invert_convert_to_rls_table: (String | Symbol) -> void
|
|
30
30
|
|
|
31
31
|
# Inherited Methods
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
def check_rls_user_privileges!: (String | Symbol, String | Symbol) -> bool
|
|
34
34
|
def enable_table_rls: (String | Symbol, String | Symbol) -> void
|
|
35
35
|
def append_rls_table_triggers: (String | Symbol) -> void
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
module PgRls
|
|
4
4
|
module ActiveRecord
|
|
5
5
|
module ConnectionAdapters
|
|
6
|
+
module RlsTenant
|
|
7
|
+
attr_accessor rls_tenant_id: String?
|
|
8
|
+
|
|
9
|
+
private def configure_connection: () -> void
|
|
10
|
+
end
|
|
11
|
+
|
|
6
12
|
module ConnectionPool
|
|
7
13
|
attr_reader checkout_timeout: untyped
|
|
8
14
|
|
|
@@ -23,15 +29,6 @@ module PgRls
|
|
|
23
29
|
|
|
24
30
|
def set_rls: (ActiveRecord::ConnectionAdapters::PostgreSQLAdapter conn) -> Tenant
|
|
25
31
|
|
|
26
|
-
def new_tenant?: () -> bool
|
|
27
|
-
|
|
28
|
-
def reused_connection?: (ActiveRecord::ConnectionAdapters::PostgreSQLAdapter conn) -> bool
|
|
29
|
-
|
|
30
|
-
def rls_connection_object_cache_by_thread=: (untyped value) -> untyped
|
|
31
|
-
|
|
32
|
-
def rls_connection_object_cache_by_thread: () -> untyped
|
|
33
|
-
|
|
34
|
-
def rls_used_connections: () -> untyped
|
|
35
32
|
end
|
|
36
33
|
|
|
37
34
|
module Current
|
|
@@ -13,13 +13,13 @@ module PgRls
|
|
|
13
13
|
REQUIRED_CONFIGURATION_KEYS: Array[String]
|
|
14
14
|
|
|
15
15
|
def add_rls_configurations: (Hash[String, untyped], ?Hash[String, untyped]) -> Hash[String, untyped]
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
def configurations=: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
18
18
|
|
|
19
19
|
def configurations: () -> Hash[String, untyped]
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
def rls_shard_config?: (Hash[String, untyped]) -> bool
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
def adapter_configurations: (Hash[String, untyped], Hash[String, untyped], String) -> (::Hash[::String, untyped] | nil)
|
|
24
24
|
|
|
25
25
|
def rls_configuration: () -> Hash[String, untyped]
|
|
@@ -2,15 +2,15 @@ module PgRls
|
|
|
2
2
|
module ActiveSupport
|
|
3
3
|
module StringExt
|
|
4
4
|
def sanitize_sql: -> String
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
def gsub!: (Regexp, String) -> String
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
def strip!: -> String
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
def camelize: -> String
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
def constantize: -> Class
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
def underscore: -> String
|
|
15
15
|
|
|
16
16
|
def pluralize: () -> String
|
data/sig/pg_rls.rbs
CHANGED
|
@@ -13,7 +13,7 @@ module PgRls
|
|
|
13
13
|
def self.connection_config?: () -> bool
|
|
14
14
|
|
|
15
15
|
def self.freeze_config!: () -> void
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
def self.invalid_connection_config: () -> bot
|
|
18
18
|
|
|
19
19
|
@@search_methods: Array[Symbol]
|
|
@@ -43,7 +43,7 @@ module PgRls
|
|
|
43
43
|
@@rls_role_group: String | Symbol
|
|
44
44
|
def self.rls_role_group: () -> (String | Symbol)
|
|
45
45
|
def self.rls_role_group=: (String | Symbol) -> (String | Symbol)
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
@@connects_to: nil | Hash[Symbol, Hash[Symbol, Symbol]]
|
|
48
48
|
def self.connects_to: () -> (Hash[Symbol, Hash[Symbol, Symbol]] | nil)
|
|
49
49
|
def self.connects_to=: (Hash[Symbol, Hash[Symbol, Symbol]] | nil) -> (Hash[Symbol, Hash[Symbol, Symbol]] | nil)
|
|
@@ -4,34 +4,28 @@ module ActiveRecord
|
|
|
4
4
|
|
|
5
5
|
class Base
|
|
6
6
|
def self.ignored_columns=: (Array[(Symbol | String)]) -> Array[Symbol]
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
def self.ignored_columns: () -> Array[Symbol]
|
|
9
9
|
|
|
10
10
|
def self.connection: () -> ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
|
11
11
|
|
|
12
12
|
def self.transaction: (requires_new: bool?) { () -> untyped } -> untyped
|
|
13
|
-
|
|
14
|
-
def self.connection_db_config: () -> ActiveRecord::DatabaseConfigurations::HashConfig
|
|
13
|
+
|
|
14
|
+
def self.connection_db_config: () -> ActiveRecord::DatabaseConfigurations::HashConfig
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
class DatabaseConfigurations
|
|
18
18
|
class HashConfig
|
|
19
19
|
def configuration_hash: () -> Hash[Symbol, untyped]
|
|
20
|
-
|
|
21
|
-
def name: () -> String
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
class CommandRecorder
|
|
27
|
-
def self.included: (Class) -> void
|
|
21
|
+
def name: () -> String
|
|
28
22
|
end
|
|
29
23
|
end
|
|
30
24
|
|
|
31
25
|
module Generators
|
|
32
26
|
class ModelGenerator < ::Rails::Generators::Base
|
|
33
27
|
def self.class_option: (Symbol, ?Hash[Symbol, untyped]) -> void
|
|
34
|
-
|
|
28
|
+
|
|
35
29
|
def check_class_collision: () -> void
|
|
36
30
|
|
|
37
31
|
@class_coalescing: bool
|
|
@@ -39,21 +33,21 @@ module ActiveRecord
|
|
|
39
33
|
def destination_root: () -> String
|
|
40
34
|
|
|
41
35
|
def attributes: () -> Array[ActiveRecord::Generators::Attribute]
|
|
42
|
-
|
|
36
|
+
|
|
43
37
|
def options: () -> Hash[Symbol, untyped]
|
|
44
|
-
|
|
38
|
+
|
|
45
39
|
def database: () -> String
|
|
46
|
-
|
|
40
|
+
|
|
47
41
|
def file_name: () -> String
|
|
48
|
-
|
|
42
|
+
|
|
49
43
|
def class_path: () -> String
|
|
50
|
-
|
|
44
|
+
|
|
51
45
|
def migration_template: (String, ?String) -> void
|
|
52
|
-
|
|
46
|
+
|
|
53
47
|
def table_name: () -> String
|
|
54
|
-
|
|
48
|
+
|
|
55
49
|
def skip_migration_creation?: () -> bool
|
|
56
|
-
|
|
50
|
+
|
|
57
51
|
def custom_parent?: () -> bool
|
|
58
52
|
end
|
|
59
53
|
|
|
@@ -76,9 +70,6 @@ module ActiveRecord
|
|
|
76
70
|
def execute: (String) -> untyped
|
|
77
71
|
end
|
|
78
72
|
module PostgreSQL
|
|
79
|
-
class SchemaStatements
|
|
80
|
-
end
|
|
81
|
-
|
|
82
73
|
class SchemaDumper
|
|
83
74
|
end
|
|
84
75
|
end
|
data/sig/support/rails.rbs
CHANGED
|
@@ -23,15 +23,15 @@ module Rails
|
|
|
23
23
|
|
|
24
24
|
class Base
|
|
25
25
|
def self.hook_for: (Symbol, required: bool) -> void
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
def self.source_root: (String) -> void
|
|
28
28
|
|
|
29
29
|
def behavior: -> Symbol
|
|
30
|
-
|
|
31
|
-
def readme: (String) -> void
|
|
32
|
-
|
|
30
|
+
|
|
31
|
+
def readme: (String) -> void
|
|
32
|
+
|
|
33
33
|
def template: (String, ?String) -> void
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
def gsub_file: (String, Regexp, String) -> void
|
|
36
36
|
end
|
|
37
37
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pg_rls
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Laloush
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-10-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -16,7 +16,7 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 7.2.2
|
|
19
|
+
version: 7.2.2.2
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
22
|
version: '9.0'
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 7.2.2
|
|
29
|
+
version: 7.2.2.2
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
32
|
version: '9.0'
|
|
@@ -87,6 +87,12 @@ executables: []
|
|
|
87
87
|
extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
|
89
89
|
files:
|
|
90
|
+
- ".idea/.gitignore"
|
|
91
|
+
- ".idea/git_toolbox_prj.xml"
|
|
92
|
+
- ".idea/misc.xml"
|
|
93
|
+
- ".idea/modules.xml"
|
|
94
|
+
- ".idea/pg_rls.iml"
|
|
95
|
+
- ".idea/vcs.xml"
|
|
90
96
|
- ".rubocop.yml"
|
|
91
97
|
- ".ruby-version"
|
|
92
98
|
- CHANGELOG.md
|
|
@@ -132,6 +138,7 @@ files:
|
|
|
132
138
|
- lib/pg_rls/active_record/connection_adapters/postgre_sql/schema_dumper.rb
|
|
133
139
|
- lib/pg_rls/active_record/connection_adapters/postgre_sql/schema_statements.rb
|
|
134
140
|
- lib/pg_rls/active_record/connection_adapters/postgre_sql/sql_helper_method.rb
|
|
141
|
+
- lib/pg_rls/active_record/connection_adapters/rls_tenant.rb
|
|
135
142
|
- lib/pg_rls/active_record/database_shards.rb
|
|
136
143
|
- lib/pg_rls/active_record/migration.rb
|
|
137
144
|
- lib/pg_rls/active_record/migration/command_recorder.rb
|