pg_rls 0.0.2.1 → 0.0.2.2
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/lib/generators/templates/pg_rls.rb.tt +2 -2
- data/lib/pg_rls/database/tasks/admin_database.rake +2 -2
- data/lib/pg_rls/version.rb +1 -1
- data/lib/pg_rls.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 93c5a9cfdee90d5ae47e267bc860dd283681714f7dce61a6a91da9c039ecc007
|
|
4
|
+
data.tar.gz: de67343a322883ae4e428cad06dc1c2d5e6bcf1a906286e9f4237f36fbd4d742
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87012f063d03c517ef4cd5d0580d346b4b60c0a13cb74737b3d99d8d32331a5edfee6553dfe57aacded8e5df3e0e35fcb78246d08b433239108216e781de7081
|
|
7
|
+
data.tar.gz: 72bee218c897bec98d2c78c8a19aba3b99b3a2ceb80c3d38249fc1b674a803f0d7bde5576fdc76419cd09d61da8e1910f368dfad35ec7583ea4aca06169cdd0a
|
|
@@ -11,11 +11,11 @@ PgRls.setup do |config|
|
|
|
11
11
|
config.search_methods = <%= PgRls.search_methods %>
|
|
12
12
|
|
|
13
13
|
##
|
|
14
|
-
## Uncomment this lines if you have a custome user per
|
|
14
|
+
## Uncomment this lines if you have a custome user per environment
|
|
15
15
|
## don't forget to grant the required privilange in order for it to run
|
|
16
16
|
##
|
|
17
17
|
## Remember that PgRls is adding triggers that would set the RLS to the default user
|
|
18
|
-
## make sure you recreate the structure.sql on each
|
|
18
|
+
## make sure you recreate the structure.sql on each environment
|
|
19
19
|
##
|
|
20
20
|
# config.username = Rails.application.credentials.dig(:database, :username)
|
|
21
21
|
# config.password = Rails.application.credentials.dig(:database, :password)
|
|
@@ -149,10 +149,10 @@ namespace :db do
|
|
|
149
149
|
end
|
|
150
150
|
end
|
|
151
151
|
|
|
152
|
-
namespace :
|
|
152
|
+
namespace :environment do
|
|
153
153
|
override_task set: :load_config do
|
|
154
154
|
admin_connection do
|
|
155
|
-
Rake::Task['db:
|
|
155
|
+
Rake::Task['db:environment:set:original'].invoke
|
|
156
156
|
end
|
|
157
157
|
end
|
|
158
158
|
end
|
data/lib/pg_rls/version.rb
CHANGED
data/lib/pg_rls.rb
CHANGED
|
@@ -48,7 +48,7 @@ module PgRls
|
|
|
48
48
|
end
|
|
49
49
|
|
|
50
50
|
def establish_new_connection
|
|
51
|
-
ActiveRecord::Base.connection.disconnect!
|
|
51
|
+
ActiveRecord::Base.connection.disconnect! if ActiveRecord::Base.connection_pool.connected?
|
|
52
52
|
|
|
53
53
|
connection_class.establish_connection(**database_configuration)
|
|
54
54
|
end
|
|
@@ -101,11 +101,11 @@ module PgRls
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
def database_admin_configuration
|
|
104
|
-
|
|
104
|
+
environment_db_configuration = database_connection_file[Rails.env]
|
|
105
105
|
|
|
106
|
-
return
|
|
106
|
+
return environment_db_configuration if environment_db_configuration['username'].present?
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
environment_db_configuration.first.last
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
def database_configuration
|
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: 0.0.2.
|
|
4
|
+
version: 0.0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Laloush
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-09-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|