File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace PleskXTest \Utility ;
4+
5+ class KeyLimitChecker
6+ {
7+ const LIMIT_CLIENTS = 'limit_clients ' ;
8+ const LIMIT_RESELLERS = 'limit_resellers ' ;
9+ const LIMIT_DOMAINS = 'limit_domains ' ;
10+
11+ /**
12+ * Checks whether limit is within the required constraint
13+ *
14+ * @param (string|int)[] $keyInfo Structure returned by the getKeyInfo call
15+ * @param string $type Type of the object that should be checked
16+ * @param int $minimalRequirement Minimal value that should satisfy the limit
17+ * @return bool if license satisfies set limits
18+ */
19+ public static function checkByType (array $ keyInfo , $ type , $ minimalRequirement )
20+ {
21+ $ field = null ;
22+ switch ($ type ) {
23+ case self ::LIMIT_CLIENTS :
24+ if (intval ($ keyInfo ['can-manage-customers ' ]) === 0 ) {
25+ return false ;
26+ }
27+ $ field = 'lim_cl ' ;
28+ break ;
29+ case self ::LIMIT_RESELLERS :
30+ if (intval ($ keyInfo ['can-manage-resellers ' ]) === 0 ) {
31+ return false ;
32+ }
33+ $ field = 'lim_cl ' ;
34+ break ;
35+ case self ::LIMIT_DOMAINS :
36+ $ field = 'lim_dom ' ;
37+ break ;
38+ default :
39+ return false ;
40+ }
41+ return intval ($ keyInfo [$ field ]) === -1 || intval ($ keyInfo [$ field ]) > $ minimalRequirement ;
42+ }
43+ }
Original file line number Diff line number Diff line change 22// Copyright 1999-2019. Plesk International GmbH.
33namespace PleskXTest ;
44
5+ use PleskXTest \Utility \PasswordProvider ;
6+
57class WebspaceTest extends TestCase
68{
79 public function testGetPermissionDescriptor ()
@@ -96,7 +98,7 @@ public function testRequestCreateWebspace()
9698 ],
9799 [
98100 'name ' => 'ftp_password ' ,
99- 'value ' => ' test-PWD*1 ' ,
101+ 'value ' => PasswordProvider:: STRONG_PASSWORD ,
100102 ],
101103 ],
102104 'ip_address ' => static ::_getIpAddress (),
You can’t perform that action at this time.
0 commit comments