mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Ensured API keys cannot be generated with domain-only roles linked to default domain
This commit is contained in:
22
module/CLI/src/Exception/InvalidRoleConfigException.php
Normal file
22
module/CLI/src/Exception/InvalidRoleConfigException.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\CLI\Exception;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use Shlinkio\Shlink\Rest\ApiKey\Role;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
class InvalidRoleConfigException extends InvalidArgumentException implements ExceptionInterface
|
||||
{
|
||||
public static function forDomainOnlyWithDefaultDomain(): self
|
||||
{
|
||||
return new self(sprintf(
|
||||
'You cannot create an API key with the "%s" role attached to the default domain. '
|
||||
. 'The role is currently limited to non-default domains.',
|
||||
Role::DOMAIN_SPECIFIC,
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user