Skip to content

Commit 319e874

Browse files
authored
Fix/change default value true to yes for three POLICY_USER directives (hestiacp#3998)
* Modify three POLICY_USER values to use yes instead of true Modified directives are: POLICY_USER_CHANGE_THEME POLICY_USER_EDIT_WEB_TEMPLATES POLICY_USER_VIEW_LOGS * Fix default values for three POLICY_USER directives In hestia.conf and defaults/hestia.conf, modify existing POLICY_USER directives (POLICY_USER_CHANGE_THEME, POLICY_USER_EDIT_WEB_TEMPLATES and POLICY_USER_VIEW_LOGS) that are using value 'true' instead of the correct value 'yes'
1 parent 05f066a commit 319e874

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

func/syshealth.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ function syshealth_repair_system_config() {
403403
# Theme editor
404404
if [[ -z $(check_key_exists 'POLICY_USER_CHANGE_THEME') ]]; then
405405
echo "[ ! ] Adding missing variable to hestia.conf: POLICY_USER_CHANGE_THEME ('yes')"
406-
$BIN/v-change-sys-config-value "POLICY_USER_CHANGE_THEME" "true"
406+
$BIN/v-change-sys-config-value "POLICY_USER_CHANGE_THEME" "yes"
407407
fi
408408
# Protect admin user
409409
if [[ -z $(check_key_exists 'POLICY_SYSTEM_PROTECTED_ADMIN') ]]; then
@@ -428,12 +428,12 @@ function syshealth_repair_system_config() {
428428
# Allow users to edit web templates
429429
if [[ -z $(check_key_exists 'POLICY_USER_EDIT_WEB_TEMPLATES') ]]; then
430430
echo "[ ! ] Adding missing variable to hestia.conf: POLICY_USER_EDIT_WEB_TEMPLATES ('yes')"
431-
$BIN/v-change-sys-config-value "POLICY_USER_EDIT_WEB_TEMPLATES" "true"
431+
$BIN/v-change-sys-config-value "POLICY_USER_EDIT_WEB_TEMPLATES" "yes"
432432
fi
433433
# View user logs
434434
if [[ -z $(check_key_exists 'POLICY_USER_VIEW_LOGS') ]]; then
435435
echo "[ ! ] Adding missing variable to hestia.conf: POLICY_USER_VIEW_LOGS ('yes')"
436-
$BIN/v-change-sys-config-value "POLICY_USER_VIEW_LOGS" "true"
436+
$BIN/v-change-sys-config-value "POLICY_USER_VIEW_LOGS" "yes"
437437
fi
438438
# Allow users to login (read only) when suspended
439439
if [[ -z $(check_key_exists 'POLICY_USER_VIEW_SUSPENDED') ]]; then

install/upgrade/versions/1.8.8.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.8.8
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
####### upgrade_config_set_value only accepts true or false. #######
9+
####### #######
10+
####### Pass through information to the end user in case of a issue or problem #######
11+
####### #######
12+
####### Use add_upgrade_message "My message here" to include a message #######
13+
####### in the upgrade notification email. Example: #######
14+
####### #######
15+
####### add_upgrade_message "My message here" #######
16+
####### #######
17+
####### You can use \n within the string to create new lines. #######
18+
#######################################################################################
19+
20+
upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'false'
21+
upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'false'
22+
upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'false'
23+
upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'false'
24+
upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'false'
25+
26+
# Modify existing POLICY_USER directives (POLICY_USER_CHANGE_THEME, POLICY_USER_EDIT_WEB_TEMPLATES
27+
# and POLICY_USER_VIEW_LOGS) that are using value 'true' instead of the correct value 'yes'
28+
29+
hestia_conf="$HESTIA/conf/hestia.conf"
30+
hestia_defaults_conf="$HESTIA/conf/defaults/hestia.conf"
31+
32+
for i in POLICY_USER_CHANGE_THEME POLICY_USER_EDIT_WEB_TEMPLATES POLICY_USER_VIEW_LOGS; do
33+
if [[ -f "$hestia_conf" ]]; then
34+
if grep "$i" "$hestia_conf" | grep -q 'true'; then
35+
if "$BIN/v-change-sys-config-value" "$i" 'yes'; then
36+
echo "[ * ] Success: ${i} value changed from true to yes in hestia.conf"
37+
else
38+
echo "[ ! ] Error: Couldn't change ${i} value from true to yes in hestia.conf"
39+
fi
40+
fi
41+
fi
42+
if [[ -f "$hestia_defaults_conf" ]]; then
43+
if grep "$i" "$hestia_defaults_conf" | grep -q 'true'; then
44+
if sed -i "s/${i}='true'/${i}='yes'/" "$hestia_defaults_conf"; then
45+
echo "[ * ] Success: ${i} value changed from true to yes in defaults/hestia.conf"
46+
else
47+
echo "[ ! ] Error: Couldn't change ${i} value from true to yes in defaults/hestia.conf"
48+
fi
49+
fi
50+
fi
51+
done

0 commit comments

Comments
 (0)