mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 03:14:04 +00:00
Make path skipping logic more explicit
This commit is contained in:
parent
349ac6e9fc
commit
adfddab951
1 changed files with 5 additions and 2 deletions
|
|
@ -142,7 +142,10 @@ class TableRLSManager implements RLSPolicyManager
|
||||||
$pathExplicitlySkipped = $foreignKey['comment'] === 'no-rls';
|
$pathExplicitlySkipped = $foreignKey['comment'] === 'no-rls';
|
||||||
$pathImplicitlySkipped = ! static::$scopeByDefault && (
|
$pathImplicitlySkipped = ! static::$scopeByDefault && (
|
||||||
! isset($foreignKey['comment']) ||
|
! isset($foreignKey['comment']) ||
|
||||||
(is_string($foreignKey['comment']) && ! Str::startsWith($foreignKey['comment'], 'rls'))
|
(is_string($foreignKey['comment']) && ! (
|
||||||
|
Str::is($foreignKey['comment'], 'rls') || // Explicit RLS
|
||||||
|
Str::startsWith($foreignKey['comment'], 'rls ') // Comment constraint
|
||||||
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
return $pathExplicitlySkipped || $pathImplicitlySkipped;
|
return $pathExplicitlySkipped || $pathImplicitlySkipped;
|
||||||
|
|
@ -169,7 +172,7 @@ class TableRLSManager implements RLSPolicyManager
|
||||||
|
|
||||||
// Validate comment constraint format
|
// Validate comment constraint format
|
||||||
if (count($constraint) !== 2 || empty($constraint[0]) || empty($constraint[1])) {
|
if (count($constraint) !== 2 || empty($constraint[0]) || empty($constraint[1])) {
|
||||||
throw new RLSCommentConstraintException("Incorrectly formatted comment constraint on {$tableName}.{$column['name']}: '{$column['comment']}'");
|
throw new RLSCommentConstraintException("Malformed comment constraint on {$tableName}.{$column['name']}: '{$column['comment']}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$foreignTable = $constraint[0];
|
$foreignTable = $constraint[0];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue