Fix non-expiry key actions

This commit is contained in:
Matej Bačo
2026-03-26 15:44:50 +01:00
parent 8113854a89
commit 7f4d5f692d
2 changed files with 2 additions and 2 deletions
@@ -102,7 +102,7 @@ class Create extends Base
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'New API key must have expiry set, because currently authenticated API key has an expiry.');
}
if (!\is_null($expire) && $expire > $apiKey->getExpire()) {
if (!\is_null($expire) && !\is_null($apiKey->getExpire()) && $expire > $apiKey->getExpire()) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'New API key expiry must be sooner than currently authenticated API key expiry.');
}
}
@@ -104,7 +104,7 @@ class Update extends Base
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Updated API key must have expiry set, because currently authenticated API key has an expiry.');
}
if (!\is_null($expire) && $expire > $apiKey->getExpire()) {
if (!\is_null($expire) && !\is_null($apiKey->getExpire()) && $expire > $apiKey->getExpire()) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Updated API key expiry must be sooner than currently authenticated API key expiry.');
}
}