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

769 commits

Author SHA1 Message Date
lukinovec
8a54e19644 Revert changes, add comment 2022-12-22 09:41:45 +01:00
Samuel Štancl
82fa6cb292 fix tenant() relationship in Domain 2022-12-20 15:10:29 +01:00
Abrar Ahmad
f42f08cb87
Add session state when impersonating tenant (#1029)
* wip

* Fix code style (php-cs-fixer)

* Update TenantUserImpersonationTest.php

* renamed method

* update method name in test

* rename session key

* fix test

* Update src/Features/UserImpersonation.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* Update UserImpersonation.php

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-12-17 02:08:03 +01:00
PHP CS Fixer
c9ba569e49 Fix code style (php-cs-fixer) 2022-12-16 10:13:00 +00:00
lukinovec
fa00fc7a28 Add changes to PR to Laravel 2022-12-16 11:12:33 +01:00
lukinovec
7092f4c856 Make CacheManager::$addTags default to true 2022-12-14 16:21:45 +01:00
Abrar Ahmad
68de3600bd
Improve commands CLI output (#1030)
* use component info/error methods

* Update src/Commands/ClearPendingTenants.php

Co-authored-by: lukinovec <lukinovec@gmail.com>

Co-authored-by: lukinovec <lukinovec@gmail.com>
2022-12-14 15:08:00 +01:00
lukinovec
87efdd2954 Toggle cache tags 2022-12-13 05:25:57 +01:00
lukinovec
5c6226befc Use better class for the macro 2022-12-12 17:31:05 +01:00
PHP CS Fixer
bc70a2fab8 Fix code style (php-cs-fixer) 2022-12-12 16:25:57 +00:00
lukinovec
35a3412011 Move Cache::macro() to a slightly more appropriate place 2022-12-12 17:25:29 +01:00
lukinovec
d3c7fef002 Revert condition in CacheManager to avoid excessive nesting 2022-12-12 17:16:53 +01:00
lukinovec
b41d8d19dc Uncomment cache tagging 2022-12-12 17:11:14 +01:00
PHP CS Fixer
3cadefd41c Fix code style (php-cs-fixer) 2022-12-12 16:07:21 +00:00
lukinovec
d364568e53 Update CacheManager, add refreshStore() 2022-12-12 17:06:49 +01:00
lukinovec
9ec0b6dae3 Make Tenancy override CacheManager 2022-12-12 17:05:53 +01:00
lukinovec
dc9c8fcf68 Simplify cache store refreshing 2022-12-12 16:58:40 +01:00
PHP CS Fixer
012a39f79d Fix code style (php-cs-fixer) 2022-12-09 11:22:03 +00:00
lukinovec
50d46139f6 Add macro 2022-12-09 12:21:37 +01:00
lukinovec
825a565fa2 Update prefix bootstrapper and test (setStore() in CacheManager and Repository needed) 2022-12-08 16:24:54 +01:00
Samuel Štancl
a7ad8287e6 disable new jobs/listeners by default, add CreateTenantStorage job 2022-12-02 19:43:20 +01:00
Abrar Ahmad
6c955acd13 CacheService class as singleton 2022-12-01 14:58:13 +05:00
Abrar Ahmad
222686ec1d CacheManager dependency injection test 2022-12-01 13:53:45 +05:00
Abrar Ahmad
169a7f7cc9 build prefix using original prefix 2022-11-30 13:25:07 +05:00
Abrar Ahmad
387a10b918 use proper DI 2022-11-30 10:22:01 +05:00
Samuel Štancl
45aac1a718 phpstan fixes 2022-11-29 10:31:37 +01:00
Samuel Štancl
ad29909a16 Make $tenantId nullable in initializeTenancyForQueue (revert phpstan change) 2022-11-29 10:25:22 +01:00
Samuel Štancl
b2dc0844eb Merge branch 'master' of github.com:tenancy-for-laravel/v4 2022-11-29 10:19:12 +01:00
lukinovec
7d3298c6bb
Improve code of pending tenants (#1025)
* Remove `--all` option from ClearPendingTenants

* Improve query formatting

* Remove redundant test

* Convert time constrait options to int

* Improve CreatePendingTenants success message
2022-11-29 09:31:07 +01:00
Abrar Ahmad
d6b4d9b7a7 user getTenantKey method 2022-11-28 15:09:39 +05:00
Abrar Ahmad
73c5655bc8
Manual mode improvements (use correct event type, add new listeners) (#1013)
* fix issue and add test

* Update CreateTenantConnection.php

* add purge call

* Update ManualModeTest.php

* use tenant connection and central connection listener

* Update ManualModeTest.php

* fix test

* improvements

* Update ManualModeTest.php

* add comment

* simplify comment

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-11-25 03:09:31 +01:00
Abrar Ahmad
e550c7dcdd Update PrefixCacheTenancyBootstrapper.php 2022-11-24 11:57:14 +05:00
Abrar Ahmad
1e44ef214d add comments 2022-11-24 11:51:43 +05:00
lukinovec
ea19117870
Use the hardcoded default path in TenantDump only if the path isn't configured (#1019)
* Use the hardcoded tenant dump path only if the path isn't configured

* Test generating tenant dump at the configured path
2022-11-23 13:12:29 +01:00
lukinovec
cb7567a88a
[4.x] Make TenantDump work when called outside the tenant context (#1015)
* Run TenantDump as passed tenant

* Fix code style (php-cs-fixer)

* Fix `tenants:dump` tests

* Update dump command test

* Remove redundant `tenant-schema.dump` unlinking

* Delete duplicate test

* Update test name

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2022-11-23 08:38:20 +01:00
Abrar Ahmad
2302571f6a Update PrefixCacheTenancyBootstrapper.php 2022-11-22 14:13:10 +05:00
Abrar Ahmad
c5f7de4b0e fix phpstan error 2022-11-22 14:09:59 +05:00
Abrar Ahmad
e970c160d0 remove null check 2022-11-22 14:00:35 +05:00
Abrar Ahmad
e5658fa300 cache prefix base from config 2022-11-22 11:32:23 +05:00
Abrar Ahmad
90c54ac733 DI app 2022-11-22 11:28:27 +05:00
Abrar Ahmad
d6da626f73 prefix cache bootstrapper and tests 2022-11-21 17:53:21 +05:00
Samuel Štancl
5849089373
Add SessionTenancyBootstrapper (#2)
* Add SessionTenancyBootstrapper

* Fix code style (php-cs-fixer)

* add value to bootstrappers config

* tenant aware call test

* reproduce issue in tests

* fix logic for calling tenant run from central context, finish tests

* change laravel version back

* bump laravel to ^9.38

* add listener to create tenant DBs

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
2022-11-20 02:32:25 +01:00
Abrar Ahmad
ff46bcfe20
Early identification support (#1)
* wip

* Improve tests

* rename class

* wip

* improve tests

* introduce early identification middlewares

* Update PreventAccessFromCentralDomains.php

* method rename

* method rename

* Update UniversalRouteTest.php

* Update UniversalRouteTest.php

* Update EarlyIdentificationTest.php

* remove early classes and add check in existing classes

* MWs improvements

* Update UniversalRouteTest.php

* Fix code style (php-cs-fixer)

* trigger ci

* fix failing test after merge

* add test for universal route in early identification

* Update InitializeTenancyByDomain.php

* Update UniversalRouteTest.php

* remove `routeHasMiddleware` method from MW and use the UniversalRoutes class method

* helper dockblock

* add test

* handle universal routes in early identification

* remove UniversalRoute class because we are not using it anymore

* rename class from PreventAccessFromCentralDomains to PreventAccessFromUnwantedDomains

* improvements after self review

* Update PreventAccessFromUnwantedDomains.php

* remove inline class namespaces

* remove DomainTenant class and use the Tenant class

* update comment

* removed custom expection and add method

* Update tests/EarlyIdentificationTest.php

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* use ltrim and simplify the comment

* remove comments and typhint

* dataset and keys rename

* rename $route parameter

* removed helper functions

* fix style

* Update InitializeTenancyByPath.php

* Update tests/EarlyIdentificationTest.php

* code style

* improve subdomain test

* use TenancyInitialized event and remove DomainTenant alias

* remove comment and move expectException below

* code style

* use TenancyInitialized event

* improve test

* improve datasets

* Initialized -> Initializing

* Update InitializeTenancyByPath.php

* remove todo

* Fix code style (php-cs-fixer)

* refactor helper method

* Update UniversalRouteTest.php

* add note above test

* remove after each hook

* renamed universal_middleware to global_middleware

* remove helper and improve url names

* change check position

* Revert "change check position"

This reverts commit e4371d2f3aa8ad7ae5e5b7d15781b72a5f1be03c.

* repositioned central check

* add comment

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-11-20 02:31:37 +01:00
lukinovec
9520cbc811
Only delete tenants in MigrateFreshOverride if the tenants table exists (#1007)
* Don't drop tenant databases on `migrate:fresh` if the tenants table doesn't exist

* Fix code style (php-cs-fixer)

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2022-11-18 15:58:04 +01:00
Abrar Ahmad
898d6c5d3b cache prefix 2022-11-17 16:21:07 +05:00
Samuel Štancl
2a39b0526a Fix #998, properly replace ALL tenant_id literals 2022-11-10 16:44:52 +01:00
Samuel Štancl
8a00a105d0 Merge branch 'master' of github.com:archtechx/tenancy 2022-11-10 16:03:28 +01:00
Samuel Štancl
dd0f03f742 Fix #998, centralize config used by BelongsToTenant and HasDomains 2022-11-10 16:03:13 +01:00
Abrar Ahmad
99dd862b20
[4.x] [WIP] Add phpstan to CI (#928)
* add phpstan

* resolve phpstan issue from CI

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-11-08 13:47:24 +01:00
Samuel Štancl
942d79cbd7 resolve all phpstan issues 2022-11-08 13:34:04 +01:00