rls_multi_tenant 0.1.2 → 0.1.4

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: fcb89757e26727014390f0ce50eed58d22e760d4249508bf58c550533e0ef14c
4
- data.tar.gz: 21d57b4c19ff0f5117bd62df654b2815eb75a54749adf8a689448816a29f3141
3
+ metadata.gz: 67facbb6334d74a015aebaf68da5616a49345aafbb56da7000a1685d6cbc941b
4
+ data.tar.gz: 7923881ec5e324f2e080a83a11303bceaa510f301d86725c314dfdb33964284a
5
5
  SHA512:
6
- metadata.gz: 0c00dde13e466a6d466f8170b3732775654bdb1655d1985717d551667313d3a250cbaf74067a770f14600da7d64582d1d2b241e668f8f3b6f831752d3767f9f5
7
- data.tar.gz: 4a3df9f10af7671d2ed572b8d3f1009155bff00014f6823e130a39b3f4d50a1b5de9e2a86ce271e38e7378e99185694435e6332012e7091a6b287c803ac81c5b
6
+ metadata.gz: 6d051f19c12738ca80800d753103dbbb783f1d521eb9453cffb553a988a19b3ae81327be0aae62a376b358668bfc394f97a4e1afd4fb242fe48214a8995fac11
7
+ data.tar.gz: 4674cc8484191244f3c7534de226a147a18bca9e8af0199749820f805338c1a32fa412054d12cc27c007f094724a5fb8fa1418feb68a4f74124b0ebe17ba3683
@@ -18,6 +18,14 @@ class CreateAppUser < ActiveRecord::Migration[<%= Rails.version.to_f %>]
18
18
  execute "GRANT CONNECT ON DATABASE #{ActiveRecord::Base.connection.current_database} TO #{app_user};"
19
19
  execute "GRANT USAGE ON SCHEMA public TO #{app_user};"
20
20
  execute "GRANT CREATE ON SCHEMA public TO #{app_user};"
21
+
22
+ # Grant default permissions for future tables in public schema
23
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO #{app_user};"
24
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE, SELECT ON SEQUENCES TO #{app_user};"
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};"
21
29
  end
22
30
 
23
31
  def down
@@ -26,6 +34,10 @@ class CreateAppUser < ActiveRecord::Migration[<%= Rails.version.to_f %>]
26
34
  # Revoke permissions
27
35
  execute "REVOKE ALL ON SCHEMA public FROM #{app_user};"
28
36
  execute "REVOKE CONNECT ON DATABASE #{ActiveRecord::Base.connection.current_database} FROM #{app_user};"
37
+
38
+ # Revoke default permissions for future tables in public schema
39
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLES FROM #{app_user};"
40
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE USAGE, SELECT ON SEQUENCES FROM #{app_user};"
29
41
 
30
42
  # Drop user
31
43
  execute "DROP ROLE IF EXISTS #{app_user};"
@@ -19,6 +19,10 @@ class CreateAppUser < ActiveRecord::Migration[<%= Rails.version.to_f %>]
19
19
  execute "GRANT USAGE ON SCHEMA public TO #{app_user};"
20
20
  execute "GRANT CREATE ON SCHEMA public TO #{app_user};"
21
21
 
22
+ # Grant default permissions for future tables in public schema
23
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO #{app_user};"
24
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT USAGE, SELECT ON SEQUENCES TO #{app_user};"
25
+
22
26
  # Grant permissions on system tables
23
27
  execute "GRANT SELECT ON TABLE schema_migrations TO #{app_user};"
24
28
  execute "GRANT SELECT ON TABLE ar_internal_metadata TO #{app_user};"
@@ -31,6 +35,10 @@ class CreateAppUser < ActiveRecord::Migration[<%= Rails.version.to_f %>]
31
35
  execute "REVOKE ALL ON SCHEMA public FROM #{app_user};"
32
36
  execute "REVOKE CONNECT ON DATABASE #{ActiveRecord::Base.connection.current_database} FROM #{app_user};"
33
37
 
38
+ # Revoke default permissions for future tables in public schema
39
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLES FROM #{app_user};"
40
+ execute "ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE USAGE, SELECT ON SEQUENCES FROM #{app_user};"
41
+
34
42
  # Drop user
35
43
  execute "DROP ROLE IF EXISTS #{app_user};"
36
44
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RlsMultiTenant
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rls_multi_tenant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Coding Ways