1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 06:04:03 +00:00
This commit is contained in:
lukinovec 2023-04-26 15:34:27 +02:00
parent 562d507482
commit 034c284303
2 changed files with 4 additions and 2 deletions

View file

@ -43,6 +43,8 @@ class CreateRLSPoliciesForTables
) )
)"); )");
dump(DB::select("select CURRENT_USER"));
DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY"); DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY");
return Command::SUCCESS; return Command::SUCCESS;

View file

@ -46,7 +46,7 @@ test('postgres user can get deleted using the job', function() {
expect($tenantHasPostgresUser())->toBeFalse(); expect($tenantHasPostgresUser())->toBeFalse();
}); });
test('correct rls policies get created using the action or the command', function(bool $action) { test('correct rls policies get created', function(bool $action) {
config([ config([
'tenancy.models.rls' => [ 'tenancy.models.rls' => [
Post::class, // Primary model (directly belongs to tenant) Post::class, // Primary model (directly belongs to tenant)
@ -94,4 +94,4 @@ test('correct rls policies get created using the action or the command', functio
expect($getModelTables())->toContain($table->relname); expect($getModelTables())->toContain($table->relname);
expect($table->relforcerowsecurity)->toBeTrue(); expect($table->relforcerowsecurity)->toBeTrue();
} }
})->with([true, false]); })->with(['action' => true, 'command' => false]);