mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 19:24:02 +00:00
Only grant the permissions from the static property in the user creation job
This commit is contained in:
parent
73144a874a
commit
c31340bff0
1 changed files with 6 additions and 1 deletions
|
|
@ -17,6 +17,8 @@ class CreatePostgresUserForTenant implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public static array $permissions = ['ALL'];
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
|
|
@ -57,7 +59,10 @@ class CreatePostgresUserForTenant implements ShouldQueue
|
|||
foreach ($tenantModels as $model) {
|
||||
$table = $model->getTable();
|
||||
|
||||
$databaseManager->database()->statement("GRANT ALL ON {$table} TO \"{$userName}\"");
|
||||
foreach (static::$permissions as $permission) {
|
||||
$databaseManager->database()->statement("GRANT {$permission} ON {$table} TO \"{$userName}\"");
|
||||
}
|
||||
|
||||
$databaseManager->database()->statement("GRANT USAGE ON ALL SEQUENCES IN SCHEMA public TO \"{$userName}\"");
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue