Skip to content

Commit 1249dcc

Browse files
author
Kristan Kenney
committed
Merge branch 'feature/pref-user-templates' into feature/user-roles
2 parents 31b8bd8 + 312d092 commit 1249dcc

File tree

6 files changed

+167
-109
lines changed

6 files changed

+167
-109
lines changed

bin/v-list-sys-config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ json_list() {
8282
"POLICY_SYSTEM_PASSWORD_RESET": "'$POLICY_SYSTEM_PASSWORD_RESET'",
8383
"POLICY_USER_VIEW_SUSPENDED": "'$POLICY_USER_VIEW_SUSPENDED'",
8484
"POLICY_USER_EDIT_DETAILS": "'$POLICY_USER_EDIT_DETAILS'",
85+
"POLICY_USER_EDIT_WEB_TEMPLATES": "'$POLICY_USER_EDIT_WEB_TEMPLATES'",
86+
"POLICY_USER_EDIT_DNS_TEMPLATES": "'$POLICY_USER_EDIT_DNS_TEMPLATES'",
8587
"POLICY_USER_DELETE_LOGS": "'$POLICY_USER_DELETE_LOGS'",
8688
"POLICY_USER_VIEW_LOGS": "'$POLICY_USER_VIEW_LOGS'",
8789
"POLICY_USER_CHANGE_THEME": "'$POLICY_USER_CHANGE_THEME'"

web/edit/server/index.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,28 @@
706706
}
707707
}
708708

709+
// Change POLICY_USER_EDIT_WEB_TEMPLATES
710+
if (empty($_SESSION['error_msg'])) {
711+
if ($_POST['v_policy_user_edit_web_templates'] != $_SESSION['POLICY_USER_EDIT_WEB_TEMPLATES']) {
712+
exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_EDIT_WEB_TEMPLATES ".escapeshellarg($_POST['v_policy_user_edit_web_templates']), $output, $return_var);
713+
check_return_code($return_var,$output);
714+
unset($output);
715+
if (empty($_SESSION['error_msg'])) $v_policy_user_edit_details = $_POST['v_policy_user_edit_web_templates'];
716+
$v_security_adv = 'yes';
717+
}
718+
}
719+
720+
// Change POLICY_USER_EDIT_DNS_TEMPLATES
721+
if (empty($_SESSION['error_msg'])) {
722+
if ($_POST['v_policy_user_edit_dns_templates'] != $_SESSION['POLICY_USER_EDIT_DNS_TEMPLATES']) {
723+
exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_EDIT_DNS_TEMPLATES ".escapeshellarg($_POST['v_policy_user_edit_dns_templates']), $output, $return_var);
724+
check_return_code($return_var,$output);
725+
unset($output);
726+
if (empty($_SESSION['error_msg'])) $v_policy_user_edit_details = $_POST['v_policy_user_edit_dns_templates'];
727+
$v_security_adv = 'yes';
728+
}
729+
}
730+
709731
// Change POLICY_USER_VIEW_LOGS
710732
if (empty($_SESSION['error_msg'])) {
711733
if ($_POST['v_policy_user_view_logs'] != $_SESSION['POLICY_USER_VIEW_LOGS']) {

web/templates/pages/add_dns.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
<input type="text" size="20" class="vst-input vst-list-editor" name="v_ip" value="<?=htmlentities(trim($v_ip, "'"))?>">
100100
</td>
101101
</tr>
102+
<? if (($_SESSION['userContext'] === 'admin') || ($_SESSION['userContext'] === 'user') && ($_SESSION['POLICY_USER_EDIT_DNS_TEMPLATES'] === 'yes')) { ?>
102103
<tr>
103104
<td class="vst-text input-label">
104105
<?php print _('Template') . "<span class='optional'>" . strtoupper($_SESSION['DNS_SYSTEM']) . "</span>";?>
@@ -120,6 +121,7 @@
120121
</select>
121122
</td>
122123
</tr>
124+
<? } ?>
123125
<tr>
124126
<td class="vst-text input-label step-top">
125127
<a href="javascript:elementHideShow('advtable');" class="vst-advanced"><?php print _('Advanced options');?></a>

web/templates/pages/edit_dns.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
<input type="text" size="20" class="vst-input vst-list-editor" name="v_ip" value="<?=htmlentities(trim($v_ip, "'"))?>">
8585
</td>
8686
</tr>
87+
<? if (($_SESSION['userContext'] === 'admin') || ($_SESSION['userContext'] === 'user') && ($_SESSION['POLICY_USER_EDIT_DNS_TEMPLATES'] === 'yes')) { ?>
8788
<tr>
8889
<td class="vst-text input-label">
8990
<?php print _('Template') . "<span class='optional'>" . strtoupper($_SESSION['DNS_SYSTEM']) . "</span>";?>
@@ -105,6 +106,7 @@
105106
</select>
106107
</td>
107108
</tr>
109+
<? } ?>
108110
<tr>
109111
<td class="vst-text input-label">
110112
<?php print _('Expiration Date');?><span class="optional">(<?=_('YYYY-MM-DD');?>)</span>

web/templates/pages/edit_server.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,34 @@
11201120
<br><br>
11211121
</td>
11221122
</tr>
1123+
<tr>
1124+
<td class="vst-text input-label">
1125+
<?php print _('Allow users to change templates when editing web domains');?>
1126+
</td>
1127+
</tr>
1128+
<tr>
1129+
<td>
1130+
<select class="vst-list" name="v_policy_user_edit_web_templates">
1131+
<option value='yes' <?php if($_SESSION['POLICY_USER_EDIT_WEB_TEMPLATES'] !== 'no') echo 'selected' ?>><?php print _('yes'); ?></option>
1132+
<option value='no' <?php if($_SESSION['POLICY_USER_EDIT_WEB_TEMPLATES'] == 'no') echo 'selected' ?>><?php print _('no'); ?></option>
1133+
</select>
1134+
<br><br>
1135+
</td>
1136+
</tr>
1137+
<tr>
1138+
<td class="vst-text input-label">
1139+
<?php print _('Allow users to change templates when editing DNS zones');?>
1140+
</td>
1141+
</tr>
1142+
<tr>
1143+
<td>
1144+
<select class="vst-list" name="v_policy_user_edit_web_templates">
1145+
<option value='yes' <?php if($_SESSION['POLICY_USER_EDIT_DNS_TEMPLATES'] !== 'no') echo 'selected' ?>><?php print _('yes'); ?></option>
1146+
<option value='no' <?php if($_SESSION['POLICY_USER_EDIT_DNS_TEMPLATES'] == 'no') echo 'selected' ?>><?php print _('no'); ?></option>
1147+
</select>
1148+
<br><br>
1149+
</td>
1150+
</tr>
11231151
<tr>
11241152
<td class="vst-text input-label">
11251153
<?php print _('Allow users to view action and login history logs');?>

0 commit comments

Comments
 (0)