mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-14 09:15:01 +00:00
- Restriction UI warning
- create folder restriction - fixed UI bugs
This commit is contained in:
@@ -15,8 +15,7 @@ class FixedBillingLimitationEngine implements LimitationEngine
|
||||
);
|
||||
|
||||
// Check if storage usage exceed predefined capacity
|
||||
return ! ($usedPercentage >= 100)
|
||||
;
|
||||
return ! ($usedPercentage >= 100);
|
||||
}
|
||||
|
||||
public function canDownload(User $user): bool
|
||||
|
||||
@@ -9,21 +9,18 @@ class MeteredBillingLimitationEngine implements LimitationEngine
|
||||
public function canUpload(User $user, int $fileSize = 0): bool
|
||||
{
|
||||
// Disable upload when user has more than 3 failed payments
|
||||
return ! ($user->failedPayments()->count() >= 3)
|
||||
;
|
||||
return ! ($user->failedPayments()->count() >= 3);
|
||||
}
|
||||
|
||||
public function canDownload(User $user): bool
|
||||
{
|
||||
// Disable upload when user has more than 3 failed payments
|
||||
return ! ($user->failedPayments()->count() >= 3)
|
||||
;
|
||||
// Disable download when user has more than 3 failed payments
|
||||
return ! ($user->failedPayments()->count() >= 3);
|
||||
}
|
||||
|
||||
public function canCreateFolder(User $user): bool
|
||||
{
|
||||
// Disable upload when user has more than 3 failed payments
|
||||
return ! ($user->failedPayments()->count() >= 3)
|
||||
;
|
||||
// Disable create folder when user has more than 3 failed payments
|
||||
return ! ($user->failedPayments()->count() >= 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace App\Users\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class InvalidUserActionException extends Exception
|
||||
{
|
||||
// TODO: translate
|
||||
protected $message = 'This user action is not allowed.';
|
||||
}
|
||||
@@ -88,17 +88,6 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return UserFactory::new();
|
||||
}
|
||||
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (str_starts_with($method, 'can')) {
|
||||
return resolve(LimitationManager::class)
|
||||
->driver()
|
||||
->$method($this, ...$parameters);
|
||||
}
|
||||
|
||||
return parent::__call($method, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user used storage details
|
||||
*/
|
||||
@@ -211,6 +200,17 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
$this->notify(new ResetPassword($token));
|
||||
}
|
||||
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
if (str_starts_with($method, 'can')) {
|
||||
return resolve(LimitationManager::class)
|
||||
->driver()
|
||||
->$method($this, ...$parameters);
|
||||
}
|
||||
|
||||
return parent::__call($method, $parameters);
|
||||
}
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
Reference in New Issue
Block a user