mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-04 17:44:05 +00:00
Delete the ttl option from clear expired impersonation tokens command (only clears expired tokens now)
This commit is contained in:
parent
69a1326029
commit
c3c5955c84
2 changed files with 8 additions and 24 deletions
|
|
@ -8,20 +8,15 @@ use Illuminate\Console\Command;
|
|||
use Stancl\Tenancy\Features\UserImpersonation;
|
||||
|
||||
/**
|
||||
* This command clears impersonation tokens.
|
||||
* By default, only expired tokens (= tokens older than 60s, which is the UserImpersonation::$ttl default) are deleted.
|
||||
* Clears expired impersonation tokens.
|
||||
*
|
||||
* To override the default behavior, e.g. to clear all tokens newer than 60s,
|
||||
* you can pass the seconds in the --ttl option.
|
||||
*
|
||||
* For example, `tenants:clear-expired-impersonation-tokens --ttl=30` will clear all tokens older than 30 seconds, ignoring the default.
|
||||
* Tokens older than UserImpersonation::$ttl (60 seconds by default) are considered expired.
|
||||
*
|
||||
* @see Stancl\Tenancy\Features\UserImpersonation
|
||||
*/
|
||||
class ClearExpiredImpersonationTokens extends Command
|
||||
{
|
||||
protected $signature = 'tenants:clear-expired-impersonation-tokens
|
||||
{--ttl= : TTL in seconds for impersonation tokens (default is UserImpersonation::$ttl)}';
|
||||
protected $signature = 'tenants:clear-expired-impersonation-tokens';
|
||||
|
||||
protected $description = 'Clear expired impersonation tokens.';
|
||||
|
||||
|
|
@ -29,8 +24,7 @@ class ClearExpiredImpersonationTokens extends Command
|
|||
{
|
||||
$this->components->info('Deleting expired impersonation tokens.');
|
||||
|
||||
$ttl = (int) $this->option('ttl') ?: UserImpersonation::$ttl;
|
||||
$expirationDate = now()->subSeconds($ttl);
|
||||
$expirationDate = now()->subSeconds(UserImpersonation::$ttl);
|
||||
|
||||
$impersonationTokenModel = UserImpersonation::modelClass();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue