Skip to content

Commit 6128d1d

Browse files
author
Kristan Kenney
committed
Add UI switches and update backend
1 parent 8fa8f91 commit 6128d1d

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed

bin/v-delete-user-backup

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ check_args '2' "$#" 'USER BACKUP'
3333
is_format_valid 'user' 'backup'
3434
is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM'
3535
is_object_valid 'user' 'USER' "$user"
36-
is_object_unsuspended 'user' 'USER' "$user"
3736
is_object_valid 'backup' 'BACKUP' "$2"
3837

3938
# Perform verification if read-only mode is enabled

bin/v-suspend-user

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ check_hestia_demo_mode
4242
#----------------------------------------------------------#
4343
# Action #
4444
#----------------------------------------------------------#
45+
4546
# Do not restrict access to SFTP/FTP/SSH if POLICY_USER_VIEW_SUSPENDED is set to yes
4647
if [ -z "$POLICY_USER_VIEW_SUSPENDED" ] || [ "$POLICY_USER_VIEW_SUSPENDED" = 'no' ]; then
4748
# Adding '!' in front of the password

bin/v-unsuspend-user

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,16 @@ check_hestia_demo_mode
4141
# Action #
4242
#----------------------------------------------------------#
4343

44-
# Deleting '!' in front of the password
45-
/usr/sbin/usermod --unlock $user
46-
47-
# Unsuspending ftp accounts
48-
for ftp in $(grep "^${user}_" /etc/passwd |cut -f 1 -d : ); do
49-
/usr/sbin/usermod --unlock $ftp 2>/dev/null
50-
done
44+
# Do not restrict access to SFTP/FTP/SSH if POLICY_USER_VIEW_SUSPENDED is set to yes
45+
if [ -z "$POLICY_USER_VIEW_SUSPENDED" ] || [ "$POLICY_USER_VIEW_SUSPENDED" = 'no' ]; then
46+
# Deleting '!' in front of the password
47+
/usr/sbin/usermod --unlock $user
48+
49+
# Unsuspending ftp accounts
50+
for ftp in $(grep "^${user}_" /etc/passwd |cut -f 1 -d : ); do
51+
/usr/sbin/usermod --unlock $ftp 2>/dev/null
52+
done
53+
fi
5154

5255
# Changing suspend value
5356
update_user_value "$user" '$SUSPENDED' 'no'

web/edit/server/index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,17 @@
750750
}
751751
}
752752

753+
// Change POLICY_USER_VIEW_SUSPENDED
754+
if (empty($_SESSION['error_msg'])) {
755+
if ($_POST['v_policy_user_view_suspended'] != $_SESSION['POLICY_USER_VIEW_SUSPENDED']) {
756+
exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_VIEW_SUSPENDED ".escapeshellarg($_POST['v_policy_user_view_suspended']), $output, $return_var);
757+
check_return_code($return_var,$output);
758+
unset($output);
759+
if (empty($_SESSION['error_msg'])) $v_policy_system_hide_admin = $_POST['v_policy_user_view_suspended'];
760+
$v_security_adv = 'yes';
761+
}
762+
}
763+
753764
// Change POLICY_USER_CHANGE_THEME
754765
if (empty($_SESSION['error_msg'])) {
755766
if ($_POST['v_policy_user_change_theme'] == 'on') { $_POST['v_policy_user_change_theme'] = 'no'; } else { $_POST['v_policy_user_change_theme'] = 'yes'; } {

web/templates/pages/edit_server.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@
10591059
</tr>
10601060
<tr>
10611061
<td class="vst-text input-label">
1062-
<?php print _('Disable Server Settings access for other administrators');?>
1062+
<?php print _('Do not allow other administrators to access Server Settings');?>
10631063
</td>
10641064
</tr>
10651065
<tr>
@@ -1091,7 +1091,21 @@
10911091
<?=_('Users');?>
10921092
</td>
10931093

1094-
</tr>
1094+
</tr>
1095+
<tr>
1096+
<td class="vst-text input-label">
1097+
<?php print _('Allow suspended users to log in with read-only access');?>
1098+
</td>
1099+
</tr>
1100+
<tr>
1101+
<td>
1102+
<select class="vst-list" name="v_policy_user_view_suspended">
1103+
<option value='yes' <?php if($_SESSION['POLICY_USER_VIEW_SUSPENDED'] !== 'no') echo 'selected' ?>><?php print _('yes'); ?></option>
1104+
<option value='no' <?php if($_SESSION['POLICY_USER_VIEW_SUSPENDED'] == 'no') echo 'selected' ?>><?php print _('no'); ?></option>
1105+
</select>
1106+
<br><br>
1107+
</td>
1108+
</tr>
10951109
<tr>
10961110
<td class="vst-text input-label">
10971111
<?php print _('Allow users to edit their account details');?>

0 commit comments

Comments
 (0)