Skip to content

Commit

Permalink
added account limit handling for resellers
Browse files Browse the repository at this point in the history
  • Loading branch information
detain committed Sep 19, 2019
1 parent 3ab5de4 commit 68fd492
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,15 @@ function_requirements('whm_api');
} else {
$reseller = false;
}
$account_limit = 100;
if ($serviceTypes[$serviceClass->getType()]['services_field2'] != '') {
$fields = explode(',', $serviceTypes[$serviceClass->getType()]['services_field2']);
foreach ($fields as $field) {
list($key, $value) = explode('=', $field);
if ($key == 'script') {
$extra[$key] = $value;
} elseif ($key == 'account_limit') {
$account_limit = $value;
} else {
$options[$key] = $value;
}
Expand Down Expand Up @@ -247,6 +250,11 @@ function_requirements('whm_api');
myadmin_log(self::$module, 'info', str_replace('\n', "\n", json_encode($response)), __LINE__, __FILE__, self::$module, $serviceClass->getId());
request_log(self::$module, $serviceClass->getCustid(), __FUNCTION__, 'cpanel', 'setacls', $request, $response);
myadmin_log(self::$module, 'info', 'Reseller assigned to ACL', __LINE__, __FILE__, self::$module, $serviceClass->getId());
$whm->setresellerlimits([
'user' => $username,
'enable_account_limit' => 1,
'account_limit' => $account_limit,
]);
}
$db = get_module_db(self::$module);
$username = $db->real_escape($username);
Expand Down

0 comments on commit 68fd492

Please sign in to comment.