mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
Frontend upload restrict consolidation
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
"/chunks/billing.js": "/chunks/billing.js?id=79ea868dda710a87535e",
|
||||
"/chunks/billings-detail.js": "/chunks/billings-detail.js?id=0ba329dda55f7e75fb57",
|
||||
"/chunks/billing~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plan-subscribers~chunks/plans~ch~5d1c5841.js": "/chunks/billing~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plan-subscribers~chunks/plans~ch~5d1c5841.js?id=9b836534302d97ac5c73",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.js?id=9bb4b7b4c8f9442fc828",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.js?id=4ac050401e5153de933d",
|
||||
"/chunks/contact-us.js": "/chunks/contact-us.js?id=970f98276222264cefe7",
|
||||
"/chunks/contact-us~chunks/dynamic-page~chunks/homepage.js": "/chunks/contact-us~chunks/dynamic-page~chunks/homepage.js?id=65ee559ca803555be568",
|
||||
"/chunks/create-new-password.js": "/chunks/create-new-password.js?id=e3979bb4635ddd58f49b",
|
||||
@@ -70,9 +70,9 @@
|
||||
"/chunks/profile~chunks/settings-password.js": "/chunks/profile~chunks/settings-password.js?id=dfa4128d68360d5e1b3b",
|
||||
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=9e948882ae2315eb6132",
|
||||
"/chunks/recent-uploads.js": "/chunks/recent-uploads.js?id=8577d4c771602671b38a",
|
||||
"/chunks/settings.js": "/chunks/settings.js?id=b8e396ca81993a2ac3c9",
|
||||
"/chunks/settings.js": "/chunks/settings.js?id=2d4f5dd69eb1afe4f5c6",
|
||||
"/chunks/settings-password.js": "/chunks/settings-password.js?id=b6eb94764cc7b47f835e",
|
||||
"/chunks/settings-storage.js": "/chunks/settings-storage.js?id=76b45c336e8e12b23e81",
|
||||
"/chunks/settings-storage.js": "/chunks/settings-storage.js?id=affbca0ce630d1547947",
|
||||
"/chunks/settings~chunks/settings-password.js": "/chunks/settings~chunks/settings-password.js?id=aafc9cd6aa47b01bc25a",
|
||||
"/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=651d5accf401908724c5",
|
||||
"/chunks/shared.js": "/chunks/shared.js?id=db60726012b6d246bd77",
|
||||
@@ -241,5 +241,35 @@
|
||||
"/js/main.819e5cdfad5c00b05e6a.hot-update.js": "/js/main.819e5cdfad5c00b05e6a.hot-update.js",
|
||||
"/chunks/not-found.819e5cdfad5c00b05e6a.hot-update.js": "/chunks/not-found.819e5cdfad5c00b05e6a.hot-update.js",
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~91d4a521.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~91d4a521.js?id=b563ab4d2bf1a17f0fa5",
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~af91ece5.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~af91ece5.js?id=9a44c9cf620730dc67d5"
|
||||
"/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~af91ece5.js": "/vendors~chunks/admin~chunks/admin-account~chunks/app-appearance~chunks/app-billings~chunks/app-email~af91ece5.js?id=9a44c9cf620730dc67d5",
|
||||
"/chunks/settings.14899587a022d738d162.hot-update.js": "/chunks/settings.14899587a022d738d162.hot-update.js",
|
||||
"/chunks/settings.8f076258d62869f4bdb8.hot-update.js": "/chunks/settings.8f076258d62869f4bdb8.hot-update.js",
|
||||
"/chunks/settings.6e50894e9b385f8b874b.hot-update.js": "/chunks/settings.6e50894e9b385f8b874b.hot-update.js",
|
||||
"/chunks/settings.0f3eefa76db63e856d0e.hot-update.js": "/chunks/settings.0f3eefa76db63e856d0e.hot-update.js",
|
||||
"/chunks/settings.7638a4c5da5827236e6e.hot-update.js": "/chunks/settings.7638a4c5da5827236e6e.hot-update.js",
|
||||
"/chunks/settings.0388d7d5905bd3a63a72.hot-update.js": "/chunks/settings.0388d7d5905bd3a63a72.hot-update.js",
|
||||
"/chunks/settings.20015f17b4b29ec695be.hot-update.js": "/chunks/settings.20015f17b4b29ec695be.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.c4377b63b4677b386d57.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.c4377b63b4677b386d57.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.de9a578b564864e2496f.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.de9a578b564864e2496f.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.584e9cf19dae43c67924.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.584e9cf19dae43c67924.hot-update.js",
|
||||
"/chunks/settings.e7fbee41feb23d79aa23.hot-update.js": "/chunks/settings.e7fbee41feb23d79aa23.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.ae99883e6ef72ca37522.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.ae99883e6ef72ca37522.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.388b953d49987846d278.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.388b953d49987846d278.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.f94de129df5b341c63f0.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.f94de129df5b341c63f0.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.2c21e5aa45ce63cfdc24.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.2c21e5aa45ce63cfdc24.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.461b022b603cbee0848b.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.461b022b603cbee0848b.hot-update.js",
|
||||
"/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.c56e5f85d79ce354ddcf.hot-update.js": "/chunks/billing~chunks/settings-storage~chunks/user-storage~chunks/user-subscription.c56e5f85d79ce354ddcf.hot-update.js",
|
||||
"/js/main.56eb396eb88e3964f1c3.hot-update.js": "/js/main.56eb396eb88e3964f1c3.hot-update.js",
|
||||
"/js/main.2b8eb0af121bf9d705cf.hot-update.js": "/js/main.2b8eb0af121bf9d705cf.hot-update.js",
|
||||
"/chunks/settings-storage.2395cf8f0b81f09a2d6a.hot-update.js": "/chunks/settings-storage.2395cf8f0b81f09a2d6a.hot-update.js",
|
||||
"/chunks/settings-storage.dfe422bb5e0642aa8c14.hot-update.js": "/chunks/settings-storage.dfe422bb5e0642aa8c14.hot-update.js",
|
||||
"/chunks/settings-storage.9634d92afd2a243cb29d.hot-update.js": "/chunks/settings-storage.9634d92afd2a243cb29d.hot-update.js",
|
||||
"/js/main.5e9ab63c657c49fda4ab.hot-update.js": "/js/main.5e9ab63c657c49fda4ab.hot-update.js",
|
||||
"/js/main.14eb81b15bc9f0e45ffa.hot-update.js": "/js/main.14eb81b15bc9f0e45ffa.hot-update.js",
|
||||
"/js/main.05d9762d270a4a17201a.hot-update.js": "/js/main.05d9762d270a4a17201a.hot-update.js",
|
||||
"/js/main.a0499a8fde8c9adda2ea.hot-update.js": "/js/main.a0499a8fde8c9adda2ea.hot-update.js",
|
||||
"/js/main.fefe0df447e1b576c625.hot-update.js": "/js/main.fefe0df447e1b576c625.hot-update.js",
|
||||
"/js/main.a7549cdbb3777ffda8c6.hot-update.js": "/js/main.a7549cdbb3777ffda8c6.hot-update.js",
|
||||
"/js/main.0694db5a8bec44bb9e03.hot-update.js": "/js/main.0694db5a8bec44bb9e03.hot-update.js",
|
||||
"/js/main.32c73deaa232482e930c.hot-update.js": "/js/main.32c73deaa232482e930c.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex items-center mb-4 rounded dark:bg-2x-dark-foreground bg-light-300">
|
||||
<div v-for="(chart, i) in data" :key="i" :style="{width: chart.progress + '%'}" class="chart-wrapper">
|
||||
<div v-for="(chart, i) in data" :key="i" :style="{width: (chart.progress > 1 ? chart.progress : 0) + '%'}" class="chart-wrapper">
|
||||
<!--<DotLabel class="label" :class="{'offset-top': chart.progress < 5}" :color="chart.color" :title="chart.value" />-->
|
||||
|
||||
<!--Only singe line-->
|
||||
|
||||
25
resources/js/helpers/AlertHelpers.js
vendored
25
resources/js/helpers/AlertHelpers.js
vendored
@@ -1,13 +1,30 @@
|
||||
import {events} from "../bus";
|
||||
import i18n from "../i18n";
|
||||
import store from '../store/index'
|
||||
import {events} from "../bus"
|
||||
import i18n from "../i18n"
|
||||
|
||||
const AlertHelpers = {
|
||||
install(Vue) {
|
||||
|
||||
Vue.prototype.$temporarilyDisabledUpload = function () {
|
||||
|
||||
let messages = {
|
||||
metered: {
|
||||
title: i18n.t('Upload is temporarily disabled'),
|
||||
message: i18n.t('Please review your billing settings.')
|
||||
},
|
||||
fixed: {
|
||||
title: i18n.t('Upload is temporarily disabled'),
|
||||
message: i18n.t('Please review your billing settings.')
|
||||
},
|
||||
none: {
|
||||
title: i18n.t('You exceeded your upload limit'),
|
||||
message: i18n.t('Unfortunately, you can not upload your file.')
|
||||
},
|
||||
}
|
||||
|
||||
events.$emit('alert:open', {
|
||||
title: i18n.t('Upload is temporarily disabled'),
|
||||
message: i18n.t('Please review your billing settings.')
|
||||
title: messages[store.getters.config.subscriptionType]['title'],
|
||||
message: messages[store.getters.config.subscriptionType]['message']
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
2
resources/js/helpers/functionHelpers.js
vendored
2
resources/js/helpers/functionHelpers.js
vendored
@@ -124,7 +124,7 @@ const FunctionHelpers = {
|
||||
distribution = orderBy(distribution, ['progress'], ['desc'])
|
||||
|
||||
// Push at the end empty space data
|
||||
if (config.subscriptionType !== 'metered') {
|
||||
if (config.subscriptionType === 'fixed' || config.storageLimit) {
|
||||
distribution.push({
|
||||
progress: 100 - storage.data.attributes.percentage,
|
||||
color: 'secondary',
|
||||
|
||||
@@ -35,7 +35,8 @@
|
||||
<div class="info">
|
||||
<b class="name">
|
||||
{{ user.data.relationships.settings.data.attributes.name }}
|
||||
<ColorLabel v-if="config.isSaaS" :color="subscriptionColor">
|
||||
|
||||
<ColorLabel v-if="this.config.subscriptionType === 'fixed'" :color="subscriptionColor">
|
||||
{{ subscriptionStatus }}
|
||||
</ColorLabel>
|
||||
</b>
|
||||
@@ -96,8 +97,8 @@
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'config',
|
||||
'user',
|
||||
'config'
|
||||
]),
|
||||
subscriptionStatus() {
|
||||
return this.user.data.relationships.subscription
|
||||
@@ -116,7 +117,7 @@
|
||||
return this.user.data.attributes.incomplete_payment
|
||||
},
|
||||
pages() {
|
||||
return [
|
||||
let list = [
|
||||
{
|
||||
title: this.$t('menu.profile'),
|
||||
route: 'Profile',
|
||||
@@ -129,11 +130,17 @@
|
||||
title: this.$t('menu.storage'),
|
||||
route: 'Storage',
|
||||
},
|
||||
{
|
||||
]
|
||||
|
||||
// Push billing item if subscription is set
|
||||
if (['fixed', 'metered'].includes(this.config.subscriptionType)) {
|
||||
list.push({
|
||||
title: this.$t('Billing'),
|
||||
route: 'Billing',
|
||||
},
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{{ storage.data.attributes.used }}
|
||||
</b>
|
||||
|
||||
<b v-if="['fixed', 'none'].includes(config.subscriptionType)" class="mt-0.5 block text-sm text-gray-400">
|
||||
<b v-if="config.subscriptionType === 'fixed' || config.storageLimit" class="mt-0.5 block text-sm text-gray-400">
|
||||
{{ $t('Total of') }} {{ storage.data.attributes.capacity }} {{ $t('Used') }}
|
||||
</b>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ use Domain\Settings\Models\Setting;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use App\Restrictions\RestrictionsManager;
|
||||
use App\Users\Restrictions\RestrictionsManager;
|
||||
use App\Users\Notifications\ResetPassword;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace App\Restrictions\Engines;
|
||||
namespace App\Users\Restrictions\Engines;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use App\Restrictions\RestrictionsEngine;
|
||||
use App\Users\Restrictions\RestrictionsEngine;
|
||||
use Domain\Teams\Actions\CheckMaxTeamMembersLimitAction;
|
||||
|
||||
class DefaultRestrictionsEngine implements RestrictionsEngine
|
||||
@@ -41,7 +41,7 @@ class DefaultRestrictionsEngine implements RestrictionsEngine
|
||||
|
||||
public function canInviteTeamMembers(User $user, array $newInvites = []): bool
|
||||
{
|
||||
return resolve(CheckMaxTeamMembersLimitAction::class)($user, $newInvites);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canVisitShared(User $user): bool
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace App\Restrictions\Engines;
|
||||
namespace App\Users\Restrictions\Engines;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use App\Restrictions\RestrictionsEngine;
|
||||
use App\Users\Restrictions\RestrictionsEngine;
|
||||
use Domain\Teams\Actions\CheckMaxTeamMembersLimitAction;
|
||||
|
||||
class FixedBillingRestrictionsEngine implements RestrictionsEngine
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
namespace App\Restrictions\Engines;
|
||||
namespace App\Users\Restrictions\Engines;
|
||||
|
||||
use App\Users\Models\User;
|
||||
use App\Restrictions\RestrictionsEngine;
|
||||
use App\Users\Restrictions\RestrictionsEngine;
|
||||
|
||||
class MeteredBillingRestrictionsEngine implements RestrictionsEngine
|
||||
{
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
namespace App\Restrictions;
|
||||
namespace App\Users\Restrictions;
|
||||
|
||||
use App\Users\Models\User;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
namespace App\Restrictions;
|
||||
namespace App\Users\Restrictions;
|
||||
|
||||
use Illuminate\Support\Manager;
|
||||
use App\Restrictions\Engines\DefaultRestrictionsEngine;
|
||||
use App\Restrictions\Engines\FixedBillingRestrictionsEngine;
|
||||
use App\Restrictions\Engines\MeteredBillingRestrictionsEngine;
|
||||
use App\Users\Restrictions\Engines\DefaultRestrictionsEngine;
|
||||
use App\Users\Restrictions\Engines\FixedBillingRestrictionsEngine;
|
||||
use App\Users\Restrictions\Engines\MeteredBillingRestrictionsEngine;
|
||||
|
||||
class RestrictionsManager extends Manager
|
||||
{
|
||||
@@ -108,84 +108,6 @@ class DefaultRestrictionsTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function it_cant_invite_team_members_into_team_folder_because_user_exceeded_members_limit()
|
||||
{
|
||||
$user = User::factory()
|
||||
->hasFolders([
|
||||
'team_folder' => true,
|
||||
])
|
||||
->create();
|
||||
|
||||
TeamFolderMember::create([
|
||||
'parent_id' => $user->folders[0]->id,
|
||||
'user_id' => $user->id,
|
||||
'permission' => 'owner',
|
||||
]);
|
||||
|
||||
// Create team folder members
|
||||
$members = User::factory()
|
||||
->count(5)
|
||||
->create()
|
||||
->each(
|
||||
fn ($member) => TeamFolderMember::factory()
|
||||
->create([
|
||||
'parent_id' => $user->folders[0]->id,
|
||||
'user_id' => $member->id,
|
||||
])
|
||||
);
|
||||
|
||||
// Try invite new members, it has to fail
|
||||
$this
|
||||
->actingAs($user)
|
||||
->post('/api/teams/folders', [
|
||||
'name' => 'Company Project',
|
||||
'invitations' => [
|
||||
[
|
||||
'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(401);
|
||||
|
||||
// Invite existing member, it has to go through
|
||||
$this
|
||||
->actingAs($user)
|
||||
->post('/api/teams/folders', [
|
||||
'name' => 'Company Project',
|
||||
'invitations' => [
|
||||
[
|
||||
'email' => $members[0]->email,
|
||||
'permission' => 'can-edit',
|
||||
],
|
||||
],
|
||||
])
|
||||
->assertCreated();
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user