pg_rls 0.0.2.6.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +19 -158
- data/Gemfile +4 -1
- data/Gemfile.lock +192 -139
- data/README.md +3 -6
- data/lib/generators/pg_rls/active_record/active_record_generator.rb +10 -10
- data/lib/generators/pg_rls/active_record/templates/convert_migration_backport.rb.tt +1 -1
- data/lib/generators/pg_rls/install_generator.rb +10 -23
- data/lib/generators/templates/README +1 -3
- data/lib/generators/templates/pg_rls.rb.tt +13 -20
- data/lib/pg_rls/database/configurations.rb +33 -0
- data/lib/pg_rls/database/prepared.rb +1 -1
- data/lib/pg_rls/database/tasks/admin_database.rake +20 -43
- data/lib/pg_rls/errors/admin_username.rb +12 -0
- data/lib/pg_rls/errors/index.rb +5 -0
- data/lib/pg_rls/errors/rake_only_error.rb +12 -0
- data/lib/pg_rls/errors/tenant_not_found.rb +2 -10
- data/lib/pg_rls/middleware/set_reset_connection.rb +48 -3
- data/lib/pg_rls/middleware/sidekiq/client.rb +10 -1
- data/lib/pg_rls/middleware/sidekiq/server.rb +5 -1
- data/lib/pg_rls/multi_tenancy.rb +4 -4
- data/lib/pg_rls/schema/down_statements.rb +5 -5
- data/lib/pg_rls/schema/statements.rb +4 -4
- data/lib/pg_rls/schema/up_statements.rb +8 -8
- data/lib/pg_rls/tenant.rb +27 -26
- data/lib/pg_rls/version.rb +1 -1
- data/lib/pg_rls.rb +62 -69
- metadata +8 -8
- data/lib/pg_rls/schema/solo/statements.rb +0 -24
- data/lib/pg_rls/schema/solo/up_statements.rb +0 -106
- data/lib/pg_rls/secure_connection.rb +0 -23
- data/lib/pg_rls/solo/tenant.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43fa134f2b679ac9b15406226a50a8b7186a0845c030e931e40f17ba226b5a1c
|
4
|
+
data.tar.gz: 5580815284fecca5bb67435e54e0a9bb775cc56f8524b2bb01a3b85da5c15901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 976399696e8c22b692d389c99ae7918e66d67c02f485fa4b6ad157f6940fb215bb1440753086c8ba4e26618edc53de04ad8bd4a27198c03739265cc284598001
|
7
|
+
data.tar.gz: 4342defbd2a76a1927e93634b26cd1c1103afc011ff2a24066a257a8e0d8dd28bb73b2adf3925781ea8b5a45785301627495293827e27fb43c606e9036999682
|
data/.rubocop.yml
CHANGED
@@ -1,162 +1,23 @@
|
|
1
|
-
require:
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
11
|
-
Enabled: true
|
12
|
-
Layout/SpaceBeforeBrackets: # new in 1.7
|
13
|
-
Enabled: true
|
14
|
-
Lint/AmbiguousAssignment: # new in 1.7
|
15
|
-
Enabled: true
|
16
|
-
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
17
|
-
Enabled: true
|
18
|
-
Lint/AmbiguousRange: # new in 1.19
|
19
|
-
Enabled: true
|
20
|
-
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
21
|
-
Enabled: true
|
22
|
-
Lint/DeprecatedConstants: # new in 1.8
|
23
|
-
Enabled: true
|
24
|
-
Lint/DuplicateBranch: # new in 1.3
|
25
|
-
Enabled: true
|
26
|
-
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
27
|
-
Enabled: true
|
28
|
-
Lint/EmptyBlock: # new in 1.1
|
29
|
-
Enabled: true
|
30
|
-
Lint/EmptyClass: # new in 1.3
|
31
|
-
Enabled: true
|
32
|
-
Lint/EmptyInPattern: # new in 1.16
|
33
|
-
Enabled: true
|
34
|
-
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
35
|
-
Enabled: true
|
36
|
-
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
37
|
-
Enabled: true
|
38
|
-
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
39
|
-
Enabled: true
|
40
|
-
Lint/NonAtomicFileOperation: # new in 1.31
|
41
|
-
Enabled: true
|
42
|
-
Lint/NumberedParameterAssignment: # new in 1.9
|
43
|
-
Enabled: true
|
44
|
-
Lint/OrAssignmentToConstant: # new in 1.9
|
45
|
-
Enabled: true
|
46
|
-
Lint/RedundantDirGlobSort: # new in 1.8
|
47
|
-
Enabled: true
|
48
|
-
Lint/RefinementImportMethods: # new in 1.27
|
49
|
-
Enabled: true
|
50
|
-
Lint/RequireRangeParentheses: # new in 1.32
|
51
|
-
Enabled: true
|
52
|
-
Lint/RequireRelativeSelfPath: # new in 1.22
|
53
|
-
Enabled: true
|
54
|
-
Lint/SymbolConversion: # new in 1.9
|
55
|
-
Enabled: true
|
56
|
-
Lint/ToEnumArguments: # new in 1.1
|
57
|
-
Enabled: true
|
58
|
-
Lint/TripleQuotes: # new in 1.9
|
59
|
-
Enabled: true
|
60
|
-
Lint/UnexpectedBlockArity: # new in 1.5
|
61
|
-
Enabled: true
|
62
|
-
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
63
|
-
Enabled: true
|
64
|
-
Lint/UselessRuby2Keywords: # new in 1.23
|
65
|
-
Enabled: true
|
66
|
-
Naming/BlockForwarding: # new in 1.24
|
67
|
-
Enabled: true
|
68
|
-
Security/CompoundHash: # new in 1.28
|
69
|
-
Enabled: true
|
70
|
-
Security/IoMethods: # new in 1.22
|
71
|
-
Enabled: true
|
72
|
-
Style/ArgumentsForwarding: # new in 1.1
|
73
|
-
Enabled: true
|
74
|
-
Style/CollectionCompact: # new in 1.2
|
75
|
-
Enabled: true
|
76
|
-
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
77
|
-
Enabled: true
|
78
|
-
Style/EmptyHeredoc: # new in 1.32
|
79
|
-
Enabled: true
|
80
|
-
Style/EndlessMethod: # new in 1.8
|
81
|
-
Enabled: true
|
82
|
-
Style/EnvHome: # new in 1.29
|
83
|
-
Enabled: true
|
84
|
-
Style/FetchEnvVar: # new in 1.28
|
85
|
-
Enabled: true
|
86
|
-
Style/FileRead: # new in 1.24
|
87
|
-
Enabled: true
|
88
|
-
Style/FileWrite: # new in 1.24
|
89
|
-
Enabled: true
|
90
|
-
Style/HashConversion: # new in 1.10
|
91
|
-
Enabled: true
|
92
|
-
Style/HashExcept: # new in 1.7
|
93
|
-
Enabled: true
|
94
|
-
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
95
|
-
Enabled: true
|
96
|
-
Style/InPatternThen: # new in 1.16
|
97
|
-
Enabled: true
|
98
|
-
Style/MagicCommentFormat: # new in 1.35
|
99
|
-
Enabled: true
|
100
|
-
Style/MapCompactWithConditionalBlock: # new in 1.30
|
101
|
-
Enabled: true
|
102
|
-
Style/MapToHash: # new in 1.24
|
103
|
-
Enabled: true
|
104
|
-
Style/MultilineInPatternThen: # new in 1.16
|
105
|
-
Enabled: true
|
106
|
-
Style/NegatedIfElseCondition: # new in 1.2
|
107
|
-
Enabled: true
|
108
|
-
Style/NestedFileDirname: # new in 1.26
|
109
|
-
Enabled: true
|
110
|
-
Style/NilLambda: # new in 1.3
|
111
|
-
Enabled: true
|
112
|
-
Style/NumberedParameters: # new in 1.22
|
113
|
-
Enabled: true
|
114
|
-
Style/NumberedParametersLimit: # new in 1.22
|
115
|
-
Enabled: true
|
116
|
-
Style/ObjectThen: # new in 1.28
|
117
|
-
Enabled: true
|
118
|
-
Style/OpenStructUse: # new in 1.23
|
119
|
-
Enabled: true
|
120
|
-
Style/QuotedSymbols: # new in 1.16
|
121
|
-
Enabled: true
|
122
|
-
Style/RedundantArgument: # new in 1.4
|
123
|
-
Enabled: true
|
124
|
-
Style/RedundantInitialize: # new in 1.27
|
125
|
-
Enabled: true
|
126
|
-
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
127
|
-
Enabled: true
|
128
|
-
Style/SelectByRegexp: # new in 1.22
|
129
|
-
Enabled: true
|
130
|
-
Style/StringChars: # new in 1.12
|
131
|
-
Enabled: true
|
132
|
-
Style/SwapValues: # new in 1.1
|
133
|
-
Enabled: true
|
134
|
-
RSpec/BeEq: # new in 2.9.0
|
135
|
-
Enabled: true
|
136
|
-
RSpec/BeNil: # new in 2.9.0
|
137
|
-
Enabled: true
|
138
|
-
RSpec/ChangeByZero: # new in 2.11.0
|
139
|
-
Enabled: true
|
140
|
-
RSpec/ExcessiveDocstringSpacing: # new in 2.5
|
141
|
-
Enabled: true
|
142
|
-
RSpec/IdenticalEqualityAssertion: # new in 2.4
|
143
|
-
Enabled: true
|
144
|
-
RSpec/SubjectDeclaration: # new in 2.5
|
145
|
-
Enabled: true
|
146
|
-
RSpec/VerifiedDoubleReference: # new in 2.10.0
|
147
|
-
Enabled: true
|
148
|
-
RSpec/Capybara/SpecificMatcher: # new in 2.12
|
149
|
-
Enabled: true
|
150
|
-
RSpec/FactoryBot/SyntaxMethods: # new in 2.7
|
151
|
-
Enabled: true
|
152
|
-
Style/ClassVars:
|
1
|
+
require:
|
2
|
+
- rubocop-rails
|
3
|
+
- rubocop-performance
|
4
|
+
- rubocop-rspec
|
5
|
+
- rubocop-rake
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
NewCops: enable
|
9
|
+
Style/Documentation:
|
153
10
|
Enabled: false
|
154
|
-
|
11
|
+
Style/ClassVars:
|
155
12
|
Exclude:
|
156
|
-
|
157
|
-
|
13
|
+
- 'lib/pg_rls.rb'
|
14
|
+
Metrics/MethodLength:
|
15
|
+
Exclude:
|
16
|
+
- 'lib/pg_rls/schema/**/*'
|
17
|
+
- 'lib/pg_rls/database/prepared.rb'
|
18
|
+
Metrics/BlockLength:
|
158
19
|
Exclude:
|
159
|
-
|
160
|
-
|
20
|
+
- 'lib/pg_rls/database/tasks/admin_database.rake'
|
21
|
+
Security/MarshalLoad:
|
161
22
|
Exclude:
|
162
|
-
|
23
|
+
- 'lib/pg_rls/middleware/set_reset_connection.rb'
|
data/Gemfile
CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in pg_rls.gemspec
|
6
6
|
gemspec
|
7
|
-
ruby '3.
|
7
|
+
ruby '3.2.2'
|
8
8
|
|
9
9
|
gem 'rails', '~> 7.0', '>= 7.0.4'
|
10
10
|
|
@@ -13,5 +13,8 @@ gem 'rake'
|
|
13
13
|
gem 'rspec'
|
14
14
|
|
15
15
|
gem 'rubocop'
|
16
|
+
gem 'rubocop-performance'
|
17
|
+
gem 'rubocop-rails'
|
18
|
+
gem 'rubocop-rake'
|
16
19
|
gem 'rubocop-rspec'
|
17
20
|
gem 'solargraph'
|
data/Gemfile.lock
CHANGED
@@ -1,219 +1,269 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
pg_rls (0.0
|
4
|
+
pg_rls (2.0.0)
|
5
5
|
bundler (~> 2.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (7.
|
11
|
-
actionpack (= 7.
|
12
|
-
activesupport (= 7.
|
10
|
+
actioncable (7.1.1)
|
11
|
+
actionpack (= 7.1.1)
|
12
|
+
activesupport (= 7.1.1)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
zeitwerk (~> 2.6)
|
16
|
+
actionmailbox (7.1.1)
|
17
|
+
actionpack (= 7.1.1)
|
18
|
+
activejob (= 7.1.1)
|
19
|
+
activerecord (= 7.1.1)
|
20
|
+
activestorage (= 7.1.1)
|
21
|
+
activesupport (= 7.1.1)
|
21
22
|
mail (>= 2.7.1)
|
22
23
|
net-imap
|
23
24
|
net-pop
|
24
25
|
net-smtp
|
25
|
-
actionmailer (7.
|
26
|
-
actionpack (= 7.
|
27
|
-
actionview (= 7.
|
28
|
-
activejob (= 7.
|
29
|
-
activesupport (= 7.
|
26
|
+
actionmailer (7.1.1)
|
27
|
+
actionpack (= 7.1.1)
|
28
|
+
actionview (= 7.1.1)
|
29
|
+
activejob (= 7.1.1)
|
30
|
+
activesupport (= 7.1.1)
|
30
31
|
mail (~> 2.5, >= 2.5.4)
|
31
32
|
net-imap
|
32
33
|
net-pop
|
33
34
|
net-smtp
|
34
|
-
rails-dom-testing (~> 2.
|
35
|
-
actionpack (7.
|
36
|
-
actionview (= 7.
|
37
|
-
activesupport (= 7.
|
38
|
-
|
35
|
+
rails-dom-testing (~> 2.2)
|
36
|
+
actionpack (7.1.1)
|
37
|
+
actionview (= 7.1.1)
|
38
|
+
activesupport (= 7.1.1)
|
39
|
+
nokogiri (>= 1.8.5)
|
40
|
+
rack (>= 2.2.4)
|
41
|
+
rack-session (>= 1.0.1)
|
39
42
|
rack-test (>= 0.6.3)
|
40
|
-
rails-dom-testing (~> 2.
|
41
|
-
rails-html-sanitizer (~> 1.
|
42
|
-
actiontext (7.
|
43
|
-
actionpack (= 7.
|
44
|
-
activerecord (= 7.
|
45
|
-
activestorage (= 7.
|
46
|
-
activesupport (= 7.
|
43
|
+
rails-dom-testing (~> 2.2)
|
44
|
+
rails-html-sanitizer (~> 1.6)
|
45
|
+
actiontext (7.1.1)
|
46
|
+
actionpack (= 7.1.1)
|
47
|
+
activerecord (= 7.1.1)
|
48
|
+
activestorage (= 7.1.1)
|
49
|
+
activesupport (= 7.1.1)
|
47
50
|
globalid (>= 0.6.0)
|
48
51
|
nokogiri (>= 1.8.5)
|
49
|
-
actionview (7.
|
50
|
-
activesupport (= 7.
|
52
|
+
actionview (7.1.1)
|
53
|
+
activesupport (= 7.1.1)
|
51
54
|
builder (~> 3.1)
|
52
|
-
erubi (~> 1.
|
53
|
-
rails-dom-testing (~> 2.
|
54
|
-
rails-html-sanitizer (~> 1.
|
55
|
-
activejob (7.
|
56
|
-
activesupport (= 7.
|
55
|
+
erubi (~> 1.11)
|
56
|
+
rails-dom-testing (~> 2.2)
|
57
|
+
rails-html-sanitizer (~> 1.6)
|
58
|
+
activejob (7.1.1)
|
59
|
+
activesupport (= 7.1.1)
|
57
60
|
globalid (>= 0.3.6)
|
58
|
-
activemodel (7.
|
59
|
-
activesupport (= 7.
|
60
|
-
activerecord (7.
|
61
|
-
activemodel (= 7.
|
62
|
-
activesupport (= 7.
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
61
|
+
activemodel (7.1.1)
|
62
|
+
activesupport (= 7.1.1)
|
63
|
+
activerecord (7.1.1)
|
64
|
+
activemodel (= 7.1.1)
|
65
|
+
activesupport (= 7.1.1)
|
66
|
+
timeout (>= 0.4.0)
|
67
|
+
activestorage (7.1.1)
|
68
|
+
actionpack (= 7.1.1)
|
69
|
+
activejob (= 7.1.1)
|
70
|
+
activerecord (= 7.1.1)
|
71
|
+
activesupport (= 7.1.1)
|
68
72
|
marcel (~> 1.0)
|
69
|
-
|
70
|
-
|
73
|
+
activesupport (7.1.1)
|
74
|
+
base64
|
75
|
+
bigdecimal
|
71
76
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
77
|
+
connection_pool (>= 2.2.5)
|
78
|
+
drb
|
72
79
|
i18n (>= 1.6, < 2)
|
73
80
|
minitest (>= 5.1)
|
81
|
+
mutex_m
|
74
82
|
tzinfo (~> 2.0)
|
75
83
|
ast (2.4.2)
|
76
84
|
backport (1.2.0)
|
77
|
-
|
85
|
+
base64 (0.1.1)
|
86
|
+
benchmark (0.2.1)
|
87
|
+
bigdecimal (3.1.4)
|
78
88
|
builder (3.2.4)
|
79
|
-
concurrent-ruby (1.
|
89
|
+
concurrent-ruby (1.2.2)
|
90
|
+
connection_pool (2.4.1)
|
80
91
|
crass (1.0.6)
|
92
|
+
date (3.3.3)
|
81
93
|
diff-lcs (1.5.0)
|
82
|
-
|
94
|
+
drb (2.1.1)
|
95
|
+
ruby2_keywords
|
83
96
|
e2mmap (0.1.0)
|
84
|
-
erubi (1.
|
85
|
-
globalid (1.
|
86
|
-
activesupport (>=
|
87
|
-
i18n (1.
|
97
|
+
erubi (1.12.0)
|
98
|
+
globalid (1.2.1)
|
99
|
+
activesupport (>= 6.1)
|
100
|
+
i18n (1.14.1)
|
88
101
|
concurrent-ruby (~> 1.0)
|
89
|
-
|
90
|
-
|
102
|
+
io-console (0.6.0)
|
103
|
+
irb (1.8.1)
|
104
|
+
rdoc
|
105
|
+
reline (>= 0.3.8)
|
106
|
+
jaro_winkler (1.5.6)
|
107
|
+
json (2.6.3)
|
91
108
|
kramdown (2.4.0)
|
92
109
|
rexml
|
93
110
|
kramdown-parser-gfm (1.1.0)
|
94
111
|
kramdown (~> 2.0)
|
95
|
-
|
112
|
+
language_server-protocol (3.17.0.3)
|
113
|
+
loofah (2.21.4)
|
96
114
|
crass (~> 1.0.2)
|
97
|
-
nokogiri (>= 1.
|
98
|
-
mail (2.
|
115
|
+
nokogiri (>= 1.12.0)
|
116
|
+
mail (2.8.1)
|
99
117
|
mini_mime (>= 0.1.1)
|
118
|
+
net-imap
|
119
|
+
net-pop
|
120
|
+
net-smtp
|
100
121
|
marcel (1.0.2)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
net-imap (0.
|
105
|
-
|
122
|
+
mini_mime (1.1.5)
|
123
|
+
minitest (5.20.0)
|
124
|
+
mutex_m (0.1.2)
|
125
|
+
net-imap (0.4.1)
|
126
|
+
date
|
106
127
|
net-protocol
|
107
|
-
|
108
|
-
net-pop (0.1.1)
|
109
|
-
digest
|
128
|
+
net-pop (0.1.2)
|
110
129
|
net-protocol
|
130
|
+
net-protocol (0.2.1)
|
111
131
|
timeout
|
112
|
-
net-
|
113
|
-
timeout
|
114
|
-
net-smtp (0.3.1)
|
115
|
-
digest
|
132
|
+
net-smtp (0.4.0)
|
116
133
|
net-protocol
|
117
|
-
|
118
|
-
|
119
|
-
nokogiri (1.13.8-x86_64-linux)
|
134
|
+
nio4r (2.5.9)
|
135
|
+
nokogiri (1.15.4-x86_64-linux)
|
120
136
|
racc (~> 1.4)
|
121
|
-
parallel (1.
|
122
|
-
parser (3.
|
137
|
+
parallel (1.23.0)
|
138
|
+
parser (3.2.2.4)
|
123
139
|
ast (~> 2.4.1)
|
124
|
-
|
125
|
-
|
126
|
-
|
140
|
+
racc
|
141
|
+
psych (5.1.1)
|
142
|
+
stringio
|
143
|
+
racc (1.7.1)
|
144
|
+
rack (3.0.8)
|
145
|
+
rack-session (2.0.0)
|
146
|
+
rack (>= 3.0.0)
|
147
|
+
rack-test (2.1.0)
|
127
148
|
rack (>= 1.3)
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
149
|
+
rackup (2.1.0)
|
150
|
+
rack (>= 3)
|
151
|
+
webrick (~> 1.8)
|
152
|
+
rails (7.1.1)
|
153
|
+
actioncable (= 7.1.1)
|
154
|
+
actionmailbox (= 7.1.1)
|
155
|
+
actionmailer (= 7.1.1)
|
156
|
+
actionpack (= 7.1.1)
|
157
|
+
actiontext (= 7.1.1)
|
158
|
+
actionview (= 7.1.1)
|
159
|
+
activejob (= 7.1.1)
|
160
|
+
activemodel (= 7.1.1)
|
161
|
+
activerecord (= 7.1.1)
|
162
|
+
activestorage (= 7.1.1)
|
163
|
+
activesupport (= 7.1.1)
|
140
164
|
bundler (>= 1.15.0)
|
141
|
-
railties (= 7.
|
142
|
-
rails-dom-testing (2.0
|
143
|
-
activesupport (>=
|
165
|
+
railties (= 7.1.1)
|
166
|
+
rails-dom-testing (2.2.0)
|
167
|
+
activesupport (>= 5.0.0)
|
168
|
+
minitest
|
144
169
|
nokogiri (>= 1.6)
|
145
|
-
rails-html-sanitizer (1.
|
146
|
-
loofah (~> 2.
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
170
|
+
rails-html-sanitizer (1.6.0)
|
171
|
+
loofah (~> 2.21)
|
172
|
+
nokogiri (~> 1.14)
|
173
|
+
railties (7.1.1)
|
174
|
+
actionpack (= 7.1.1)
|
175
|
+
activesupport (= 7.1.1)
|
176
|
+
irb
|
177
|
+
rackup (>= 1.0.0)
|
151
178
|
rake (>= 12.2)
|
152
|
-
thor (~> 1.0)
|
153
|
-
zeitwerk (~> 2.
|
179
|
+
thor (~> 1.0, >= 1.2.2)
|
180
|
+
zeitwerk (~> 2.6)
|
154
181
|
rainbow (3.1.1)
|
155
182
|
rake (13.0.6)
|
156
|
-
|
183
|
+
rbs (2.8.4)
|
184
|
+
rdoc (6.5.0)
|
185
|
+
psych (>= 4.0.0)
|
186
|
+
regexp_parser (2.8.2)
|
187
|
+
reline (0.3.9)
|
188
|
+
io-console (~> 0.5)
|
157
189
|
reverse_markdown (2.1.1)
|
158
190
|
nokogiri
|
159
|
-
rexml (3.2.
|
160
|
-
rspec (3.
|
161
|
-
rspec-core (~> 3.
|
162
|
-
rspec-expectations (~> 3.
|
163
|
-
rspec-mocks (~> 3.
|
164
|
-
rspec-core (3.
|
165
|
-
rspec-support (~> 3.
|
166
|
-
rspec-expectations (3.
|
191
|
+
rexml (3.2.6)
|
192
|
+
rspec (3.12.0)
|
193
|
+
rspec-core (~> 3.12.0)
|
194
|
+
rspec-expectations (~> 3.12.0)
|
195
|
+
rspec-mocks (~> 3.12.0)
|
196
|
+
rspec-core (3.12.2)
|
197
|
+
rspec-support (~> 3.12.0)
|
198
|
+
rspec-expectations (3.12.3)
|
167
199
|
diff-lcs (>= 1.2.0, < 2.0)
|
168
|
-
rspec-support (~> 3.
|
169
|
-
rspec-mocks (3.
|
200
|
+
rspec-support (~> 3.12.0)
|
201
|
+
rspec-mocks (3.12.6)
|
170
202
|
diff-lcs (>= 1.2.0, < 2.0)
|
171
|
-
rspec-support (~> 3.
|
172
|
-
rspec-support (3.
|
173
|
-
rubocop (1.
|
203
|
+
rspec-support (~> 3.12.0)
|
204
|
+
rspec-support (3.12.1)
|
205
|
+
rubocop (1.57.0)
|
206
|
+
base64 (~> 0.1.1)
|
174
207
|
json (~> 2.3)
|
208
|
+
language_server-protocol (>= 3.17.0)
|
175
209
|
parallel (~> 1.10)
|
176
|
-
parser (>= 3.
|
210
|
+
parser (>= 3.2.2.4)
|
177
211
|
rainbow (>= 2.2.2, < 4.0)
|
178
212
|
regexp_parser (>= 1.8, < 3.0)
|
179
213
|
rexml (>= 3.2.5, < 4.0)
|
180
|
-
rubocop-ast (>= 1.
|
214
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
181
215
|
ruby-progressbar (~> 1.7)
|
182
|
-
unicode-display_width (>=
|
183
|
-
rubocop-ast (1.
|
184
|
-
parser (>= 3.
|
185
|
-
rubocop-
|
186
|
-
rubocop (~> 1.
|
187
|
-
|
188
|
-
|
216
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
217
|
+
rubocop-ast (1.29.0)
|
218
|
+
parser (>= 3.2.1.0)
|
219
|
+
rubocop-capybara (2.19.0)
|
220
|
+
rubocop (~> 1.41)
|
221
|
+
rubocop-factory_bot (2.24.0)
|
222
|
+
rubocop (~> 1.33)
|
223
|
+
rubocop-performance (1.19.1)
|
224
|
+
rubocop (>= 1.7.0, < 2.0)
|
225
|
+
rubocop-ast (>= 0.4.0)
|
226
|
+
rubocop-rails (2.21.2)
|
227
|
+
activesupport (>= 4.2.0)
|
228
|
+
rack (>= 1.1)
|
229
|
+
rubocop (>= 1.33.0, < 2.0)
|
230
|
+
rubocop-rake (0.6.0)
|
231
|
+
rubocop (~> 1.0)
|
232
|
+
rubocop-rspec (2.24.1)
|
233
|
+
rubocop (~> 1.33)
|
234
|
+
rubocop-capybara (~> 2.17)
|
235
|
+
rubocop-factory_bot (~> 2.22)
|
236
|
+
ruby-progressbar (1.13.0)
|
237
|
+
ruby2_keywords (0.0.5)
|
238
|
+
solargraph (0.49.0)
|
189
239
|
backport (~> 1.2)
|
190
240
|
benchmark
|
191
|
-
bundler (
|
241
|
+
bundler (~> 2.0)
|
192
242
|
diff-lcs (~> 1.4)
|
193
243
|
e2mmap
|
194
244
|
jaro_winkler (~> 1.5)
|
195
245
|
kramdown (~> 2.3)
|
196
246
|
kramdown-parser-gfm (~> 1.1)
|
197
247
|
parser (~> 3.0)
|
198
|
-
|
199
|
-
|
248
|
+
rbs (~> 2.0)
|
249
|
+
reverse_markdown (~> 2.0)
|
250
|
+
rubocop (~> 1.38)
|
200
251
|
thor (~> 1.0)
|
201
252
|
tilt (~> 2.0)
|
202
253
|
yard (~> 0.9, >= 0.9.24)
|
203
|
-
|
204
|
-
thor (1.2.
|
205
|
-
tilt (2.0
|
206
|
-
timeout (0.
|
207
|
-
tzinfo (2.0.
|
254
|
+
stringio (3.0.8)
|
255
|
+
thor (1.2.2)
|
256
|
+
tilt (2.3.0)
|
257
|
+
timeout (0.4.0)
|
258
|
+
tzinfo (2.0.6)
|
208
259
|
concurrent-ruby (~> 1.0)
|
209
|
-
unicode-display_width (2.
|
210
|
-
webrick (1.
|
211
|
-
websocket-driver (0.7.
|
260
|
+
unicode-display_width (2.5.0)
|
261
|
+
webrick (1.8.1)
|
262
|
+
websocket-driver (0.7.6)
|
212
263
|
websocket-extensions (>= 0.1.0)
|
213
264
|
websocket-extensions (0.1.5)
|
214
|
-
yard (0.9.
|
215
|
-
|
216
|
-
zeitwerk (2.6.0)
|
265
|
+
yard (0.9.34)
|
266
|
+
zeitwerk (2.6.12)
|
217
267
|
|
218
268
|
PLATFORMS
|
219
269
|
x86_64-linux
|
@@ -224,11 +274,14 @@ DEPENDENCIES
|
|
224
274
|
rake
|
225
275
|
rspec
|
226
276
|
rubocop
|
277
|
+
rubocop-performance
|
278
|
+
rubocop-rails
|
279
|
+
rubocop-rake
|
227
280
|
rubocop-rspec
|
228
281
|
solargraph
|
229
282
|
|
230
283
|
RUBY VERSION
|
231
|
-
ruby 3.
|
284
|
+
ruby 3.2.2p53
|
232
285
|
|
233
286
|
BUNDLED WITH
|
234
287
|
2.3.15
|
data/README.md
CHANGED
@@ -73,21 +73,19 @@ rails generate pg_rls:install company #=> where company eq tenant model name
|
|
73
73
|
You can change company to anything you'd like, for example, `tenant`
|
74
74
|
This will generate the model and inject all the required code
|
75
75
|
|
76
|
-
For any new model that needs to be under rls, you can generate it by writing
|
76
|
+
For any new model that needs to be under rls, you can generate it by writing
|
77
77
|
|
78
78
|
```bash
|
79
79
|
rails generate pg_rls user #=> where user eq model name
|
80
80
|
```
|
81
81
|
and it will generate all the necesary information for you.
|
82
82
|
|
83
|
-
You can swtich to another tenant by using
|
83
|
+
You can swtich to another tenant by using
|
84
84
|
```ruby
|
85
85
|
PgRls::Tenant.switch :app #=> where app eq tenant name
|
86
86
|
```
|
87
87
|
Don't forget to update how you want `PgRls` to find your tenant, you can set multiple options by modifying `api/config/initializers/pg_rls.rb` `search_methods`
|
88
88
|
|
89
|
-
You can add the following configuration to your Database Config File to improve performance and remove `PgRls::SecureConnection` from `aplication_record.rb`
|
90
|
-
|
91
89
|
```yml
|
92
90
|
# app/config/database.yml
|
93
91
|
<% def db_username
|
@@ -124,7 +122,6 @@ config.before(:suite) do
|
|
124
122
|
# In this default case our initializer is set to search by subdomain so will use it
|
125
123
|
PgRls::Tenant.switch :app
|
126
124
|
end
|
127
|
-
|
128
125
|
...
|
129
126
|
```
|
130
127
|
## Development
|
@@ -146,7 +143,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
146
143
|
Everyone interacting in the PgRls project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/dandush03/pg_rls/blob/master/CODE_OF_CONDUCT.md).
|
147
144
|
|
148
145
|
## Note
|
149
|
-
Currently we only support subdomain as a searcher but will soon integrate slug/domain and cookies support
|
146
|
+
Currently we only support subdomain as a searcher but will soon integrate slug/domain and cookies support
|
150
147
|
we recommed the use of ``
|
151
148
|
## Show your support
|
152
149
|
|