mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-15 09:54:03 +00:00
Postgres RLS + permission controlled database managers (#33)
This PR adds Postgres RLS (trait manager + table manager approach) and permission controlled managers for PostgreSQL. --------- Co-authored-by: lukinovec <lukinovec@gmail.com> Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
This commit is contained in:
parent
34297d3e1a
commit
7317d2638a
39 changed files with 2511 additions and 112 deletions
18
src/Database/Exceptions/RecursiveRelationshipException.php
Normal file
18
src/Database/Exceptions/RecursiveRelationshipException.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Database\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @see \Stancl\Tenancy\RLS\PolicyManagers\TableRLSManager
|
||||
*/
|
||||
class RecursiveRelationshipException extends Exception
|
||||
{
|
||||
public function __construct(string|null $message = null)
|
||||
{
|
||||
parent::__construct($message ?? "Table's foreign key referenced multiple times in the same path.");
|
||||
}
|
||||
}
|
||||
18
src/Database/Exceptions/TableNotRelatedToTenantException.php
Normal file
18
src/Database/Exceptions/TableNotRelatedToTenantException.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\Database\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @see \Stancl\Tenancy\RLS\PolicyManagers\TraitRLSManager
|
||||
*/
|
||||
class TableNotRelatedToTenantException extends Exception
|
||||
{
|
||||
public function __construct(string $table)
|
||||
{
|
||||
parent::__construct("Table $table does not belong to a tenant directly or through another table.");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue