1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 11:34:03 +00:00
Commit graph

1271 commits

Author SHA1 Message Date
7572911d87 remove dead code 2024-05-28 02:55:13 +02:00
97ccbbe1f9 bump php version 2024-05-28 02:16:00 +02:00
f0bb28345f categorize todos 2024-05-17 14:23:54 +02:00
Samuel Štancl
b97c203967
Revert changes that caused issues with Laravel Octane [ci skip] 2024-04-24 22:36:51 +02:00
lukinovec
b789f5c561
Change URI prefix order during route cloning (#49)
* Change URI prefix order [ci skip]

* Move route cloning to `$this->app->booted()` [ci skip]

* Delete note about LW v2

* Improve comments/docblock [skip ci]

* Fix comment in test, improve assertion [skip ci]
2024-04-24 22:33:18 +02:00
Samuel Štancl
7317d2638a
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>
2024-04-24 22:32:49 +02:00
34297d3e1a editor config: prevent tailwindcss LSP from starting in nvim [ci skip] 2024-04-22 21:27:53 +02:00
lukinovec
77226cf2f4
Delete pivot records when deleting SyncMaster using morph pivot (#46)
* Add and correct pivot record tests

* Implement and test deleting pivot records when using morph pivot

* Use dataset to test deleting pivot records with both MorphTenantPivot and TenantPivot

* Delete extra test, use createTenantsAndRunMigrations() where appropriate

* FIx PHPStan errors

* Revert DB::table() assertion changes

* minor test improvements

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-04-22 12:18:15 +02:00
lukinovec
4e51cdbacb
Refactor early identification (#47)
* Make universal route logic part of tbe early ID trait

* Add requstHasTenant to prevent access MW, add todo@samuel

* Delete PathIdentificationManager, move the used methods appropriately

* Correct and refactor code related to the deleted PathIdentificationManager class

* Add docblock

* Fix code style (php-cs-fixer)

* refactor globalStackMiddleware()

* remove todos [ci skip]

* refactor routeMiddleware()

* revert bool assertions

* revert more changes

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-04-22 11:30:58 +02:00
lukinovec
b70cd0e531
Use correct route facade classes in TSP comments (#48) 2024-04-19 17:11:50 +02:00
lukinovec
6e67ddf7a5
Resolve test to-dos (#45)
* Only retrieve domains if the relationship and the domains table exist (DomianTenantResolver)

* Resolve todo, add other todos

* Use constructor promotion in DeleteDomains

* Fix imports + domain deletion test

* Confirm that turning on resolver caching doesn't break the tests

* Fix Tenant model imports

* Fix code style (php-cs-fixer)

* remove runtime schema check

* temp: enable resolver cache

* make 'autoincrement ids are supported' pass

* disable resolver cache

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-04-18 00:22:03 +02:00
3e441e075f remove deprecation test 2024-04-16 03:14:31 +02:00
4bdb986b96 remove old UUID generator, minor config changes 2024-04-16 02:17:20 +02:00
83b1ae1aea change default cookie name, add todos 2024-04-15 03:11:11 +02:00
55b1c5387c fix combination calculation docblock for random str generator 2024-04-13 05:43:37 +02:00
e727e07212 redis bootstrapper: support clusters (#1207) 2024-04-12 01:05:46 +02:00
e36157bd61 fix typo [ci skip] 2024-04-11 05:42:46 +02:00
b3019844e3 add todo [ci skip] 2024-04-10 04:13:23 +02:00
630f404227 add assertion, update todos 2024-04-10 03:35:57 +02:00
20c1b9a940 phpcsfixer: enable nullable_type_declaration_for_default_null_value 2024-04-09 20:55:49 +02:00
Samuel Štancl
eecf6f21c8
Cache prefixing logic rewrite, session scoping improvements, tests refactor (#43)
* Run cache tests on all supported drivers

* update ci healthcheck for memcached

* remove memcached healthcheck

* fix typos in test comments, expand internal.md [ci skip]

* add empty line [ci skip]

* switch to using $store->setPrefix()

* add dynamodb

* refactor try-finally to try-catch

* remove unnecessary clearResolvedInstances() call

* add dual Cache:: and cache() assertions

* add apc

* Flush APCu cache in test setup

* Revert "add dual Cache:: and cache() assertions"

This reverts commit a0bab162fbe2dd0d25e7056ceca4fb7ce54efc77.

* phpstan fix

* Add logic for scoping 'file' disks to FilesystemTenancyBootstrapper

* minor changes, add todos

* refactor how the session.connection is used in the DB session bootstrapper

* add session forgery prevention logic to the db session bootstrapper

* only use the fs bootstrapper for file disk in 'cache data is separated' dataset

* minor session scoping test changes

* Add session scoping logic to FilesystemTenancyBootstrapper, correctly update disk roots even with storage_path_tenancy disabled

* Fix code style (php-cs-fixer)

* update docblock

* make not-null check more explicit

* separate bootstrapper tests, fix swapped test names for two tests

* refactor cache bootstrapper tests

* resolve global cache todo

* expand tests: session separation tests, more filesystem separation assertions; change prefix_base-type config keys to templates/formats

* add apc session scoping test, various session separation bugfixes

* phpstan + minor logic fixes

* prefix_format -> prefix

* fix database session separation test

* revert composer.json changes, update laravel dependencies to expected next release

* only run session scoping logic in cache bootstrapper for redis, memcached, dynamodb, apc; update gitattributes

* tenancy.central_domains -> tenancy.identification.central_domains

* db session separation test: add datasets

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2024-04-09 20:40:27 +02:00
943b960718 lower laravel/prompts minimal version 2024-04-09 16:16:03 +02:00
Samuel Štancl
d9ca3cec38
Misc test fixes (#44)
* Add suffix_storage_path test

* Get filesystem bootstrapper coverage to 100%

* Delete enabling DB bootstrapper in TestCase

* Complete most of test todos

* Complete last tests todo

* Fix docblock

* add todo

---------

Co-authored-by: lukinovec <lukinovec@gmail.com>
2024-04-06 19:17:34 +02:00
489fbb9402 add prompts to tenant:tinker 2024-04-06 01:22:14 +02:00
4cc9fbe7ea fix bootstrapper names in config 2024-04-05 20:04:42 +02:00
4f76af7673 Merge branch 'master' of github.com:tenancy-for-laravel/v4 2024-04-05 19:49:02 +02:00
ac5948dfd1 add Tenancy::$findWith 2024-04-05 19:48:50 +02:00
lukinovec
be031ad45a Clear bootstrappers in TestCase 2024-04-04 18:04:45 +02:00
5ef7604e17 phpstan fix 2024-04-03 19:51:07 +02:00
PHP CS Fixer
47364007aa Fix code style (php-cs-fixer) 2024-04-03 17:47:00 +00:00
6f4b9dadf1 add tenant:tinker command 2024-04-03 19:46:27 +02:00
29d1469651 use getAttribute() in HasDatabase to support encrypted columns 2024-04-02 20:25:17 +02:00
711352db38 make MigrateFreshOverride compatible with Laravel 11.2 2024-04-02 20:19:15 +02:00
1d80604cff Enable single_line_empty_body phpcsfixer rule 2024-04-02 04:31:03 +02:00
Samuel Štancl
a41ad69023
Filesystem logic refactor, improved defaults for cache tenancy (#42)
* refactor FilesystemTenancyBootstrapper

* clean up tests and improve coverage

* minor maintenance mode changes

* Improve tenants:migrate --skip-failing logic

* make tenants:migrate output consistently formatted

* minor RootUrlBootstrapper + misc changes

* cache bootstrapper-related improvements

* Fix code style (php-cs-fixer)

* misc refactor

* Fix code style (php-cs-fixer)

* add %original_storage_path% to fs bootstrapper, improve default config for cache

* rename method

* inject concrete implementations where needed instead of abstracts

* Fix code style (php-cs-fixer)

* refactor DealsWithTenantSymlinks

* remove obsolete phpstan ignore

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2024-04-02 04:26:10 +02:00
PHP CS Fixer
4b6fa22aa7 Fix code style (php-cs-fixer) 2024-03-29 20:42:20 +00:00
f8512886a0 fix tenants:list and tenants:dump --prune 2024-03-29 21:41:50 +01:00
Samuel Štancl
9f94505cb4
Rename bootstrappers (#40)
* SessionTenancyBootstrapper -> DatabaseSessionBootstrapper

* FortifyRouteTenancyBootstrapper -> FortifyRouteBootstrapper

* BatchTenancyBootstrapper -> JobBatchBootstrapper

* ScoutTenancyBootstrapper -> ScoutPrefixBootstrapper, also fix logic and remove todo

* MailTenancyBootstrapper -> MailConfigBootstrapper

* PrefixCacheTenancyBootstrapper -> CacheTenancyBootstrapper

* remove todo

* improve config file
2024-03-28 03:18:23 +01:00
Samuel Štancl
0c11f29c19
Resolver refactor, path identification improvements (#41)
* resolver refactor

* Fix code style (php-cs-fixer)

* make tenant column used in PathTenantResolver configurable, fix phpstan errors, minor improvements

* support binding route fields, write tests for customizable tenant columns

* Invalidate cache for all possible columns in path resolver

* implement proper cache separation logic for different columns used by PathTenantResolver

* improve return type

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2024-03-28 03:18:11 +01:00
Samuel Štancl
dc430666ba
Add more tenant key generators (#36)
* Add RandomHexGenerator, create new namespace

* phpstan ignore

* add base64 generator

* add note about base64 being case sensitive

* docblock updates

* replace old UUIDGenerator with a class that throws an exception

* replace base64 generator with a random string generator

* Fix namespace

* Fix code style (php-cs-fixer)

* add test for the deprecated uuid generator

* update comments

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2024-03-28 03:17:55 +01:00
bf1ba69fe3 add $ignoreExisting static property to CreateDatabase 2024-03-27 21:44:30 +01:00
fdd401fc8f Fix tenant asset controller middleware() logic 2024-03-27 16:44:17 +01:00
d243309bcf minor testcase changes 2024-03-24 04:35:04 +01:00
1d42f33d34 better defaults 2024-03-24 04:28:11 +01:00
6c5bde7d07 add todo 2024-03-20 12:23:29 +01:00
d9d9d047b6 merge 2024-03-19 20:36:43 +01:00
cc2d555e3e Write test for specifying headers in TenantAssetController, fix error introduced in previous commit 2024-03-19 20:36:01 +01:00
PHP CS Fixer
d0cbee0aa3 Fix code style (php-cs-fixer) 2024-03-19 19:27:16 +00:00
a39da042af Add the option to set headers and middleware in TenantAssetController 2024-03-19 20:26:38 +01:00
a0da54cfdc categorize todos 2024-03-12 17:29:00 +01:00