Submit
Path:
~
/
/
usr
/
local
/
psa
/
admin
/
plib
/
modules
/
git
/
vendor
/
plesk
/
api-php-lib
/
tests
/
Utility
/
File Content:
KeyLimitChecker.php
<?php // Copyright 1999-2021. Plesk International GmbH. namespace PleskXTest\Utility; class KeyLimitChecker { const LIMIT_CLIENTS = 'limit_clients'; const LIMIT_RESELLERS = 'limit_resellers'; const LIMIT_DOMAINS = 'limit_domains'; /** * Checks whether limit is within the required constraint. * * @param (string|int)[] $keyInfo Structure returned by the getKeyInfo call * @param string $type Type of the object that should be checked * @param int $minimalRequirement Minimal value that should satisfy the limit * * @return bool if license satisfies set limits */ public static function checkByType(array $keyInfo, $type, $minimalRequirement) { $field = null; switch ($type) { case self::LIMIT_CLIENTS: if (intval($keyInfo['can-manage-customers']) === 0) { return false; } $field = 'lim_cl'; break; case self::LIMIT_RESELLERS: if (intval($keyInfo['can-manage-resellers']) === 0) { return false; } $field = 'lim_cl'; break; case self::LIMIT_DOMAINS: $field = 'lim_dom'; break; default: return false; } return intval($keyInfo[$field]) === -1 || intval($keyInfo[$field]) > $minimalRequirement; } }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
KeyLimitChecker.php
1477 bytes
0644
PasswordProvider.php
165 bytes
0644
N4ST4R_ID | Naxtarrr