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

335 commits

Author SHA1 Message Date
2bb26c9f28
grammar, code style 2022-11-03 14:16:33 +01:00
Abrar Ahmad
2cc40e0b81 self review 2022-11-03 11:13:49 +05:00
Abrar Ahmad
3ec39b3445 delete custom migrations 2022-11-03 11:04:10 +05:00
Abrar Ahmad
7acd312cbc remove different schema setup 2022-11-03 11:02:48 +05:00
Abrar Ahmad
a67b5b1f88 update comments 2022-10-17 11:24:22 +05:00
Abrar Ahmad
93efa56f59 Update ResourceSyncingTest.php 2022-10-13 17:31:18 +05:00
Abrar Ahmad
99f853451b methods dockblocks and correct names 2022-10-13 17:29:43 +05:00
e1fa543723
add comments above new tests 2022-10-12 19:16:03 +02:00
Abrar Ahmad
134cb291ea code style 2022-10-04 14:18:48 +05:00
Abrar Ahmad
0170ccc391 better names 2022-10-03 14:10:00 +05:00
Abrar Ahmad
e6efa9f58a Update ResourceSyncingTest.php 2022-10-03 14:03:22 +05:00
Abrar Ahmad
8ecbe26b6d improve tests 2022-10-03 13:49:06 +05:00
Abrar Ahmad
cb73936d71 wip 2022-09-30 18:34:43 +05:00
Samuel Štancl
e8071944ad Merge branch 'master' into resource-syncing 2022-09-29 23:42:58 +02:00
Samuel Štancl
f98a901aeb get down to 21 phpstan errors 2022-09-29 23:39:35 +02:00
Samuel Štancl
a94227a19c get down to 59 phpstan errors 2022-09-29 22:20:55 +02:00
Samuel Štancl
c62dc0f0f3 code improvements 2022-09-29 17:01:27 +02:00
Samuel Štancl
193e044777 remove remaining version checks 2022-09-29 16:02:40 +02:00
Samuel Štancl
fa09e3a083 remove version checks 2022-09-29 16:02:08 +02:00
Jori Stein
121370ea01
[4.x] Add command to bring the tenants up and down from maintenance and remove deprecated exception (#761)
* Add bring up from maintenance function

* Add up and down tenant maintenance commands

* Rename commands signatures

* Update TenancyServiceProvider.php

* Complying to Laravel maintenance code and parameters

* Update MaintenanceModeTest.php

* Add maintenance mode via commands test

* Update CheckTenantForMaintenanceMode.php

* Update MaintenanceModeTest.php

* Cookie bypass only for > Laravel 8

* minor formatting change, trigger CI

* clean

* Update MaintenanceModeTest.php

* Add comments for using the 'tenants' option in runForMultiple

* improve code

* php-cs-fixer

* fix php cs fixer config

* improve test logic

* remove version check since v4 will be L9+

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-09-29 15:59:14 +02:00
Abrar Ahmad
8aea33c0f2 add test 2022-09-29 16:11:08 +05:00
Samuel Štancl
87212e5390 phpstan, global_cache, resolver improvements, InitializationHelpers trait 2022-09-29 02:47:13 +02:00
Abrar Ahmad
e1229ef446 allow defining a mix of attribute names and default values 2022-09-28 13:38:01 +05:00
Abrar Ahmad
5b34b0283a Update ResourceSyncingTest.php 2022-09-28 11:32:11 +05:00
Samuel Štancl
7bacc50b27
[4.x] Storage::url() support (modified #689) (#909)
* This adds support for tenancy aware  Storage::url() method

* Trigger CI build

* Fixed Link command for Laravel v6, added StorageLink Events, more StorageLink tests, added RemoveStorageSymlinks Job, added Storage Jobs to TenancyServiceProvider stub, renamed misleading config example.

* Fix typo

* Fix code style (php-cs-fixer)

* Update config comments

* Format code in Link command, make writing more concise

* Change "symLinks" to "symlinks"

* Refactor Link command

* Fix test name typo

* Test fetching files using the public URL

* Extract Link command logic into actions

* Fix code style (php-cs-fixer)

* Check if closure is null in CreateStorageSymlinksAction

* Stop using command terminology in CreateStorageSymlinksAction

* Separate the Storage::url() test cases

* Update url_override comments

* Remove afterLink closures, add types, move actions, add usage explanation to the symlink trait

* Fix code style (php-cs-fixer)

* Update public storage URL test

* Fix issue with using str()

* Improve url_override comment, add todos

* add todo comment

* fix docblock style

* Add link command tests back

* Add types to $tenants in the action handle() methods

* Fix typo, update variable name formatting

* Add tests for the symlink actions

* Change possibleTenantSymlinks not to prefix the paths twice while tenancy is initialized

* Fix code style (php-cs-fixer)

* Stop testing storage directory existence in symlink test

* Don't specify full namespace for Tenant model annotation

* Don't specify full namespace in ActionTest

* Remove "change to DI" todo

* Remove possibleTenantSymlinks return annotation

* Remove symlink-related jobs, instantiate and use actions

* Revert "Remove symlink-related jobs, instantiate and use actions"

This reverts commit 547440c887.

* Add a comment line about the possible tenant symlinks

* Correct storagePath and publicPath variables

* Revert "Correct storagePath and publicPath variables"

This reverts commit e3aa8e2086.

* add a todo

Co-authored-by: Martin Vlcek <martin@dontfreakout.eu>
Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2022-09-28 05:09:45 +02:00
Riley19280
b78320b882
[4.x] Add batch tenancy queue bootstrapper (#874)
* exclude master from CI

* Add batch tenancy queue bootstrapper

* add test case

* skip tests for old versions

* variable docblocks

* use Laravel's connection getter and setter

* convert test to pest

* bottom space

* singleton regis in TestCase

* Update src/Bootstrappers/BatchTenancyBootstrapper.php

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

* convert batch class resolution to property level

* enabled BatchTenancyBootstrapper by default

* typehint DatabaseBatchRepository

* refactore name

* DI DB manager

* typehint

* Update config.php

* use initialize() twice without end()ing tenancy to assert that previousConnection logic works correctly

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-09-26 14:13:58 +02:00
Abrar Ahmad
8e3b74f9d1
[4.x] Finish incomplete and missing tests (#947)
* complete test sqlite manager customize path

* complete test seed command works

* complete uniqe exists test

* Update SingleDatabaseTenancyTest.php

* refactor the ternary into if condition

* custom path

* simplify if condition

* random dir name

* Update SingleDatabaseTenancyTest.php

* Update CommandsTest.php

* prefix random DB name with custom_

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-09-24 04:08:44 +02:00
lukinovec
ab5fa7a247
[4.x] Optionally delete storage after tenant deletion (#938)
* Add test for deleting storage after tenant deletion

* Save `storage_path()` in a variable after initializing tenant in test

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

* Add DeleteTenantStorage listener

* Update test name

* Remove storage deletion config key

* Remove tenant storage deletion events

* Move tenant storage deletion to the DeletingTenant event

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-09-20 19:42:00 +02:00
Abrar Ahmad
0d3ac1f206 Update ResourceSyncingTest.php 2022-09-12 11:16:11 +05:00
Abrar Ahmad
b17882fcf8 method rename 2022-09-12 11:10:12 +05:00
Abrar Ahmad
f2c64088ed
[4.x] Set tenant as a default parameter for the URLs when using Path identification (#925)
* set tenant as default url parameter

* Update PathIdentificationTest.php

* assertion

* test rename

* fix tests

* fix string

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-09-02 19:04:00 +02:00
Abrar Ahmad
409190fae1
[4.x] Improve tenants:run command to execute Input\Output commands (#923)
* run command useable for questions asking commands

* move console classes to Console directory

* fix styling

* Update src/Commands/Run.php

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

* remove tenant migration line

* assert command executed in tenant context

* improve test

* cleanup code

* Update CommandsTest.php

* remove irrelevant assertions

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-09-02 18:46:13 +02:00
lukinovec
3bf2c39e1a
[4.x] Make impersonation tokens require stateful guards (#935)
* Throw an exception on attempt to create impersonation token with a non-stateful guard

* Test that impersonation tokens can only be created with a stateful guard

* Fix code style (php-cs-fixer)

* Escape backslashes in the exception's message

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

* Make the exception only about requiring a stateful guard

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-09-02 17:46:27 +02:00
Abrar Ahmad
4245f46bc1 method rename 2022-09-02 18:01:59 +05:00
Samuel Štancl
f941df3a82 minor improvements for phpstan 2022-09-01 19:06:54 +02:00
Abrar Ahmad
5aa8231c81
Merge branch 'master' into resource-syncing 2022-08-30 13:05:28 +05:00
Abrar Ahmad
aaffc1d6b0 Update ResourceSyncingTest.php 2022-08-30 12:35:22 +05:00
Abrar Ahmad
d22224c945 merge default values with sync attributes and tests 2022-08-30 12:29:52 +05:00
Samuel Štancl
8af354c20e get phpstan errors down from 252 to 189 2022-08-30 05:44:23 +02:00
Abrar Ahmad
62c9516ec1 Update ResourceSyncingTest.php 2022-08-29 13:16:00 +05:00
Abrar Ahmad
eef51f40b9 classes at the end 2022-08-29 12:34:24 +05:00
Abrar Ahmad
55d858b601 assert that creation attributes returns null 2022-08-29 12:16:34 +05:00
Samuel Štancl
40bf28c7d0 general refactor, move more classes under Database namespace 2022-08-27 03:17:16 +02:00
Samuel Štancl
55d0a9ab87 misc improvements - stronger types, exception refactor 2022-08-26 21:35:17 +02:00
Samuel Štancl
931c76d697
Pull 3.x changes into master (#922)
* exclude master from CI

* Add space after 'up' in 'docker-compose up-d' (#900)

* Fix ArgumentCountError on the TenantAssetsController (#894)

* Fix ArgumentCount exception on the TenantAssetsController when no `$path` is provided

* CS

* CS

* Handle null case explicitly

* code style

Co-authored-by: Bram Wubs <bram@sibi.nl>
Co-authored-by: Samuel Štancl <samuel@archte.ch>

* Add support for nested tenant config override (#920)

* feat: add support for nested tenant config override

* test: ensure nested tenant values are mapped

* Update TenantConfigTest.php

Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: Bram Wubs <megawubs@users.noreply.github.com>
Co-authored-by: Bram Wubs <bram@sibi.nl>
Co-authored-by: George Bishop <email.georgebishop@gmail.com>
Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
2022-08-22 17:59:43 +02:00
Abrar Ahmad
6ffa3d2b55 wip 2022-08-16 15:59:52 +05:00
Abrar Ahmad
f02aa1a6f2 wip 2022-08-16 15:50:22 +05:00
Abrar Ahmad
3e514461ca wip 2022-08-16 15:27:34 +05:00
Abrar Ahmad
e756b54b31 Update ResourceSyncingTest.php 2022-08-10 13:42:48 +05:00
Abrar Ahmad
3bba3bd3de Update ResourceSyncingTest.php 2022-08-10 13:41:14 +05:00