Skip to content

Commit 3070323

Browse files
author
Kristan Kenney
committed
Add POLICY_SYSTEM_HIDE_SERVICES
1 parent 5098ecd commit 3070323

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

bin/v-list-sys-config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ json_list() {
7878
"UPDATE_AVAILABLE": "'$UPDATE_AVAILABLE'",
7979
"POLICY_SYSTEM_PROTECTED_ADMIN": "'$POLICY_SYSTEM_PROTECTED_ADMIN'",
8080
"POLICY_SYSTEM_HIDE_ADMIN": "'$POLICY_SYSTEM_HIDE_ADMIN'",
81+
"POLICY_SYSTEM_HIDE_SERVICES": "'$POLICY_SYSTEM_HIDE_SERVICES'",
8182
"POLICY_SYSTEM_PASSWORD_RESET": "'$POLICY_SYSTEM_PASSWORD_RESET'",
8283
"POLICY_USER_EDIT_DETAILS": "'$POLICY_USER_EDIT_DETAILS'",
8384
"POLICY_USER_DELETE_LOGS": "'$POLICY_USER_DELETE_LOGS'",

web/edit/server/index.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,18 @@
778778
}
779779
}
780780

781+
782+
// Change POLICY_SYSTEM_HIDE_SERVICES
783+
if (empty($_SESSION['error_msg'])) {
784+
if ($_POST['v_policy_system_hide_services'] != $_SESSION['POLICY_SYSTEM_HIDE_SERVICES']) {
785+
exec (HESTIA_CMD."v-change-sys-config-value POLICY_SYSTEM_HIDE_SERVICES ".escapeshellarg($_POST['v_policy_system_hide_services']), $output, $return_var);
786+
check_return_code($return_var,$output);
787+
unset($output);
788+
if (empty($_SESSION['error_msg'])) $v_policy_system_hide_services = $_POST['v_policy_system_hide_services'];
789+
$v_security_adv = 'yes';
790+
}
791+
}
792+
781793
// Change login style
782794
if (empty($_SESSION['error_msg'])) {
783795
if ($_POST['v_login_style'] != $_SESSION['LOGIN_STYLE']) {

web/templates/includes/panel.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,13 @@
4848
</a>
4949
</div>
5050
<? } ?>
51-
<? if (($_SESSION['userContext'] === 'admin') && ($_SESSION['look'] === 'admin')) {?>
52-
<!-- Hide 'Server Settings' button when impersonating 'admin' or other users -->
53-
<? } else if (($_SESSION['userContext'] === 'admin') && (!isset($_SESSION['look']))) { ?>
54-
<div class="l-menu__item <?php if($TAB == 'SERVER' ) echo 'l-menu__item--active' ?> <?php if($TAB == 'IP' ) echo 'l-menu__item--active' ?> <?php if($TAB == 'RRD' ) echo 'l-menu__item--active' ?> <?php if($TAB == 'FIREWALL' ) echo 'l-menu__item--active' ?>"><a href="/list/server/" class="l-profile__serversettings" title="<?=_('Server')?>"><i class="fas fa-cog"></i></a></div>
51+
52+
<? if (($_SESSION['userContext'] === 'admin') && ($_SESSION['POLICY_SYSTEM_HIDE_SERVICES'] !== 'yes') || ($_SESSION['user'] === 'admin')) {?>
53+
<? if (($_SESSION['userContext'] === 'admin') && (!empty($_SESSION['look']))) {?>
54+
<!-- Hide 'Server Settings' button when impersonating 'admin' or other users -->
55+
<? } else { ?>
56+
<div class="l-menu__item <?php if($TAB == 'SERVER' ) echo 'l-menu__item--active' ?> <?php if($TAB == 'IP' ) echo 'l-menu__item--active' ?> <?php if($TAB == 'RRD' ) echo 'l-menu__item--active' ?> <?php if($TAB == 'FIREWALL' ) echo 'l-menu__item--active' ?>"><a href="/list/server/" class="l-profile__serversettings" title="<?=_('Server')?>"><i class="fas fa-cog"></i></a></div>
57+
<? } ?>
5558
<? } ?>
5659
<? if (($_SESSION['userContext'] === 'admin') && (isset($_SESSION['look']) && ($user == 'admin'))) {?>
5760
<!-- Hide 'edit user' entry point from other administrators for default 'admin' account-->

web/templates/pages/edit_server.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@
10451045
</tr>
10461046
<tr>
10471047
<td class="vst-text input-label">
1048-
<?php print _('Disable access and hide account from other administrators');?>
1048+
<?php print _('Hide account from other administrators');?>
10491049
</td>
10501050
</tr>
10511051
<tr>
@@ -1057,6 +1057,20 @@
10571057
<br><br>
10581058
</td>
10591059
</tr>
1060+
<tr>
1061+
<td class="vst-text input-label">
1062+
<?php print _('Disable Server Settings access for other administrators');?>
1063+
</td>
1064+
</tr>
1065+
<tr>
1066+
<td>
1067+
<select class="vst-list" name="v_policy_system_hide_services">
1068+
<option value='yes'><?php print _('yes'); ?></option>
1069+
<option value='no' <?php if($_SESSION['POLICY_SYSTEM_HIDE_SERVICES'] !== 'yes') echo 'selected' ?>><?php print _('no'); ?></option>
1070+
</select>
1071+
<br><br>
1072+
</td>
1073+
</tr>
10601074
</table>
10611075
</td>
10621076
</tr>

0 commit comments

Comments
 (0)