Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/edit_reseller_privileges/index.tmpl
[%
USE Whostmgr;
USE JSON;
USE AccountEnhancements;
USE CPScalar;
SET enhancement_limits = AccountEnhancements.list_enhancement_limits( data.reseller );
SET stylesheet_includes = [
Whostmgr.find_file_url('/templates/edit_reseller_privileges/index.css')
];
IF locale.get_html_dir_attr() == 'rtl';
stylesheet_includes.unshift(Whostmgr.find_file_url('/styles/bootstrap_rtl_offsets.min.css'));
END;
SET script_includes = [];
IF !data.error_message;
script_includes = ['/js/popupbox.js', '/templates/edit_reseller_privileges/index.min.js'];
END;
WRAPPER 'master_templates/master.tmpl'
header = locale.maketext('Edit Reseller Nameservers and Privileges')
stylesheets = stylesheet_includes
scripts = script_includes
include_legacy_stylesheets = 1
theme = 'bootstrap',
app_key = 'edit_reseller_name_servers_and_privileges';
%]
[% MACRO acl_group BLOCK %]
<div class="checkbox">
<label>
<input type="checkbox"
data-testid="aclCheckbox-[% priv.name %]"
name="acl-[% priv.name %]"
id="privs_[% priv.name %]"
class="acl-checkbox"
[% IF priv.checked %]checked[% END %]
value="1">
<span>[% priv.title.to_string() %]</span>
<span><code>[% priv.name %]</code></span>
</label>
[% IF priv.description && priv.description_is_warning && !priv.warning_manage_tokens_only && priv.name != 'all' %]
<span class="fas fa-exclamation-triangle fa-lg acl-warning-icon"
id="acl-warning-toggle-[% priv.name %]"
role="button"
tabindex="0"
aria-controls="acl-warning-[% priv.name %]"
onclick="EditReseller.toggleHelpText(event, 'acl-warning-[% priv.name %]');"
onkeypress="EditReseller.toggleHelpText(event, 'acl-warning-[% priv.name %]');"></span>
[% END %]
[% IF priv.description && !priv.description_is_warning %]
<span class="help-block">[% priv.description.to_string() %]</span>
[% END %]
[% IF priv.description && priv.description_is_warning && !priv.warning_manage_tokens_only %]
<div class="alert alert-warning acl-warning [% IF priv.name != 'all' %]hidden[% END %]"
id="acl-warning-[% priv.name %]">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<div class="alert-message acl-warning-message">[% priv.description.to_string() %]</div>
</div>
[% END %]
</div>
[% END %]
[% MACRO acl_section BLOCK %]
<li class="list-group-item">
<div class="checkbox">
<label>
<input type="checkbox"
id="acl-subcategory-[% group.name %]-checkbox"
class="acl-subcategory-checkbox"
[% IF group.checked %]checked[% END %]
onclick="EditReseller.toggleAll(event)">
<strong>[% group.title.to_string() %]</strong>
</label>
<span class="label label-[% category.name %] flip pull-right">[% category.title.to_string() %]</span>
[% IF group.description && group.description_is_warning %]
<div class="alert alert-warning acl-warning"
id="acl-warning-[% group.name %]">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<div class="alert-message acl-warning-message">[% group.description.to_string() %]</div>
</div>
[% END %]
[% markup %]
</div>
</li>
[% END %]
<div id="content">
[% IF data.error_message %]
<div class="alert alert-danger">
<span class="glyphicon glyphicon-remove-sign"></span>
<div class="alert-message">
[% data.error_message %]
</div>
</div>
[% ELSE %]
<h2>[% locale.maketext('Edit “[_1]”', data.reseller) %]</h2>
<form method="POST" action="../scripts2/editressv" name="resform">
[% IF data.has_multiuser %]
<div class="section">
<h4 class="section-heading">[% locale.maketext('Account Creation Limits') %]</h4>
<div class="section-body">
<div class="checkbox">
<label>
[% locale.maketext('Limit the total number of accounts [_1] can create', data.reseller) %]
<input type="checkbox"
onclick="EditReseller.killresnumlimitamt(this);"
data-testid="limitAccountNumberCheckbox"
name="limits_number_of_accounts"
id="limits_number_of_accounts"
value="1"
[% IF data.limits_number_of_accounts_checked %] checked [% END %]>
</label>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-6">
<label for="resnumlimitamt">[% locale.maketext('Number of accounts') %]</label>
<input type="text"
class="form-control"
data-testid="maxAccountNumberInput"
name="resnumlimitamt"
id="resnumlimitamt"
value="[% data.limits_number_of_accounts_allowed %]"
onchange="EditReseller.checkresnumlimit(this);">
</div>
</div>
</div>
</div>
<div class="checkbox">
<label>
<input type="checkbox"
data-testid="limitResourceUsageCheckbox"
name="limits_resources"
id="limits_resources"
[% IF data.limits_resources_checked %]checked[% END %]
value="1"
onclick="EditReseller.handleLimitResources()">
[% locale.maketext('Limit accounts that [_1] can create by Resource Usage.', data.reseller) %]
</label>
<div id="usagelim" class="hidden">
<div class="alert alert-warning acl-warning">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<div class="alert-message acl-warning-message">[% locale.maketext("By checking this option, you will not be able to select [output,strong,Create Packages with Unlimited Disk Usage] or [output,strong,Create Packages with Unlimited Bandwidth].") %]</div>
</div>
<div class="form-group">
<label for="rslimit-disk">[% locale.maketext('Maximum Allowed Disk Space') %]</label>
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="input-group">
<input type="text"
data-testid="maxDiscSpaceInput"
name="rslimit-disk"
id="rslimit-disk"
class="form-control"
value="[% data.resource_limits_disk %]"
maxlength="30">
<span class="input-group-addon">MB</span>
</div>
<span class="help-block">[% locale.maketext('You cannot enter “unlimited” as a value. To only limit one option, enter a very large number in the other option’s text box.') %]</span>
<div class="checkbox">
<label>
<input type="checkbox"
data-testid="allowDiscSpaceOversellingCheckbox"
name="rsolimit-disk"
id="rsolimit-disk"
value="1"
[% IF data.resource_limits_overselling_disk_checked %]checked[% END %]>
<span>[% locale.maketext('Allow overselling') %]</span>
</label>
<span class="fas fa-info-circle fa-fw text-primary form-info-icon"
title="[% locale.maketext('Toggle help text') %]"
tabindex="0"
onclick="EditReseller.toggleHelpText(event, 'rsolimit-disk-help')"
onkeypress="EditReseller.toggleHelpText(event, 'rsolimit-disk-help')"></span>
</div>
<div id="rsolimit-disk-help" class="hidden">
<span class="help-block">[% locale.maketext('Overselling means that the system limits the reseller via their accounts’ actual resource usage rather than their allocated resource usage. Actual resources refer to the total usage for the reseller’s accounts. Allocated resources refer to the total maximum allowed usage for the reseller’s accounts.') %]</span>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div id="rslimit-disk_error"></div>
</div>
</div>
</div>
<div class="form-group">
<label for="rslimit-bw">[% locale.maketext('Maximum Allowed Bandwidth') %]</label>
<div class="row">
<div class="col-xs-12 col-sm-6">
<div class="input-group">
<input type="text"
data-testid="maxBandwidthInput"
name="rslimit-bw"
id="rslimit-bw"
class="form-control"
value="[% data.resource_limits_bw %]"
maxlength="30">
<span class="input-group-addon">MB</span>
</div>
<span class="help-block">[% locale.maketext('You cannot enter “unlimited” as a value. To only limit one option, enter a very large number in the other option’s text box.') %]</span>
<div class="checkbox">
<label>
<input type="checkbox"
data-testid="allowBandwidthOversellingCheckbox"
name="rsolimit-bw"
value="1"
[% IF data.resource_limits_overselling_bw_checked %]checked[% END %]>
<span>[% locale.maketext('Allow overselling') %]</span>
</label>
<span class="fas fa-info-circle fa-fw text-primary form-info-icon"
title="[% locale.maketext('Toggle help text') %]"
tabindex="0"
onclick="EditReseller.toggleHelpText(event, 'rsolimit-bw-help')"
onkeypress="EditReseller.toggleHelpText(event, 'rsolimit-bw-help')"></span>
</div>
<div id="rsolimit-bw-help" class="hidden">
<span class="help-block">[% locale.maketext('Overselling means that the system limits the reseller via their accounts’ actual resource usage rather than their allocated resource usage. Actual resources refer to the total usage for the reseller’s accounts. Allocated resources refer to the total maximum allowed usage for the reseller’s accounts.') %]</span>
</div>
</div>
<div class="col-xs-12 col-sm-6">
<div id="rslimit-bw_error"></div>
</div>
</div>
</div>
</div>
</div>
<div class="checkbox">
<label>
<input type="checkbox"
name="limits_preassigned_packages"
id="limits_preassigned_packages"
[% IF data.limits_preassigned_packages_checked %]checked[% END %]
value="1"
onclick="EditReseller.handleLimitsForPreassignedPackages(event)">
[% locale.maketext('Specify which packages [_1] can use for account creation.', data.reseller) %]
</label>
<span class="fas fa-info-circle text-primary form-info-icon"
title="[% locale.maketext('Toggle help text') %]"
tabindex="0"
onclick="EditReseller.toggleHelpText(event, 'limits-packages-help')"
onkeypress="EditReseller.toggleHelpText(event, 'limits-packages-help')"></span>
<div id="limits-packages-help" class="hidden">
<span class="help-block">[% locale.maketext('The system automatically grants access to packages that the user creates, unless you limit account creation to pre-assigned packages below.') %]</span>
<span class="help-block">[% locale.maketext('The system does not automatically grant access to system-created or root-created packages, unless you specifically define them below.') %]</span>
</div>
<div class="checkbox">
<label>
<input type="checkbox"
name="limits_number_of_packages"
id="limits_number_of_packages"
[% IF data.limits_number_of_packages_checked %]checked[% END %]
value="1"
onclick="EditReseller.handleLimitsForAccountAmounts(event)">
[% locale.maketext('Limit the amount of accounts that [_1] can create per package.', data.reseller) %]
</label>
<span class="fas fa-info-circle fa-fw text-primary form-info-icon"
title="[% locale.maketext('Toggle help text') %]"
tabindex="0"
onclick="EditReseller.toggleHelpText(event, 'limits-number-of-packages-help')"
onkeypress="EditReseller.toggleHelpText(event, 'limits-number-of-packages-help')"></span>
<div id="limits-number-of-packages-help" class="hidden">
<span class="help-block">[% locale.maketext('You cannot enter “unlimited” as a value. Accounts with an unlimited bandwidth quota or unlimited disk quota are not resource limit compatible.') %]</span>
</div>
</div>
<div id="pkglim" class="hidden">
<table class="table table-striped" id="acctlimittbl">
<thead>
<tr>
<th>[% locale.maketext('Account Type') %]</th>
<th>[% locale.maketext('Current') %]</th>
<th>[% locale.maketext('Creation Allowed') %]</th>
<th>[% locale.maketext('Number Allowed') %]</th>
<th>[% locale.maketext('Resource Limit Compatible') %]</th>
</tr>
</thead>
<tbody>
[% FOR pkg = data.pkg_list %]
<tr>
<td>
<span style="cursor:crosshair; cursor:help;"
onmouseover="hover_pkg(this,'[% pkg.pkg %]');"
onmouseout="dehover_pkg(this,'[% pkg.pkg %]');">[% pkg.pkg.html() %]</span>
</td>
<td>[% pkg.current %]</td>
<td>
<div class="checkbox">
<input type="checkbox"
[% IF pkg.can_create_checked %]checked [% END %] name="respkg-[% pkg.pkg %]"
value="1"
onclick="EditReseller.checkcancreate('[% pkg.pkg %]');">
</div>
</td>
<td>
<input type="text"
name="acctlim-[% pkg.pkg %]"
size="6"
class="form-control"
value="[% pkg.number_allowed %]"
onchange="EditReseller.checkcancreate2(event, '[% pkg.pkg %]');">
</td>
<td>
[% IF pkg.resource_usage_compatible %]<span class="fas fa-check"></span>[% END %]
</td>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
</div>
</div>
[% END %]
[%- IF enhancement_limits.data.size %]
<div class="section">
<h4 class="section-heading">[% locale.maketext('Account Enhancement Assignment Limits') %]</h4>
<div class="section-body">
[%-
SET assignACL = 'assign-root-account-enhancements';
IF !data.enabled_acls.$assignACL;
-%]
<div class="alert alert-warning acl-warning"
id="acl-warning-enhancement-limits">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<div class="alert-message acl-warning-message">[% locale.maketext('You must enable the [output,url,_1,html,_2] [asis,ACL] to set [asis,Account Enhancement] limits.', '#privs_' _ assignACL, assignACL) %]</div>
</div>
[%- END -%]
<div>
<table class="table table-striped" id="acctlimittbl">
<thead>
<tr>
<th>[% locale.maketext('Account Enhancement ID') %]</th>
<th>[% locale.maketext('Assignment Limit') %]</th>
</tr>
</thead>
<tbody>
[%
FOREACH enhancement IN enhancement_limits.data;
SET is_unlimited = !enhancement.value.limited.html();
SET cur_value = enhancement.value.limit.html();
SET html_enhancement_id = enhancement.key.html();
IF cur_value == '';
SET cur_value = '0';
END;
%]
<tr>
<td><span>[% html_enhancement_id %]</span></td>
<td>
<div class="propertyValue">
<input type="radio"
id="[% html_enhancement_id %]_limited"
name="enhancement_limited__[% html_enhancement_id %]"
value="1"
[% IF !is_unlimited %]checked[% END %]>
<label for="[% html_enhancement_id %]_limited" class="sr-only">[% locale.maketext('Limited') %]</label>
<input type="text"
id="[% html_enhancement_id %]_limit_amount"
name="enhancement_limit_amount__[% html_enhancement_id %]"
onclick="checkRadio('[% html_enhancement_id _ '_limited' %]')"
size="6"
value="[% cur_value %]"
data-enhancement-name="[% html_enhancement_id %]"
class="form-control limit_amount__input"/>
<label for="[% html_enhancement_id %]_limit_amount" class="sr-only">[% locale.maketext('Limited Amount') %]</label>
<input type="radio"
id="[% html_enhancement_id %]_unlimited"
name="enhancement_limited__[% html_enhancement_id %]"
value="0"
class="unlimitedRadio"
[% IF is_unlimited %]checked[% END %]>
<label for="[% html_enhancement_id %]_unlimited">[% locale.maketext('Unlimited') %]</label>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>
</div>
</div>
</div>
[% END %]
<div class="section">
<h4 class="section-heading">[% locale.maketext('Feature Limits ([asis,ACL] Lists)') %]</h4>
<div class="section-body">
<div id="load" class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-9">
<label for="acllist">
[% locale.maketext('Load an [asis,ACL] List') %]
</label>
<select name="acllist"
data-testid="loadAclListSelect"
id="acllist"
class="form-control"
onchange="EditReseller.updateacls(event)">
<option value="">[% locale.maketext('(None)') %]</option>
[% FOR acl = data.acl_list %]
<option value="[% acl.key %]">[% acl.key %]</option>
[% END %]
</select>
</div>
</div>
</div>
<input type="hidden" name="res" value="[% data.reseller %]">
<div id="aclList" class="row">
<div class="col-xs-12 col-sm-9">
<ul class="list-group">
[%
SET everything = '';
FOR cat = data.ordered_categories;
SET section_html = '';
SET acl_cat = data.categories_metadata.$cat;
SET acl_cat.name = cat;
NEXT IF !data.has_multiuser && acl_cat.multiuser_required;
FOR subc = acl_cat.ordered_subcategories;
SET subcat = data.subcategories_metadata.$subc;
SET subcat.name = subc;
SET group_html = '';
SET count_check = 0;
SET count = 0;
FOR acl = subcat.ordered_acls;
SET priv = data.acl_metadata.$acl;
SET priv.name = acl;
SET priv.checked = data.enabled_acls.$acl;
# Remove the 'valid' ACL from the list. We process the leftover ACLs in
# a subsequent loop to preserve ACLs for disable third-party plugins.
data.enabled_acls.delete(priv.name);
NEXT IF !data.has_multiuser && priv.multiuser_required;
IF priv.checked;
count_check = count_check + 1;
END;
SET count = count + 1;
SET group_html = group_html _ acl_group(priv=priv);
END;
NEXT IF !data.has_multiuser && subcat.multiuser_required;
subcat.checked = (count == count_check) ? 1 : 0;
IF group_html;
SET section_html = section_html _ acl_section(group=subcat, category=acl_cat, markup=group_html);
END;
END;
IF section_html;
SET everything = everything _ section_html;
END;
END;
%]
[% everything %]
</ul>
</div>
[%
# Any ACLs left in the enabled_acls are invalid ACLs for the system.
# These can by ACLs for invalid plugins (e.g. plugins that are no installed on the system),
# or ACLs for disabled plugins. We want to keep the ACLs for these "disabled" plugins, to
# preserve the setting for the future in case the plugin is enabled again.
FOR acl = data.enabled_acls;
SET disabled_key = acl.key;
IF data.disabled_acls.exists(disabled_key); %]
<input type="hidden" name="acl-[% disabled_key %]" value="1" >
[% END;
END; %]
</div>
<div class="save-acl-list-container">
<div class="radio">
<label>
<input type="radio"
name="save_as"
id="save_acl_as_new"
data-relates-to="save_new_acl">
<span id="save_as_new_label">[% locale.maketext('Save selections as a new [asis,ACL] list') %]</span>
</label>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-6">
<input type="text"
name="saveacl"
id="save_new_acl"
class="form-control"
aria-labelledby="save_as_new_label"
disabled>
</div>
</div>
</div>
</div>
<div class="radio">
<label>
<input type="radio"
name="save_as"
id="overwrite_acl_list"
data-relates-to="acllistsv">
<span id="save_as_existing_label">[% locale.maketext('Save selections as an existing [asis,ACL] list') %]</span>
</label>
<div class="form-group">
<div class="row">
<div class="col-xs-12 col-sm-6">
<select name="saveacl"
id="acllistsv"
class="form-control"
aria-labelledby="save_as_existing_label"
disabled>
[% FOR acl = data.acl_list %]
<option value="[% acl.key %]">[% acl.key %]</option>
[% END %]
</select>
</div>
</div>
</div>
</div>
<div class="radio">
<label>
<input type="radio"
data-testid="dontSaveAclListRadioButton"
name="save_as"
id="acl_list_do_nothing"
checked>
<span>[% locale.maketext('Do not save selections') %]</span>
</label>
</div>
</div>
</div>
</div>
[% IF data.has_multiuser %]
<div class="section">
<h4 class="section-heading">[% locale.maketext('Nameservers') %]</h4>
<div class="section-body">
<p class="description">[% locale.maketext('Set the default nameservers that the system uses when this reseller creates an account.') %]</p>
[%
SET nameservers_set = 0;
FOREACH ns IN data.nameserver_list;
IF ns.nameserver;
nameservers_set = 1;
LAST;
END;
END;
%]
<div class="form-group" data-nameserver-set="[% nameservers_set %]">
<div class="row">
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
<div class="radio">
<label for="inheritNameserversFromYes">
<input type="radio" data-testid="inheritRootNameserversRadioButton" name="inheritNameserversFromRoot" id="inheritNameserversFromYes" value="1" [% nameservers_set ? '' : 'checked' %] onclick="EditReseller.toggleInherit(true)">
<span>[% locale.maketext('Inherit Nameservers from [asis,root]') %]</span>
</label>
[% FOREACH ns IN data.nameserver_list %]
<div class="help-block">
[% IF ns.suggested_nameserver != '' %]
[% locale.maketext("Nameserver [_1]: “[_2]”", ns.count, ns.suggested_nameserver) %]
[% END %]
</div>
[% END %]
</div>
<div class="radio">
<label for="inheritNameserversFromNo">
<input type="radio" data-testid="setNameserverExplicitlyRadioButton" name="inheritNameserversFromRoot" id="inheritNameserversFromNo" value="0" [% nameservers_set ? 'checked' : '' %] onclick="EditReseller.toggleInherit(false)">
<span>[% locale.maketext('Explicitly Set the Nameservers') %]</span>
</label>
<span class="help-block">[% locale.maketext('Nameservers that you explicitly set will transfer with the user to the new servers upon migration.') %]</span>
</div>
</div>
</div>
</div>
<div id="resellerNameserverList" [% nameservers_set ? '' : 'class="hidden"' %]>
[% FOREACH ns IN data.nameserver_list %]
<div class="form-group">
<label for="ns[% ns.count %]">[% locale.maketext('Nameserver [_1]', ns.count) %]</label>
<div class="row">
<div class="col-xs-12 col-sm-6">
<input type="text"
data-testid="nameserverInput"
name="ns[% ns.count %]"
id="ns[% ns.count %]"
class="form-control"
value="[% ns.nameserver || '' %]">
</div>
<div class="col-xs-12 col-sm-6">
<input type="button"
data-testid="nameserverConfigureButton"
class="btn btn-default"
onclick="EditReseller.addns(this.form.ns[% ns.count %]);"
value="[% locale.maketext('Configure Address Records') %]">
</div>
</div>
</div>
[% END %]
</div>
</div>
</div>
[% END %]
<div class="alert alert-warning acl-warning hidden" id="warning-ns">
<span class="glyphicon glyphicon-exclamation-sign"></span>
<div class="alert-message acl-warning-message">
[% code_auto_domain = CPScalar.sprintf( '<code>.%s</code>', CPANEL.auto_domain_for_host ); %]
[% locale.maketext("Default nameservers of the type [asis,_1] are not compatible with [asis,_2] domain registrations.", code_auto_domain, "<code>.com</code>") %]
<a
href="https://go.cpanel.net/PrivateNameservers"
target="nameserversDocumentation"
rel="noopener noreferrer"
id="nameservers-warning-link"
>
[% locale.maketext("Learn More") %]
<i class="ri-external-link-line"></i>
</a>
</div>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="[% locale.maketext('Save All Settings') %]" data-testid="saveButton" id="save_button">
</div>
</div>
<script>
var PAGE = PAGE || {};
PAGE.acl_lists = [% data.acl_list.json() || "{}" %];
PAGE.acl_metadata = [% data.acl_metadata.json() || "{}" %];
PAGE.autoDomainForHost = [% CPANEL.auto_domain_for_host.json() || "" %];
[% IF locale.get_html_dir_attr() == 'rtl' %]
PAGE.isRTL = true;
[% ELSE %]
PAGE.isRTL = false;
[% END %]
var suggestedNameservers = [% data.nameserver_list.json() or "[]" %];
function checkRadio(id) {
var radioButton = document.querySelector(`[id=${id}]`);
radioButton.checked = true;
}
</script>
[% INCLUDE '_pkg_hover.tmpl' %]
[% END # error_message block %]
[% END #wrapper %]
<script>
EditReseller.initNsWarning()
</script>
Back to Directory
File Manager