1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 05:44:04 +00:00
Commit graph

1362 commits

Author SHA1 Message Date
6c01635a3e Merge branch 'may25' into rls-fake-constrained-foreign-keys 2025-07-01 00:33:12 +02:00
lukinovec
1e926a1dde
[4.x] Route cloning refactor (#1353)
* Refactor cloning action, update tests

* Delete redundant "should not be cloned" part from shouldBeCloned()

* Use 'clone' instead of a universal route in tenant parameter removal test

* Improve comment

* Add test for cloneRoutesWithMiddleware(), correct existing tests

* Allow cloning specific routes by name

* Fix typo in CloneActionTest

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* clean up CloneRoutesAsTenant, add a todo

* phpstan

* Add test for handling 'clone'  in MW groups

* Improve regression test

* Improve regression test

* Handle nested cloning flags in CloneRoutesAsTenant

* Ignore routes that are already considered tenant routes from cloning, update test accordingly

* Clarify cloning logic

* CloneRoutesAsTenant cleanup

* Rewrite clone action annotation, fix fluent usage bug

* Improve tests (comments, use $tenant->id instead of $tenant->getTenantKey())

* Test that the clone action can be used fluently without issues now (could serve as a regression test for the routesToClone change in previous commit)

* Minor annotation improvements

* Improve route cloning action docblock

* Add note about clearing the $routesToClone property

* improve docblock

* clean up tests

* fix typo

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2025-07-01 00:32:42 +02:00
lukinovec
84ac69c908 Fully cover shouldSkipPathLeadingThrough in tests 2025-06-27 14:58:17 +02:00
lukinovec
8934114f92 Move RLSCommentConstraintException to src/RLS/Exceptions 2025-06-27 11:54:13 +02:00
lukinovec
7e1fe075f4
[4.x] Test that global scopes on syncable models can break resource syncing, and that $scopeGetModelQuery can be used as a workaround for that (#1285)
* Add test for syncable models with global scopes

* minor fixes

* Make test clearer

* Improve test name

* Clarify scopeGetModelQuery test, document edge case

* Fix assertion

* Delete extra newline

* Update the scopeGetModelQuery test so that it tests a realistic case

* Clarify test

* cleanup

* Try simplifying the tests

* Revert change to test adding unnecessary complexity

* Make test clear, extensively commented and as simple as possible

* Delete unused import

* Make test clearer

* Polish comments

* Improve comment

* Explicitly reset global scopes on models in beforeEach()

* Simplify comments in test

* Revert changes in test

* add assertion

* add global scope reset to afterEach

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2025-06-26 13:39:11 +02:00
lukinovec
d62ad4a53a Improve docblocks,as discussed 2025-06-24 12:50:41 +02:00
lukinovec
8505045e00 Minor shortestPathToTenantsTable improvement 2025-06-23 14:47:07 +02:00
lukinovec
7a16df80aa Delete findShortestPath, merge the code into shortestPathToTenantsTabke 2025-06-23 14:27:12 +02:00
cb422c1e72 bump php memory limit when running tests 2025-06-23 13:01:10 +02:00
00cdde896c Merge branch 'may25' into rls-fake-constrained-foreign-keys 2025-06-23 12:53:37 +02:00
7481229063 revert regression in last commit, opt for a phpstan ignore instead 2025-06-19 00:12:38 +02:00
12fcbabd76 phpstan fix 2025-06-18 23:52:35 +02:00
551895d582 Merge branch 'master' into may25 2025-06-18 23:38:21 +02:00
e1fc0e107d remove ignition dependencies 2025-06-18 23:29:24 +02:00
lukinovec
6da3307ec7 Fix typo 2025-06-12 09:22:50 +02:00
lukinovec
fb382a10d1 Improve comments and method name 2025-06-12 09:19:34 +02:00
lukinovec
fbbe697500 Correct terminology in table manager test file 2025-06-10 09:46:04 +02:00
lukinovec
9b34a8cdf3 Correct terminology and comments in TableRLSManager 2025-06-10 09:42:51 +02:00
github-actions[bot]
8d37415fc8 Fix code style (php-cs-fixer) 2025-06-09 14:23:44 +00:00
lukinovec
608e11a4f0 Add a "single source of truth" for path array format, make lower-level code more concise, improve comments 2025-06-09 16:23:24 +02:00
github-actions[bot]
4f909b09d9 Fix code style (php-cs-fixer) 2025-06-09 13:38:36 +00:00
lukinovec
e7d406b3df Improve comments, delete excessive methods, make methods more concise, position helper methods more appropriately 2025-06-09 15:38:10 +02:00
lukinovec
a8941c3373 Make higher-level code clearer, improve comments 2025-06-09 14:37:32 +02:00
lukinovec
f68ead8e38 Use tenant id instead of getTenantKey() 2025-06-09 14:04:15 +02:00
lukinovec
df0d96f9bf Test data separation with comment constraints 2025-06-09 14:03:46 +02:00
lukinovec
1d87e4b00f Delete excessive test 2025-06-09 13:51:41 +02:00
lukinovec
0dce61bd34 Clarify and simplify tests, add comments 2025-06-09 12:59:52 +02:00
lukinovec
cac2649568 Simplify and clarify core shortest path generation test 2025-06-09 12:38:27 +02:00
8c773245f7 Merge branch 'may25' into rls-fake-constrained-foreign-keys 2025-06-05 05:08:14 +02:00
lukinovec
2057e1e5ae
[4.x] Make forcing RLS configurable (#1293)
* Add `$forceRls` static property to tenants:rls

* Set `$forceRls` in tests where scoping is tested, add non-superuser, non-bypassrls table owner test

* Move DROP TABLE statement

* Remove try/catch

* Put DROP OWNED BY into try/catch

* Static property cleanup in afterEach

* Make with() matrix syntax more clear by using with() multiple times

* Fix typo, improve comment

* Move and update force RLS comment

* Add test for `$forceRls = false`, refactor BYPASSRLS test

* Update link in test comment

* Add a dataset for `$forceRls` in the table owner test, fix BYPASSRLS test

* Correct PR link comment

* minor fixes

* Add test that makes the bypassrls/forceRls behavior clear

* Delete redundant test

* cleanup

* Update tests/RLS/TableManagerTest.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-05 05:06:05 +02:00
e74e1f92e1
Make RouteMode enum backed (#1362) 2025-06-02 20:34:49 +02:00
lukinovec
f771aa8645
[4.x] Test that route model binding works correctly with path identification (#1360)
* Test that route model binding works with path identification (closure-based routes)

* Correct test name

* Update tests/PathIdentificationTest.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* make assertions more clear

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2025-06-02 19:05:17 +02:00
5f7fd38e5a
[4.x] URL generation, request data identification improvements (#1357)
* UrlGenerator: set defaults based on config; request data: move config to config file+resolver

* Claude code adjustments

* improve request data tests, simplify complex test in UrlGeneratorBootstrapperTest

* url generator test: test changing tenant parameter name

* request data identification: add tenant_model_column configuration

* defaultParameterNames -> passQueryParameter

* move comment

* minor refactor in PathIdentificationTest, expand CLAUDE.md to include early identification section

* Fix COLOR_FLAG

* improve test name

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* TenancyUrlGenerator: add a check for queryParameterName being null

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix code style (php-cs-fixer)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-02 03:43:47 +02:00
f4cc99b317 fix phpstan 2025-05-29 18:39:05 +02:00
37f6260812 Add CLAUDE.md 2025-05-29 18:36:09 +02:00
lukinovec
c89c2938fe Improve method name 2025-05-29 13:28:56 +02:00
lukinovec
bfe62611e0 Improve comment 2025-05-29 13:15:35 +02:00
lukinovec
a1e8324fb5 Use consistent shortest path terminology 2025-05-29 13:13:41 +02:00
lukinovec
c867ecec44 Update the tree terminology 2025-05-29 13:06:54 +02:00
github-actions[bot]
82f9138666 Fix code style (php-cs-fixer) 2025-05-29 10:52:24 +00:00
lukinovec
233dbd0184 Improve readability 2025-05-29 12:51:37 +02:00
lukinovec
973f7994c3 Improve code for determining the shortest path 2025-05-29 12:51:37 +02:00
lukinovec
1bfac014ab Test uncovered edge cases 2025-05-29 12:51:36 +02:00
lukinovec
3e8cb02981 Improve TableRLSManager comments 2025-05-29 12:51:36 +02:00
github-actions[bot]
759931394c Fix code style (php-cs-fixer) 2025-05-28 13:56:50 +00:00
lukinovec
a3b925b362 Refactor TableRLSManagerr (dynamic programming, deal with recursive relationships, determine shortest paths while generating the paths) 2025-05-28 15:56:25 +02:00
lukinovec
37edba8dbc Improve comments 2025-05-21 14:10:46 +02:00
github-actions[bot]
3d6be96f7d Fix code style (php-cs-fixer) 2025-05-21 12:05:11 +00:00
lukinovec
640ba9e7f1 Correct terminology, add test for throwing exceptions 2025-05-21 14:03:51 +02:00
lukinovec
adfddab951 Make path skipping logic more explicit 2025-05-21 14:03:51 +02:00