Przeglądaj źródła

Add UI switches and update backend

Kristan Kenney 5 lat temu
rodzic
commit
6128d1df8d

+ 0 - 1
bin/v-delete-user-backup

@@ -33,7 +33,6 @@ check_args '2' "$#" 'USER BACKUP'
 is_format_valid 'user' 'backup'
 is_format_valid 'user' 'backup'
 is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM'
 is_system_enabled "$BACKUP_SYSTEM" 'BACKUP_SYSTEM'
 is_object_valid 'user' 'USER' "$user"
 is_object_valid 'user' 'USER' "$user"
-is_object_unsuspended 'user' 'USER' "$user"
 is_object_valid 'backup' 'BACKUP' "$2"
 is_object_valid 'backup' 'BACKUP' "$2"
 
 
 # Perform verification if read-only mode is enabled
 # Perform verification if read-only mode is enabled

+ 1 - 0
bin/v-suspend-user

@@ -42,6 +42,7 @@ check_hestia_demo_mode
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
+
 # Do not restrict access to SFTP/FTP/SSH if POLICY_USER_VIEW_SUSPENDED is set to yes
 # Do not restrict access to SFTP/FTP/SSH if POLICY_USER_VIEW_SUSPENDED is set to yes
 if [ -z "$POLICY_USER_VIEW_SUSPENDED" ] || [ "$POLICY_USER_VIEW_SUSPENDED" = 'no' ]; then
 if [ -z "$POLICY_USER_VIEW_SUSPENDED" ] || [ "$POLICY_USER_VIEW_SUSPENDED" = 'no' ]; then
     # Adding '!' in front of the password
     # Adding '!' in front of the password

+ 10 - 7
bin/v-unsuspend-user

@@ -41,13 +41,16 @@ check_hestia_demo_mode
 #                       Action                             #
 #                       Action                             #
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 
 
-# Deleting '!' in front of the password
-/usr/sbin/usermod --unlock $user
-
-# Unsuspending ftp accounts
-for ftp in $(grep "^${user}_" /etc/passwd |cut -f 1 -d : ); do
-    /usr/sbin/usermod --unlock $ftp 2>/dev/null
-done
+# Do not restrict access to SFTP/FTP/SSH if POLICY_USER_VIEW_SUSPENDED is set to yes
+if [ -z "$POLICY_USER_VIEW_SUSPENDED" ] || [ "$POLICY_USER_VIEW_SUSPENDED" = 'no' ]; then
+    # Deleting '!' in front of the password
+    /usr/sbin/usermod --unlock $user
+
+    # Unsuspending ftp accounts
+    for ftp in $(grep "^${user}_" /etc/passwd |cut -f 1 -d : ); do
+        /usr/sbin/usermod --unlock $ftp 2>/dev/null
+    done
+fi
 
 
 # Changing suspend value
 # Changing suspend value
 update_user_value "$user" '$SUSPENDED' 'no'
 update_user_value "$user" '$SUSPENDED' 'no'

+ 11 - 0
web/edit/server/index.php

@@ -750,6 +750,17 @@ if (!empty($_POST['save'])) {
         }
         }
     }
     }
 
 
+    // Change POLICY_USER_VIEW_SUSPENDED
+    if (empty($_SESSION['error_msg'])) {
+        if ($_POST['v_policy_user_view_suspended'] != $_SESSION['POLICY_USER_VIEW_SUSPENDED']) {
+            exec (HESTIA_CMD."v-change-sys-config-value POLICY_USER_VIEW_SUSPENDED ".escapeshellarg($_POST['v_policy_user_view_suspended']), $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);
+            if (empty($_SESSION['error_msg'])) $v_policy_system_hide_admin = $_POST['v_policy_user_view_suspended'];
+            $v_security_adv = 'yes';
+        }
+    }
+
     // Change POLICY_USER_CHANGE_THEME
     // Change POLICY_USER_CHANGE_THEME
     if (empty($_SESSION['error_msg'])) {
     if (empty($_SESSION['error_msg'])) {
         if ($_POST['v_policy_user_change_theme'] == 'on') { $_POST['v_policy_user_change_theme'] = 'no'; } else { $_POST['v_policy_user_change_theme'] = 'yes'; } {
         if ($_POST['v_policy_user_change_theme'] == 'on') { $_POST['v_policy_user_change_theme'] = 'no'; } else { $_POST['v_policy_user_change_theme'] = 'yes'; } {

+ 16 - 2
web/templates/pages/edit_server.html

@@ -1059,7 +1059,7 @@
                                                         </tr>
                                                         </tr>
                                                         <tr>
                                                         <tr>
                                                             <td class="vst-text input-label">
                                                             <td class="vst-text input-label">
-                                                                <?php print _('Disable Server Settings access for other administrators');?>
+                                                                <?php print _('Do not allow other administrators to access Server Settings');?>
                                                             </td>
                                                             </td>
                                                         </tr>
                                                         </tr>
                                                         <tr>
                                                         <tr>
@@ -1091,7 +1091,21 @@
                                                             <?=_('Users');?>
                                                             <?=_('Users');?>
                                                         </td>
                                                         </td>
                                                         
                                                         
-                                                    </tr>
+                                            </tr>
+                                              <tr>
+                                            <td class="vst-text input-label">
+                                                <?php print _('Allow suspended users to log in with read-only access');?>
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>
+                                                <select class="vst-list" name="v_policy_user_view_suspended">
+                                                    <option value='yes' <?php if($_SESSION['POLICY_USER_VIEW_SUSPENDED'] !== 'no') echo 'selected' ?>><?php print _('yes'); ?></option>
+                                                    <option value='no' <?php if($_SESSION['POLICY_USER_VIEW_SUSPENDED'] == 'no') echo 'selected' ?>><?php print _('no'); ?></option>
+                                                </select>
+                                                <br><br>
+                                            </td>
+                                        </tr>
                                         <tr>
                                         <tr>
                                             <td class="vst-text input-label">
                                             <td class="vst-text input-label">
                                                 <?php print _('Allow users to edit their account details');?>
                                                 <?php print _('Allow users to edit their account details');?>