More cleanup with _usr_list

This commit is contained in:
John Crisp 2025-05-01 18:11:13 +02:00
parent ab587d4944
commit 43f790de99
2 changed files with 43 additions and 32 deletions

View File

@ -49,29 +49,32 @@
% foreach my $user (@$users) {
% my $username = $user->key();
% my $first = $user->prop('FirstName');
% my $last = $user->prop('LastName');
% my $lockable = $user->prop('Lockable') || 'yes';
% my $removable = $user->prop('Removable') || 'yes';
% my $fwd = (($user->prop('EmailForward') || 'local') =~ m/^forward|both$/) ?
% $user->prop('ForwardAddress') : '';
% my $vpnaccess = $user->prop('VPNClientAccess') || 'no';
% $vpnaccess = $vpnaccess eq 'yes' ? $c->l('YES') : $c->l('NO');
% my $password_set = $user->prop('PasswordSet');
% my $username = $user->key();
% my $first = $user->prop('FirstName');
% my $last = $user->prop('LastName');
% my $lockable = $user->prop('Lockable') || 'yes';
% my $removable = $user->prop('Removable') || 'yes';
% my $fwd = (($user->prop('EmailForward') || 'local') =~ m/^forward|both$/) ?
% $user->prop('ForwardAddress') : '';
% my $vpnaccess = $user->prop('VPNClientAccess') || 'no';
% $vpnaccess = $vpnaccess eq 'yes' ? $c->l('YES') : $c->l('NO');
% my $password_set = $user->prop('PasswordSet');
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $modify_text = l('MODIFY'); # Localized text
% my $remove_text = l('REMOVE'); # Localized text
% my $password_text = l("PASSWORD_RESET");
% my $lock_text = l('usr_LOCK'); # Localized text
% my $roundcube_text = l('Webmail'); # Localized text
% my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = ' ';
% my $thisdomain = $c->req->url->to_abs->host;
<tr>
<td><%= $username %></td>
<td><%=$first %>&nbsp<%=$last %></td>
<td><%= $vpnaccess %></td>
<td><%= $fwd %></td>
% my ($actionModify, $actionLock, $actionResetPw, $actionRemove,$actionroundcube) = '&nbsp;';
% my $modify_text = l('MODIFY'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
% my $password_text = l("PASSWORD_RESET");
% if ($useraccounts_user_name eq 'admin') {
%$actionModify = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=UPS&user=$useraccounts_user_name">
@ -99,18 +102,26 @@
% if ($password_set ne 'yes') {
%$actionLock = l('ACCOUNT_LOCKED');
%$actionResetPw = qq{
<!-- Needs a fix here -->
%#$actionLock = l('ACCOUNT_LOCKED');
<!-- Sets BOTH columns - possibly leave out Reset Password here?-->
%$actionLock = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
% <button type='button' class="btn btn-primary" title="$password_text - currently unset" style = background:pink; >
% $password_text
% <button type='button' class="btn btn-danger" title="$password_text - currently unset">
% Unlock
% </button>
%</a>
%};
%};
%$actionResetPw = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=PWD&user=$useraccounts_user_name">
% <button type='button' class="btn btn-primary" title="$password_text - currently unset">
% $password_text
% </button>
%</a>
%};
% } elsif ($useraccounts_user_name ne 'admin') {
% my $lock_text = l('usr_LOCK'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
%$actionLock = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=LCK&user=$useraccounts_user_name">
% <button type='button' class="btn btn-primary" title='$lock_text' >
@ -128,8 +139,6 @@
% }
% if ( $removable eq 'yes' ) {
% my $remove_text = l('REMOVE'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
%$actionRemove = qq{
%<a href="useraccountsd?CsrfDef=$csrf_token&trt=DEL&user=$useraccounts_user_name">
% <button type='button' class="btn btn-primary" title='$remove_text' >
@ -139,10 +148,7 @@
%};
% }
% my $thisdomain = $c->req->url->to_abs->host;
% my $roundcube_text = l('Webmail'); # Localized text
% $csrf_token = "TOKEN"; # CSRF token for security
% $useraccounts_user_name = $user->key; # useraccountss_entry name extracted from the data structure
<!-- If webmail disabled??? -->
% $actionroundcube = qq{
%<a href="roundcubepanel?CsrfDef=$csrf_token&url=https://$thisdomain/roundcube?_user=$useraccounts_user_name&height=600px">
% <button type='button' class="btn btn-primary" title='$roundcube_text' >
@ -150,6 +156,7 @@
% </button>
%</a>
%};
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionResetPw) %></td>
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionLock) %></td>

View File

@ -1,6 +1,6 @@
%define name smeserver-manager-AdminLTE
%define version 11.0.0
%define release 17
%define release 18
Summary: AdminLTE is an html framework for admin consoles - this rpm adds it to smeserver manager2
Name: %{name}
Version: %{version}
@ -26,6 +26,10 @@ AdminLTE is an html framework for admin consoles
wget https://github.com/ColorlibHQ/AdminLTE/archive/master.zip
%changelog
* Thu May 01 2025 John Crisp <jcrisp@safeandsoundit.co.uk> 11.0.0-18.sme
- Trying to make _user_list more logical. Needs 'UNLOCK' translation
- Big cleanup of dupplicate % my= but needs more work
* Thu May 01 2025 John Crisp <jcrisp@safeandsoundit.co.uk> 11.0.0-17.sme
- Convert tabs to spaces for consistency
- Fix group update container