From 034c2843033910f8a9811f1dc8b135129951b657 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Wed, 26 Apr 2023 15:34:27 +0200 Subject: [PATCH] wip --- src/Actions/CreateRLSPoliciesForTables.php | 2 ++ tests/PostgresTest.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Actions/CreateRLSPoliciesForTables.php b/src/Actions/CreateRLSPoliciesForTables.php index 4c9479fb..94f21fcb 100644 --- a/src/Actions/CreateRLSPoliciesForTables.php +++ b/src/Actions/CreateRLSPoliciesForTables.php @@ -43,6 +43,8 @@ class CreateRLSPoliciesForTables ) )"); + dump(DB::select("select CURRENT_USER")); + DB::statement("ALTER TABLE {$table} FORCE ROW LEVEL SECURITY"); return Command::SUCCESS; diff --git a/tests/PostgresTest.php b/tests/PostgresTest.php index 1a36357c..5bf6463c 100644 --- a/tests/PostgresTest.php +++ b/tests/PostgresTest.php @@ -46,7 +46,7 @@ test('postgres user can get deleted using the job', function() { 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([ 'tenancy.models.rls' => [ 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($table->relforcerowsecurity)->toBeTrue(); } -})->with([true, false]); +})->with(['action' => true, 'command' => false]);