File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,9 +115,13 @@ export class DbAdmin {
115115 await this . streamSql ( sql , db ) ;
116116 }
117117
118+ // TODO: make adminRole a configurable option
119+ // ONLY granting admin role for testing purposes, normally the db connection for apps won't have admin role
120+ // DO NOT USE THIS FOR PRODUCTION
118121 async createUserRole ( user : string , password : string , dbName : string ) : Promise < void > {
119122 const anonRole = getRoleName ( 'anonymous' , this . roleConfig ) ;
120123 const authRole = getRoleName ( 'authenticated' , this . roleConfig ) ;
124+ const adminRole = getRoleName ( 'administrator' , this . roleConfig ) ;
121125
122126 const sql = `
123127 DO $$
@@ -126,6 +130,7 @@ export class DbAdmin {
126130 CREATE ROLE ${ user } LOGIN PASSWORD '${ password } ';
127131 GRANT ${ anonRole } TO ${ user } ;
128132 GRANT ${ authRole } TO ${ user } ;
133+ GRANT ${ adminRole } TO ${ user } ;
129134 END IF;
130135 END $$;
131136 ` . trim ( ) ;
You can’t perform that action at this time.
0 commit comments