* Mon Oct 06 2025 Brian Read <brianr@koozali.org> 11.0.0-5.sme

- Add UTF8 and avoid potential DB caching problems [SME: 13209]
This commit is contained in:
2025-10-06 20:07:53 +01:00
parent 22e28b97b1
commit b9a151c128
3 changed files with 42 additions and 37 deletions

View File

@@ -7,11 +7,11 @@
# #
use esmith::util; use esmith::util;
use esmith::util::network; use esmith::util::network;
use esmith::ConfigDB; use esmith::ConfigDB::UTF8;
use esmith::HostsDB; use esmith::HostsDB::UTF8;
use esmith::AccountsDB; use esmith::AccountsDB::UTF8;
use esmith::NetworksDB; use esmith::NetworksDB;
use esmith::DomainsDB; use esmith::DomainsDB::UTF8;
use constant FALSE => 0; use constant FALSE => 0;
use constant TRUE => 1; use constant TRUE => 1;
@@ -82,7 +82,7 @@ use constant users_FIELD_MAPPING => (
sub actual_users { sub actual_users {
my @ret = (); my @ret = ();
my $adb = esmith::AccountsDB->open() or die("Couldn't open Accounts db"); my $adb = esmith::AccountsDB::UTF8->open() or die("Couldn't open Accounts db");
# Optionally add the local admin user # Optionally add the local admin user
push @ret, { push @ret, {
@@ -138,7 +138,7 @@ use constant panels_FIELD_MAPPING => (
sub actual_panels { sub actual_panels {
my $c = shift; my $c = shift;
my %usp_data = shift; my %usp_data = shift;
my $adb = esmith::AccountsDB->open() or die("Couldn't open Accounts db"); my $adb = esmith::AccountsDB::UTF8->open() or die("Couldn't open Accounts db");
my $accounts_key = $c->param('Selected'); my $accounts_key = $c->param('Selected');
# Pass it back to the template and then back to the perform routine via a hidden field # Pass it back to the template and then back to the perform routine via a hidden field
$c->stash(accounts_key=>$accounts_key); $c->stash(accounts_key=>$accounts_key);
@@ -259,7 +259,7 @@ sub get_panels {
my $AdminPanels = join(',', @selected); my $AdminPanels = join(',', @selected);
#$c->log->info("Selected IDs: $joined"); #$c->log->info("Selected IDs: $joined");
#Write back to the property AdminPanels #Write back to the property AdminPanels
my $adb = esmith::AccountsDB->open() or die("Couldn't open Accounts db"); my $adb = esmith::AccountsDB::UTF8->open() or die("Couldn't open Accounts db");
my $accounts_key = $c->param('accounts_key'); #hidden field in form my $accounts_key = $c->param('accounts_key'); #hidden field in form
#$c->log->info("AccKey: $accounts_key"); #$c->log->info("AccKey: $accounts_key");
$adb->set_prop($accounts_key,'AdminPanels',$AdminPanels); $adb->set_prop($accounts_key,'AdminPanels',$AdminPanels);

View File

@@ -36,11 +36,11 @@ use Data::Dumper;
use esmith::util; use esmith::util;
use esmith::util::network; use esmith::util::network;
use esmith::ConfigDB; use esmith::ConfigDB::UTF8;
use esmith::AccountsDB; use esmith::AccountsDB::UTF8;
use esmith::NetworksDB; use esmith::NetworksDB;
use esmith::HostsDB; use esmith::HostsDB::UTF8;
use esmith::DomainsDB; use esmith::DomainsDB::UTF8;
my $cdb; my $cdb;
my $adb; my $adb;
@@ -66,11 +66,11 @@ sub main {
$c->app->log->info( $c->log_req ); $c->app->log->info( $c->log_req );
#The most common ones #The most common ones
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
my %usp_data = (); my %usp_data = ();
my $title = $c->l('usp_User_panel_access_'); my $title = $c->l('usp_User_panel_access_');
@@ -118,25 +118,26 @@ sub do_update {
my $modul = ''; my $modul = '';
#The most common ones - you might want to comment out any not used. #The most common ones - you might want to comment out any not used.
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
my %usp_data = (); my %usp_data = ();
my $title = $c->l('usp_User_panel_access_'); my $title = $c->l('usp_User_panel_access_');
# Accessing all POST/GET parameters # Accessing all POST/GET parameters
my $params = $c->req->params->to_hash; my %params = %{ $c->req->params->to_hash };
# Get number of POST parameters # Get number of POST parameters correctly
#my $num_params = keys scaler %$params; my $num_params = keys %params;
# Copy params safely
while (my ($key, $value) = each %params) {
$usp_data{$key} = $value;
}
#Params are available in the hash "params" - copy to the prefix_data hash
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
# $usp_data{$key} = $value;
#}
# the value of trt will tell you which panel has returned # the value of trt will tell you which panel has returned
my $trt = $c->param('trt') || 'USERTABLE'; #hidden control on every form. my $trt = $c->param('trt') || 'USERTABLE'; #hidden control on every form.
@@ -225,18 +226,19 @@ sub do_display {
$c->app->log->info($c->log_req); $c->app->log->info($c->log_req);
#The most common ones - you might want to comment out any not used. #The most common ones - you might want to comment out any not used.
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db");
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db");
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
my %usp_data = (); my %usp_data = ();
my $title = $c->l('usp_User_panel_access_'); my $title = $c->l('usp_User_panel_access_');
my $modul = ""; my $modul = "";
# Accessing all parameters # Accessing all parameters
my %params = $c->req->params->to_hash;
my %params = %{$c->req->params->to_hash};
# Get number of parameters # Get number of parameters
my $num_params = keys %params; my $num_params = keys %params;
@@ -245,9 +247,9 @@ sub do_display {
my $is_new_record = ($c->req->method() eq 'POST'); my $is_new_record = ($c->req->method() eq 'POST');
#Params are available in the hash "params" - copy to the prefix_data hash #Params are available in the hash "params" - copy to the prefix_data hash
#while (my ($key, $value) = each %{$c->req->params->to_hash}) { while (my ($key, $value) = each %{$c->req->params->to_hash}) {
# $usp_data{$key} = $value; $usp_data{$key} = $value;
#} }
# the value of trt will tell you which panel has returned # the value of trt will tell you which panel has returned
if (! $trt){ if (! $trt){

View File

@@ -6,7 +6,7 @@ Summary: Panels to let users to change server settings.
%define name smeserver-userpanels %define name smeserver-userpanels
Name: %{name} Name: %{name}
%define version 11.0.0 %define version 11.0.0
%define release 4 %define release 5
Version: %{version} Version: %{version}
Release: %{release}%{?dist} Release: %{release}%{?dist}
License: GNU GPL version 2 License: GNU GPL version 2
@@ -26,6 +26,9 @@ Change password,Forward mail, Backup users home directory,
Delegate creation of users with restrictions. Delegate creation of users with restrictions.
%changelog %changelog
* Mon Oct 06 2025 Brian Read <brianr@koozali.org> 11.0.0-5.sme
- Add UTF8 and avoid potential DB caching problems [SME: 13209]
* Sat Oct 04 2025 Brian Read <brianr@koozali.org> 11.0.0-4.sme * Sat Oct 04 2025 Brian Read <brianr@koozali.org> 11.0.0-4.sme
- Delete en.pm and create .lex file if needed [SME: 13214] - Delete en.pm and create .lex file if needed [SME: 13214]