mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-06 02:33:48 +00:00
- set default_max_team_member
- generate traffic for all users
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
"/chunks/app-language.js": "/chunks/app-language.js?id=21a381da055e57280eed",
|
||||
"/chunks/app-language~chunks/dashboard~chunks/files~chunks/invoices~chunks/my-shared-items~chunks/page~7dbb6a42.js": "/chunks/app-language~chunks/dashboard~chunks/files~chunks/invoices~chunks/my-shared-items~chunks/page~7dbb6a42.js?id=3cbb19b80e635b3524e5",
|
||||
"/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/page-edit~chunks/pages~chunks/plan-creat~1a92dd55.js": "/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/page-edit~chunks/pages~chunks/plan-creat~1a92dd55.js?id=75317652be9e911b6013",
|
||||
"/chunks/app-others.js": "/chunks/app-others.js?id=d763956aafc730e5bdcb",
|
||||
"/chunks/app-others.js": "/chunks/app-others.js?id=2789aac07c894eeb29ea",
|
||||
"/chunks/app-payments.js": "/chunks/app-payments.js?id=8ca6c120a8ba6f3659f6",
|
||||
"/chunks/app-settings.js": "/chunks/app-settings.js?id=2a96295eef59bd6c8921",
|
||||
"/chunks/app-setup.js": "/chunks/app-setup.js?id=1b7698981735d7173309",
|
||||
@@ -250,5 +250,6 @@
|
||||
"/chunks/user-storage.0e8d7663b9f8cd40de17.hot-update.js": "/chunks/user-storage.0e8d7663b9f8cd40de17.hot-update.js",
|
||||
"/chunks/user-storage.4eff070ff2a92236c8b2.hot-update.js": "/chunks/user-storage.4eff070ff2a92236c8b2.hot-update.js",
|
||||
"/chunks/settings-storage.4ecc7c38e789439da637.hot-update.js": "/chunks/settings-storage.4ecc7c38e789439da637.hot-update.js",
|
||||
"/chunks/user-storage.4ecc7c38e789439da637.hot-update.js": "/chunks/user-storage.4ecc7c38e789439da637.hot-update.js"
|
||||
"/chunks/user-storage.4ecc7c38e789439da637.hot-update.js": "/chunks/user-storage.4ecc7c38e789439da637.hot-update.js",
|
||||
"/chunks/app-others.753478462556c2b747a9.hot-update.js": "/chunks/app-others.753478462556c2b747a9.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</AppInputSwitch>
|
||||
|
||||
<AppInputText v-if="app.storageLimitation" :title="$t('admin_settings.others.default_storage')">
|
||||
<input @input="$updateText('/admin/settings', 'default_storage_amount', app.defaultStorage)"
|
||||
<input @input="$updateText('/admin/settings', 'default_max_storage_amount', app.defaultStorage)"
|
||||
v-model="app.defaultStorage"
|
||||
min="1"
|
||||
max="999999999"
|
||||
@@ -140,7 +140,7 @@
|
||||
mounted() {
|
||||
axios.get('/api/admin/settings', {
|
||||
params: {
|
||||
column: 'contact_email|google_analytics|default_storage_amount|registration|storage_limitation|mimetypes_blacklist|upload_limit|user_verification'
|
||||
column: 'contact_email|google_analytics|default_max_storage_amount|registration|storage_limitation|mimetypes_blacklist|upload_limit|user_verification'
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
@@ -149,7 +149,7 @@
|
||||
this.app = {
|
||||
contactMail: response.data.contact_email,
|
||||
googleAnalytics: response.data.google_analytics,
|
||||
defaultStorage: response.data.default_storage_amount,
|
||||
defaultStorage: response.data.default_max_storage_amount,
|
||||
userRegistration: parseInt(response.data.registration),
|
||||
storageLimitation: parseInt(response.data.storage_limitation),
|
||||
mimetypesBlacklist: response.data.mimetypes_blacklist,
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
userRegistration: {{ $settings->registration ?? 1 }},
|
||||
userVerification: {{ $settings->user_verification ?? 0 }},
|
||||
storageLimit: {{ $settings->storage_limitation ?? 1 }},
|
||||
storageDefaultSpace: {{ $settings->default_storage_amount ?? 5 }},
|
||||
storageDefaultSpaceFormatted: '{{ isset($settings->default_storage_amount) ? format_gigabytes($settings->default_storage_amount) : format_gigabytes(5) }}',
|
||||
storageDefaultSpace: {{ $settings->default_max_storage_amount ?? 5 }},
|
||||
storageDefaultSpaceFormatted: '{{ isset($settings->default_max_storage_amount) ? format_gigabytes($settings->default_max_storage_amount) : format_gigabytes(5) }}',
|
||||
mimetypesBlacklist: '{{ isset($settings->mimetypes_blacklist) ? $settings->mimetypes_blacklist: null}}',
|
||||
uploadLimit: {{ isset($settings->upload_limit) ? format_bytes($settings->upload_limit) : 'undefined' }},
|
||||
uploadLimitFormatted: '{{ isset($settings->upload_limit) ? format_megabytes($settings->upload_limit) : null }}',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Users\Models\User;
|
||||
@@ -35,10 +36,11 @@ class SetupDevEnvironment extends Command
|
||||
|
||||
public function __construct(
|
||||
private CreateDiskDirectoriesAction $createDiskDirectories,
|
||||
private SeedDefaultSettingsAction $seedDefaultSettings,
|
||||
private SeedDefaultLanguageAction $seedDefaultLanguage,
|
||||
private SeedDefaultPagesAction $seedDefaultPages,
|
||||
) {
|
||||
private SeedDefaultSettingsAction $seedDefaultSettings,
|
||||
private SeedDefaultLanguageAction $seedDefaultLanguage,
|
||||
private SeedDefaultPagesAction $seedDefaultPages,
|
||||
)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setUpFaker();
|
||||
}
|
||||
@@ -71,10 +73,10 @@ class SetupDevEnvironment extends Command
|
||||
|
||||
$this->info('Creating default demo content...');
|
||||
$this->create_admin_default_content();
|
||||
$this->generate_traffic();
|
||||
$this->create_team_folders_content();
|
||||
$this->create_share_with_me_team_folders_content();
|
||||
$this->create_share_records();
|
||||
$this->generate_traffic();
|
||||
|
||||
$this->info('Clearing application cache...');
|
||||
$this->clear_cache();
|
||||
@@ -104,38 +106,21 @@ class SetupDevEnvironment extends Command
|
||||
$user
|
||||
->settings()
|
||||
->create([
|
||||
'avatar' => $avatar_name,
|
||||
'name' => 'Jane Doe',
|
||||
'address' => $this->faker->address,
|
||||
'state' => $this->faker->state,
|
||||
'city' => $this->faker->city,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']),
|
||||
'phone_number' => $this->faker->phoneNumber,
|
||||
'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']),
|
||||
'avatar' => $avatar_name,
|
||||
'name' => 'Jane Doe',
|
||||
'address' => $this->faker->address,
|
||||
'state' => $this->faker->state,
|
||||
'city' => $this->faker->city,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']),
|
||||
'phone_number' => $this->faker->phoneNumber,
|
||||
'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']),
|
||||
]);
|
||||
|
||||
// Show user credentials
|
||||
$this->info('Default admin account created. Email: howdy@hi5ve.digital and Password: vuefilemanager');
|
||||
}
|
||||
|
||||
private function generate_traffic(): void
|
||||
{
|
||||
$user = User::whereEmail('howdy@hi5ve.digital')
|
||||
->first();
|
||||
|
||||
foreach (range(0, 45) as $day) {
|
||||
DB::table('traffic')->insert([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => $user->id,
|
||||
'upload' => random_int(1111111, 9999999),
|
||||
'download' => random_int(11111111, 99999999),
|
||||
'created_at' => now()->subDays($day),
|
||||
'updated_at' => now()->subDays($day),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create default admin account
|
||||
*/
|
||||
@@ -179,15 +164,15 @@ class SetupDevEnvironment extends Command
|
||||
$newbie
|
||||
->settings()
|
||||
->create([
|
||||
'avatar' => $avatar_name,
|
||||
'name' => $this->faker->name,
|
||||
'address' => $this->faker->address,
|
||||
'state' => $this->faker->state,
|
||||
'city' => $this->faker->city,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']),
|
||||
'phone_number' => $this->faker->phoneNumber,
|
||||
'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']),
|
||||
'avatar' => $avatar_name,
|
||||
'name' => $this->faker->name,
|
||||
'address' => $this->faker->address,
|
||||
'state' => $this->faker->state,
|
||||
'city' => $this->faker->city,
|
||||
'postal_code' => $this->faker->postcode,
|
||||
'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']),
|
||||
'phone_number' => $this->faker->phoneNumber,
|
||||
'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']),
|
||||
]);
|
||||
|
||||
$this->info("Generated user with email: $newbie->email and Password: vuefilemanager");
|
||||
@@ -776,7 +761,7 @@ class SetupDevEnvironment extends Command
|
||||
|
||||
collect([$members[0]->id, $members[1]->id])
|
||||
->each(
|
||||
fn ($id) => DB::table('team_folder_members')
|
||||
fn($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'parent_id' => $companyProjectFolder->id,
|
||||
'user_id' => $id,
|
||||
@@ -786,7 +771,7 @@ class SetupDevEnvironment extends Command
|
||||
|
||||
collect([$members[2]->id, $members[3]->id])
|
||||
->each(
|
||||
fn ($id) => DB::table('team_folder_members')
|
||||
fn($id) => DB::table('team_folder_members')
|
||||
->insert([
|
||||
'parent_id' => $financeDocumentsFolder->id,
|
||||
'user_id' => $id,
|
||||
@@ -797,7 +782,7 @@ class SetupDevEnvironment extends Command
|
||||
// Create invitations
|
||||
collect([$members[4], $members[5]])
|
||||
->each(
|
||||
fn ($user) => TeamFolderInvitation::factory()
|
||||
fn($user) => TeamFolderInvitation::factory()
|
||||
->create([
|
||||
'email' => $user->email,
|
||||
'parent_id' => $companyProjectFolder->id,
|
||||
@@ -1030,9 +1015,13 @@ class SetupDevEnvironment extends Command
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'default_storage_amount',
|
||||
'name' => 'default_max_storage_amount',
|
||||
'value' => 5,
|
||||
],
|
||||
[
|
||||
'name' => 'default_max_team_member',
|
||||
'value' => 10,
|
||||
],
|
||||
[
|
||||
'name' => 'setup_wizard_success',
|
||||
'value' => 1,
|
||||
@@ -1091,6 +1080,30 @@ class SetupDevEnvironment extends Command
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate demo traffic data
|
||||
*/
|
||||
private function generate_traffic(): void
|
||||
{
|
||||
$user = User::all();
|
||||
|
||||
foreach (range(0, 45) as $day) {
|
||||
|
||||
$user
|
||||
->each(fn($user) => DB::table('traffic')
|
||||
->insert([
|
||||
'id' => Str::uuid(),
|
||||
'user_id' => $user->id,
|
||||
'upload' => random_int(1111111, 9999999),
|
||||
'download' => random_int(11111111, 99999999),
|
||||
'created_at' => now()->subDays($day),
|
||||
'updated_at' => now()->subDays($day),
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Migrate database and generate application keys
|
||||
*/
|
||||
@@ -1171,7 +1184,7 @@ class SetupDevEnvironment extends Command
|
||||
// Create thumbnail only if image is larger than predefined image sizes
|
||||
if ($intervention->getWidth() > $size['size']) {
|
||||
// Generate thumbnail
|
||||
$intervention->resize($size['size'], null, fn ($constraint) => $constraint->aspectRatio())->stream();
|
||||
$intervention->resize($size['size'], null, fn($constraint) => $constraint->aspectRatio())->stream();
|
||||
|
||||
// Store thumbnail to disk
|
||||
Storage::put("files/$user->id/{$size['name']}-{$file_name}", $intervention);
|
||||
|
||||
@@ -125,9 +125,13 @@ class SetupProdEnvironment extends Command
|
||||
'value' => 1,
|
||||
],
|
||||
[
|
||||
'name' => 'default_storage_amount',
|
||||
'name' => 'default_max_storage_amount',
|
||||
'value' => 5,
|
||||
],
|
||||
[
|
||||
'name' => 'default_max_team_member',
|
||||
'value' => 10,
|
||||
],
|
||||
[
|
||||
'name' => 'setup_wizard_success',
|
||||
'value' => 1,
|
||||
|
||||
@@ -24,7 +24,7 @@ class CreateNewUserAction extends Controller
|
||||
RegisterUserRequest $request
|
||||
): Application | ResponseFactory | Response {
|
||||
$settings = get_settings([
|
||||
'default_storage_amount', 'registration', 'user_verification',
|
||||
'default_max_storage_amount', 'registration', 'user_verification',
|
||||
]);
|
||||
|
||||
// Check if account registration is enabled
|
||||
|
||||
@@ -209,8 +209,8 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
|
||||
// Create default limitations
|
||||
$user->limitations()->create([
|
||||
'max_storage_amount' => get_settings('default_storage_amount') ?? 1,
|
||||
'max_team_members' => 5,
|
||||
'max_storage_amount' => get_settings('default_max_storage_amount') ?? 1,
|
||||
'max_team_members' => get_settings('default_max_team_member') ?? 10,
|
||||
]);
|
||||
|
||||
// Create user directory for his files
|
||||
|
||||
@@ -61,9 +61,13 @@ class StoreAppSettingsController extends Controller
|
||||
'value' => $request->input('storageLimitation'),
|
||||
],
|
||||
[
|
||||
'name' => 'default_storage_amount',
|
||||
'name' => 'default_max_storage_amount',
|
||||
'value' => $request->input('defaultStorage') ?? 5,
|
||||
],
|
||||
[
|
||||
'name' => 'default_max_team_member',
|
||||
'value' => $request->input('defaultMaxTeamMember') ?? 10,
|
||||
],
|
||||
])->each(function ($col) {
|
||||
Setting::forceCreate([
|
||||
'name' => $col['name'],
|
||||
|
||||
@@ -27,7 +27,7 @@ class SubscriptionEventSubscriber
|
||||
public function handleSubscriptionWasExpired($event)
|
||||
{
|
||||
$event->subscription->user->limitations()->update([
|
||||
'max_storage_amount' => get_settings('default_storage_amount') ?? 1,
|
||||
'max_storage_amount' => get_settings('default_max_storage_amount') ?? 5,
|
||||
'max_team_members' => 5,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class SignFlowTest extends TestCase
|
||||
{
|
||||
collect([
|
||||
[
|
||||
'name' => 'default_storage_amount',
|
||||
'name' => 'default_max_storage_amount',
|
||||
'value' => 12,
|
||||
],
|
||||
[
|
||||
|
||||
@@ -95,7 +95,7 @@ class UserSubscriptionTest extends TestCase
|
||||
SubscriptionWasExpired::dispatch($user->subscription);
|
||||
|
||||
$this->assertDatabaseHas('user_limitations', [
|
||||
'max_storage_amount' => 1,
|
||||
'max_storage_amount' => 5,
|
||||
'max_team_members' => 5,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ class SetupWizardTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('settings', [
|
||||
'name' => 'default_storage_amount',
|
||||
'name' => 'default_max_storage_amount',
|
||||
'value' => '10',
|
||||
]);
|
||||
|
||||
|
||||
@@ -46,6 +46,26 @@ class TeamLimitsTest extends TestCase
|
||||
'email' => 'test@doe.com',
|
||||
'permission' => 'can-edit',
|
||||
],
|
||||
[
|
||||
'email' => 'test2@doe.com',
|
||||
'permission' => 'can-edit',
|
||||
],
|
||||
[
|
||||
'email' => 'test3@doe.com',
|
||||
'permission' => 'can-edit',
|
||||
],
|
||||
[
|
||||
'email' => 'test4@doe.com',
|
||||
'permission' => 'can-edit',
|
||||
],
|
||||
[
|
||||
'email' => 'test5@doe.com',
|
||||
'permission' => 'can-edit',
|
||||
],
|
||||
[
|
||||
'email' => 'test6@doe.com',
|
||||
'permission' => 'can-edit',
|
||||
],
|
||||
],
|
||||
])
|
||||
->assertStatus(423);
|
||||
|
||||
Reference in New Issue
Block a user