1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 22:24:03 +00:00

Add todos

This commit is contained in:
lukinovec 2023-04-28 14:23:22 +02:00
parent 0a2415319b
commit b90b635f90

View file

@ -38,6 +38,8 @@ class CreatePostgresUserForTenant implements ShouldQueue
$password = $this->tenant->database()->getPassword() ?? 'password'; $password = $this->tenant->database()->getPassword() ?? 'password';
// Create the user only if it doesn't already exist // Create the user only if it doesn't already exist
// todo1 Create permissions for the user (e.g. permission to create records)
// todo1 Switch to the Postgres user on TenancyInitialized (purge central DB connection, change credentials in database.connections.pgsql, change database.connections.central to the pgsql connection)
if (! count(DB::select("SELECT usename FROM pg_user WHERE usename = '$name';")) > 0) { if (! count(DB::select("SELECT usename FROM pg_user WHERE usename = '$name';")) > 0) {
DB::statement("CREATE USER \"$name\" LOGIN PASSWORD '$password';"); DB::statement("CREATE USER \"$name\" LOGIN PASSWORD '$password';");
} }