File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
lib/kuby/plugins/rails_app/crdb Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ class Plugin < ::Kuby::Plugin
1313 VERSION = '24.3.6' . freeze
1414 BOOTSTRAP_TIMEOUT_INTERVAL = 2
1515 BOOTSTRAP_TIMEOUT_TOTAL = 60
16- CLIENT_PERMISSIONS = %w( create drop select insert delete update ) . freeze
16+ DATABASE_PERMISSIONS = %w( create drop ) . freeze
17+ SCHEMA_PERMISSIONS = %w( select insert update delete ) . freeze
1718
1819 attr_reader :environment , :configs
1920
@@ -140,10 +141,20 @@ def bootstrap
140141 end
141142
142143 conn . exec (
143- "grant #{ CLIENT_PERMISSIONS . join ( ',' ) } " \
144+ "grant connect on database #{ database_name } to #{ username } "
145+ )
146+
147+ conn . exec (
148+ "grant #{ DATABASE_PERMISSIONS . join ( ',' ) } " \
144149 "on database #{ database_name } " \
145150 "to #{ username } "
146151 )
152+
153+ conn . exec (
154+ "grant #{ SCHEMA_PERMISSIONS . join ( ',' ) } " \
155+ "on all tables in schema public " \
156+ "to #{ username } "
157+ )
147158 end
148159 end
149160
You can’t perform that action at this time.
0 commit comments