mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 01:14:03 +00:00
Test that tenant permmissions are scoped only to the tenant schema
This commit is contained in:
parent
08b4216d69
commit
d005e7b06d
1 changed files with 16 additions and 0 deletions
|
|
@ -228,6 +228,22 @@ test('users created by CreatePostgresUserForTenant are only granted the permissi
|
||||||
->not()->toContain('DELETE');
|
->not()->toContain('DELETE');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('postgres user permissions are only scoped to the tenant app', function() {
|
||||||
|
$tenant = Tenant::create();
|
||||||
|
// ALL grants'
|
||||||
|
CreatePostgresUserForTenant::dispatchSync($tenant);
|
||||||
|
|
||||||
|
tenancy()->initialize($tenant);
|
||||||
|
|
||||||
|
// Tenant cannot access central data due to insufficient permissions
|
||||||
|
expect(fn () => Tenant::all())->toThrow(Exception::class);
|
||||||
|
|
||||||
|
tenancy()->end();
|
||||||
|
|
||||||
|
// Central data can be accessed from the central context
|
||||||
|
expect(Tenant::all())->not()->toBeEmpty();
|
||||||
|
})->group('access');
|
||||||
|
|
||||||
test('model discovery gets the models correctly', function() {
|
test('model discovery gets the models correctly', function() {
|
||||||
// 'tenancy.rls.model_directories' is set to [__DIR__ . '/Etc'] in beforeEach
|
// 'tenancy.rls.model_directories' is set to [__DIR__ . '/Etc'] in beforeEach
|
||||||
// Check that the Post and ScopedComment models are found in the directory
|
// Check that the Post and ScopedComment models are found in the directory
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue