Skip to content

Commit 8928957

Browse files
author
Kristan Kenney
committed
Add hide admin switch
1 parent cb39c40 commit 8928957

File tree

5 files changed

+49
-10
lines changed

5 files changed

+49
-10
lines changed

bin/v-list-sys-config

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ json_list() {
7272
"DEBUG_MODE": "'$DEBUG_MODE'",
7373
"API": "'$API'",
7474
"API_ALLOWED_IP": "'$API_ALLOWED_IP'",
75-
"RESTRICTED_ADMIN": "'$RESTRICTED_ADMIN'"
75+
"RESTRICTED_ADMIN": "'$RESTRICTED_ADMIN'",
76+
"HIDE_ADMIN_ACCOUNT": "'$HIDE_ADMIN_ACCOUNT'"
7677
}
7778
}'
7879
}
@@ -172,6 +173,7 @@ shell_list() {
172173
echo "Debug Mode: $DEBUG_MODE"
173174
echo "Theme: $THEME"
174175
echo "Restricted Admin Access: $RESTRICTED_ADMIN"
176+
echo "Hide System Administator: $HIDE_ADMIN_ACCOUNT"
175177
echo "Updates: Notify by email: $UPGRADE_SEND_EMAIL"
176178
echo "Updates: Email install log: $UPGRADE_SEND_EMAIL_LOG"
177179
}
@@ -188,7 +190,7 @@ plain_list() {
188190
echo -ne "$SMTP_RELAY_HOST\t$SMTP_RELAY_PORT\t$SMTP_RELAY_USER\t"
189191
echo -ne "$UPGRADE_SEND_EMAIL\t$UPGRADE_SEND_EMAIL_LOG\t$THEME\t$LANGUAGE\t$BACKUP_GZIP\t"
190192
echo -ne "$BACKUP\t$WEBMAIL_ALIAS\t$DB_PMA_URL\t$DB_PGA_URL\t\t$DEBUG_MODE\t$API\t$API_ALLOWED_IP"
191-
echo -e "$RESTRICTED_ADMIN"
193+
echo -e "$RESTRICTED_ADMIN\t$HIDE_ADMIN_ACCOUNT"
192194
}
193195

194196

@@ -206,7 +208,7 @@ csv_list() {
206208
echo -n "'UPGRADE_SEND_EMAIL','UPGRADE_SEND_EMAIL_LOG',"
207209
echo -n "'THEME', 'LANGUAGE','BACKUP_GZIP','BACKUP','WEBMAIL_ALIAS',"
208210
echo -n "'DB_PMA_ALIAS','DB_PGA_ALIAS','DEBUG_MODE','API','API_ALLOWED_IP',"
209-
echo -n "'RESTRICTED_ADMIN'"
211+
echo -n "'RESTRICTED_ADMIN',HIDE_ADMIN_ACCOUNT'"
210212
echo
211213
echo -n "'$WEB_SYSTEM','$WEB_RGROUPS','$WEB_PORT','$WEB_SSL',"
212214
echo -n "'$WEB_SSL_PORT','$WEB_BACKEND','$PROXY_SYSTEM','$PROXY_PORT',"
@@ -218,7 +220,7 @@ csv_list() {
218220
echo -n "'$SMTP_RELAY','$SMTP_RELAY_HOST','$SMTP_RELAY_PORT','$SMTP_RELAY_USER',"
219221
echo -n "'$UPGRADE_SEND_EMAIL','$UPGRADE_SEND_EMAIL_LOG','$THEME','$LANGUAGE',"
220222
echo -n "'$BACKUP_GZIP','$BACKUP','$WEBMAIL_ALIAS','$DB_PMA_URL','$DB_PGA_URL'"
221-
echo -n "'$DEBUG_MODE','$API','$API_ALLOWED_IP','$RESTRICTED_ADMIN"
223+
echo -n "'$DEBUG_MODE','$API','$API_ALLOWED_IP','$RESTRICTED_ADMIN,$HIDE_ADMIN_ACCOUNT"
222224

223225
echo
224226
}

web/edit/server/index.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,18 @@
705705
$v_security_adv = 'yes';
706706
}
707707
}
708+
709+
// Change RESTRICTED_ADMIN
710+
if (empty($_SESSION['error_msg'])) {
711+
if ($_POST['v_hide_admin'] != $_SESSION['HIDE_ADMIN_ACCOUNT']) {
712+
exec (HESTIA_CMD."v-change-sys-config-value HIDE_ADMIN_ACCOUNT ".escapeshellarg($_POST['v_hide_admin']), $output, $return_var);
713+
check_return_code($return_var,$output);
714+
unset($output);
715+
if (empty($_SESSION['error_msg'])) $v_enforce_subdomain_ownership = $_POST['v_hide_admin'];
716+
$v_security_adv = 'yes';
717+
}
718+
}
719+
708720
// Change login style
709721
if (empty($_SESSION['error_msg'])) {
710722
if ($_POST['v_login_style'] != $_SESSION['LOGIN_STYLE']) {

web/templates/admin/edit_server.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@
10271027
<? if (($_SESSION['userContext'] === "admin") && ($_SESSION['user'] === 'admin')) {?>
10281028
<tr>
10291029
<td class="vst-text input-label">
1030-
<?php print _('Restrict access to System Administrator account');?>
1030+
<?php print _('Restrict access to System Administrator account items');?>
10311031
</td>
10321032
</tr>
10331033
<tr>
@@ -1039,6 +1039,20 @@
10391039
<br><br>
10401040
</td>
10411041
</tr>
1042+
<tr>
1043+
<td class="vst-text input-label">
1044+
<?php print _('Hide Administrator account from other Administrators');?>
1045+
</td>
1046+
</tr>
1047+
<tr>
1048+
<td>
1049+
<select class="vst-list" name="v_hide_admin">
1050+
<option value='yes'><?php print _('yes'); ?></option>
1051+
<option value='no' <?php if($_SESSION['HIDE_ADMIN_ACCOUNT'] == 'no') echo 'selected' ?> ><?php print _('no'); ?></option>
1052+
</select>
1053+
<br><br>
1054+
</td>
1055+
</tr>
10421056
<?}?>
10431057
<tr>
10441058
<td class="vst-text input-label">

web/templates/admin/list_packages.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,23 @@
6868
<div class="clearfix l-unit__stat-col--left super-compact">
6969
<input id="check<?=$i?>" class="ch-toggle" type="checkbox" title="<?=_('Select')?>" name="user[]" value="<?=$key?>">
7070
</div>
71-
<div class="clearfix l-unit__stat-col--left wide-2 truncate"><b><a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=_('Editing Package')?>: <?=$key?>"><?=$key?></b></a></div>
71+
<div class="clearfix l-unit__stat-col--left wide-2 truncate">
72+
<b>
73+
<? if (($_SESSION['userContext'] === "admin") && ($_SESSION['user'] === 'admin')) {?>
74+
<a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=_('Editing Package')?>: <?=$key?>">
75+
<? } else { ?>
76+
<?=$key?>
77+
<? } ?>
78+
</b>
79+
</a>
80+
</div>
7281
<!-- START QUICK ACTION TOOLBAR AREA -->
7382
<div class="clearfix l-unit__stat-col--left text-right compact-3">
7483
<div class="l-unit-toolbar__col l-unit-toolbar__col--right noselect">
7584
<div class="actions-panel clearfix">
76-
<div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href"><a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=_('Editing Package')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim"></i></a></div>
85+
<? if (($_SESSION['userContext'] === "admin") && ($_SESSION['user'] === 'admin')) {?>
86+
<div class="actions-panel__col actions-panel__edit shortcut-enter" key-action="href"><a href="/edit/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=_('Editing Package')?>"><i class="fas fa-pencil-alt status-icon orange status-icon dim"></i></a></div>
87+
<? } ?>
7788
<div class="actions-panel__col actions-panel__edit" key-action="href"><a href="/copy/package/?package=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=_('Copy')?>"><i class="fas fa-clone status-icon teal status-icon dim"></i></a></div>
7889
<? if ($key == 'default') {?>
7990
<!-- Hide option to delete the default package -->

web/templates/admin/list_user.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@
9494
$spnd_confirmation = _('SUSPEND_USER_CONFIRMATION');
9595
}
9696
?>
97-
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended'; if($_SESSION['favourites']['USER'][$key] == 1) echo ' l-unit--starred';?> animated fadeIn" v_section="user"
97+
<div class="l-unit <? if($status == 'suspended') echo 'l-unit--suspended'; if($_SESSION['favourites']['USER'][$key] == 1) echo ' l-unit--starred';?> animated fadeIn" v_section="user"
9898
v_unit_id="<?=$key?>" sort-date="<?=strtotime($data[$key]['DATE'].' '.$data[$key]['TIME'])?>" sort-name="<?=strtolower($key)?>"
9999
sort-bandwidth="<?=$data[$key]['U_BANDWIDTH']?>" sort-disk="<?=$data[$key]['U_DISK']?>" sort-star="<? if($_SESSION['favourites']['USER'][$key] == 1) echo '1'; else echo '0'; ?>">
100-
<div class="l-unit__col l-unit__col--right">
100+
<div class="l-unit__col l-unit__col--right" style="<? if (($_SESSION['HIDE_ADMIN_ACCOUNT'] === 'yes') && ($_SESSION['user'] !== 'admin') && ($key === 'admin')) { echo 'display: none';} else {echo 'display: table-cell';}?>">
101101
<div class="clearfix l-unit__stat-col--left super-compact">
102102
<input id="check<?=$i?>" class="ch-toggle" type="checkbox" title="<?=_('Select')?>" name="user[]" value="<?=$key?>">
103103
</div>
104-
<div class="clearfix l-unit__stat-col--left wide-3 userlist-username">
104+
<div class="clearfix l-unit__stat-col--left wide-3 userlist-username">
105105
<? if ($key == $user) { ?>
106106
<b><a href="/edit/user/?user=<?=$key?>&token=<?=$_SESSION['token']?>" title="<?=_('Editing User')?>"><?=$key?> <span style="font-weight: normal !important;">(<?php echo $data[$key]['NAME'];?>)</span></b></a>
107107
<? } else { ?>

0 commit comments

Comments
 (0)