-
-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.x] Make forcing RLS configurable #1293
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1293 +/- ##
============================================
+ Coverage 84.68% 85.04% +0.35%
- Complexity 1036 1067 +31
============================================
Files 175 176 +1
Lines 3043 3163 +120
============================================
+ Hits 2577 2690 +113
- Misses 466 473 +7 ☔ View full report in Codecov by Sentry. |
@@ -21,6 +21,7 @@ | |||
use Stancl\Tenancy\Database\Exceptions\RecursiveRelationshipException; | |||
|
|||
beforeEach(function () { | |||
CreateUserWithRLSPolicies::$forceRls = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also reset this in afterEach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing in the other test files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/RLS/TraitManagerTest.php
Outdated
})->with( | ||
[true, false], | ||
[true, false], | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
})->with( | |
[true, false], | |
[true, false], | |
); | |
})->with( | |
[true, false], | |
[false, true], | |
); |
or
})->with( | |
[true, false], | |
[true, false], | |
); | |
})->with([true, false])->with([true, false]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm or is the syntax that it builds a matrix from those arrays? I see in another dataset it's used that way.
Probably change these to use two with()
calls to make that more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm or is the syntax that it builds a matrix from those arrays?
Yeah
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used the two with()
calls
This PR adds the
$forceRls
static property to thetenants:rls
command.If
$forceRls
istrue
(default), the table owners won't be able to query their own tables (unless the owners have the BYPASSRLS privilege). If the property is set tofalse
, table owners will bypass RLS, allowing them to query the owned tables.