More groups pseudonyms clamav and useraccounts work

This commit is contained in:
John Crisp 2025-05-15 20:32:05 +02:00
parent e7f8f7b289
commit f90583b285
11 changed files with 262 additions and 278 deletions

View File

@ -11,54 +11,49 @@
(DBG)Quar stat: <%=$clm_datas->{Quarantine} %>
</div>
% }
<h1><%= $title %></h1>
<br>
<%= $modul %>
<% my $btn = l('SAVE'); %>
<form action="/smanager/hostentriesd" method="POST">
%#= form_for 'clamav' => (method => 'POST') => begin
<div>
<div>
<%= l 'clm_LABEL_FILESYSTEM_SCAN_PERIOD' %>
</div>
<div>
% param 'FilesystemScan' => $clm_datas->{FilesystemScan} unless param 'FilesystemScan';
<%= select_field 'FilesystemScan' => [[ (l 'clm_DAILY') => 'daily'], [ (l 'clm_NEVER') => 'disabled'], [ (l 'clm_WEEKLY') => 'weekly']] %>
<%= $modul %>
<% my $btn = l('SAVE'); %>
<br><br>
<form action="/smanager/clamav" method="POST">
<div class="row g-3 align-items-center">
<div class="col-auto">
<h6><%= l 'clm_LABEL_FILESYSTEM_SCAN_PERIOD' %>:</h6>
% param 'FilesystemScan' => $clm_datas->{FilesystemScan} unless param 'FilesystemScan';
<%= select_field 'FilesystemScan' => [[ (l 'clm_DAILY') => 'daily'], [ (l 'clm_NEVER') => 'disabled'], [ (l 'clm_WEEKLY') => 'weekly']], class => "form-select" %>
</div>
</div>
<div>
<div>
<%= l 'clm_LABEL_QUARANTINE' %>
</div>
<div>
<br>
<div class="row g-3 align-items-center">
<br>
<div class="col-auto">
<h6><%= l 'clm_LABEL_QUARANTINE' %>:</h6>
% param 'Quarantine' => $clm_datas->{Quarantine} unless param 'Quarantine';
<%= select_field 'Quarantine' => [[ (l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']] %>
<%= select_field 'Quarantine' => [[ (l 'ENABLED') => 'enabled'], [ (l 'DISABLED') => 'disabled']], class => "form-select" %>
<br>
</div>
</div>
<div>
<div>
<%= l 'clm_LABEL_CLAM_VERSIONS' %>
<h6><%= l 'clm_LABEL_CLAM_VERSIONS' %>:</h6>
</div>
<div>
<%= $clm_datas->{clam_versions} %>
<br>
</div>
</div>
<br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
</div>
</div>
%#end
</form>
</div>
%end

View File

@ -5,29 +5,29 @@
<div class="card-body">
% if (config->{debug} == 1) {
<p>
%= dumper $c->current_route
%= dumper $grp_datas
</p>
<div>
%= dumper $c->current_route
%= dumper $grp_datas
</div>
% }
% if ( stash 'error' ) {
<br><div class="">
%= $c->render_to_string(inline => stash 'error')
</div>
%}
<div class="text-danger">
<%= $c->render_to_string(inline => stash 'error') %>
</div>
% }
<h1><%= $title%></h1>
% if ($grp_datas->{trt} eq 'ADD') {
%= include 'partials/_grp_add'
%} elsif ($grp_datas->{trt} eq 'DEL') {
%= include 'partials/_grp_add'
% } elsif ($grp_datas->{trt} eq 'DEL') {
%= include 'partials/_grp_del'
%} elsif ($grp_datas->{trt} eq 'UPD') {
% } elsif ($grp_datas->{trt} eq 'UPD') {
%= include 'partials/_grp_upd'
%} else {
% } else {
%= include 'partials/_grp_list'
%}
% }
</div>
%end

View File

@ -1,4 +1,4 @@
<div class="container-sm">
<div>
<br>
<!-- <h2><%#= l 'grp_FORM_TITLE' %></h2> -->
@ -7,10 +7,10 @@
<%= l 'grp_GROUP_NAMING' %>
<br><br>
% my $btn = l('ADD');
% my $btn = l('ADD');
<form action="/smanager/groups2" method="POST">
<div class="row g-3 align-items-center">
<div class="col-md-2">
<label for="inputGroupName" class="col-form-label"><%= l 'GROUP_NAME' %></label>
@ -24,13 +24,13 @@
</span>
</div>
</div>
<br><br>
<%= l 'grp_GROUP_DESC_EXPL' %>
<br><br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<label for="inputGroupDesc" class="col-form-label"><%= l 'grp_GROUP_DESC' %></label>
@ -44,30 +44,30 @@
</span>
</div>
</div>
<br>
<div>
<%= l 'GROUP_MEMBERS' %>
<%= l 'GROUP_MEMBERS' %>
</div>
<br>
<div>
%= check_box 'groupMembers' => 'admin'
<%= check_box 'groupMembers' => 'admin' %>
&nbspAdministrator (admin)
<br>
% my $users = $c->gen_users_list();
% foreach my $key ( sort keys %$users ) {
%= check_box 'groupMembers' => $key
&nbsp
%= $users->{$key}
%= $users->{$key}
%= " (" . $key . ")"
<br>
% }
</div>
<br><br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>

View File

@ -1,28 +1,28 @@
<div class="container-sm">
<div>
% my $btn = l('REMOVE');
<form action="/smanager/groups2" method="POST">
<br><br>
<h2><%=l 'REMOVE_USER_GROUP' %></h2>
<br>
<%=l('grp_DELETE_DESCRIPTION', $grp_datas->{group}) %>
<br><br>
<div>
% my $size = keys %$members;
% if ( ! $size ){
%= l 'ACCOUNT_GROUP_NONE'
% } else {
%= l 'grp_GROUP_HAS_MEMBERS'
<br><br>
<ul>
% foreach my $key ( keys %$members) {
<li>
@ -32,15 +32,15 @@
% }
</ul>
% }
</div>
<br><br>
<div>
% $size = keys %$ibays;
% if ( $size ) {
%=l 'grp_IBAYS_WILL_BE_CHANGED'
<br>
@ -56,16 +56,16 @@
</ul>
% }
</div>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
</div>
</div>
%= hidden_field 'trt' => $grp_datas->{trt}
%= hidden_field 'groupName' => $grp_datas->{group}
</form>
</div>

View File

@ -6,68 +6,64 @@
%#= form_for '/groups' => (method => 'POST') => begin
%= hidden_field 'trt' => 'ADD'
<br>
<div>
<button type="submit" class="btn btn-primary"><%= $btn %> </button>
</div>
</form>
%# end
%# end
<br>
<h2><%=l 'grp_CURRENT_LIST' %></h2>
<br><br>
% my $numGroups = @$groups;
% my $numGroups = @$groups;
% if ($numGroups == 0){
%=l 'ACCOUNT_GROUP_NONE'
% } else {
<table class="table table-bordered user-table-max-wdith">
<thead>
<tr>
<th class="col-sm"><%= l 'GROUP' %></th>
<th class="col-sm"><%= l 'DESCRIPTION' %></th>
<th class="user-valign-center col-sm" colspan="2"><%= l 'ACTION' %></th>
</tr>
</thead>
<tbody>
<%= l 'ACCOUNT_GROUP_NONE' %>
% } else {
<table class="table table-bordered user-table-max-width">
<thead>
<tr>
<th class="col-sm"><%= l 'GROUP' %></th>
<th class="col-sm"><%= l 'DESCRIPTION' %></th>
<th class="col-sm user-valign-center" colspan="2"><%= l 'ACTION' %></th>
</tr>
</thead>
<tbody>
% foreach my $group ( @$groups ) {
<tr>
<td><%= $group->key %></td>
<td><%= $group->prop('Description') %></td>
% foreach my $group ( @$groups )
% {
<tr>
<td><%= $group->key %></td>
<td><%= $group->prop('Description') %></td>
% my $modify_text = l('MODIFY'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $group_name = $group->key; # group name extracted from the data structure
% my $actionModify = qq{
% <a href="groups2?CsrfDef=$csrf_token&trt=UPD&group=$group_name">
% <button type='button' class="btn btn-primary" title='$modify_text' >
% $modify_text
% </button>
% </a>
%};
% my $remove_text = l('REMOVE'); # Localized text
% my $csrf_token = "TOKEN"; # CSRF token for security
% my $group_name = $group->key; # group name extracted from the data structure
% my $actionRemove = qq{
% <a href="groups2?CsrfDef=$csrf_token&trt=DEL&group=$group_name">
% <button type='button' class="btn btn-primary" title='$remove_text' >
% $remove_text
% </button>
% </a>
%};
%my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $group_name = $group->key; # group name extracted from the data structure
%my $actionModify = qq{
%<a href="groups2?CsrfDef=$csrf_token&trt=UPD&group=$group_name">
% <button type='button' class="btn btn-primary" title='$modify_text' >
% $modify_text
% </button>
%</a>
%};
%my $remove_text = l('REMOVE'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $group_name = $group->key; # group name extracted from the data structure
%my $actionRemove = qq{
%<a href="groups2?CsrfDef=$csrf_token&trt=DEL&group=$group_name">
% <button type='button' class="btn btn-primary" title='$remove_text' >
% $remove_text
% </button>
%</a>
%};
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionRemove) %></td>
</tr>
% }
</tbody>
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionRemove) %></td>
</tr>
% }
</tbody>
</table>
<%} %>
% }
</div>

View File

@ -1,41 +1,48 @@
<div>
% my $btn = l('ADD');
%= form_for '/pseudonyms2' => (method => 'POST') => begin
<p>
<h2>
%=l 'pse_TITLE_CREATE'
</h2>
% my $btn = l('ADD');
<br>
%= $c->render_to_string(inline => l('pse_VALID_PSEUDONYM_NAMES'));
</p>
<h2><%= l 'pse_TITLE_CREATE' %></h2>
<br>
<form action="/smanager/pseudonyms2" method="POST">
<p>
<span class="">
%=l 'pse_PSEUDONYM_NAME', class => ""
</span>
<span class="">
%= text_field 'Pseudonym', class => ""
</span>
</p>
<div class="row g-3 align-items-center">
<div class="col-auto">
<%= $c->render_to_string(inline => l('pse_VALID_PSEUDONYM_NAMES')); %>
<br>
</div>
<br>
<div class="col-md-2">
<label for="inputPseudonymName" class="col-form-label"><%= l 'pse_PSEUDONYM_NAME' %></label>
</div>
<p>
<span class="">
%=l 'pse_SELECT_ACCOUNT', class => ""
</span>
<span class="">
%= select_field 'Account' => $c->existing_accounts_list(), class => ""
</span>
</p>
<div class="col-auto">
<input type="text" name="pseudonymDesc" id="inputPseudonymDesc" class="form-control" aria-describedby="PseudonymDesc" >
</div>
</div>
<p>
<br><br>
%= submit_button "$btn", class => ""
</p>
<br><br>
%= hidden_field 'trt' => $pse_datas->{trt}
% end
<div class="row g-3 align-items-center">
<div class="col-md-2">
<%=l 'pse_SELECT_ACCOUNT' %>
</div>
<div class="col-auto">
<%= select_field 'Account' => $c->existing_accounts_list(), class => "form-select" %>
</div>
</div>
<br><br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
</div>
</div>
%= hidden_field 'trt' => $pse_datas->{trt}
</form>
</div>

View File

@ -1,25 +1,30 @@
<div>
% my $btn = l('REMOVE');
%= form_for '/pseudonyms2' => (method => 'POST') => begin
<p>
<h2>
%=l 'pse_REMOVE_PSEUDONYM'
</h2>
% my $btn = l('REMOVE');
<p>
%= $c->render_to_string(inline => l('pse_ABOUT_TO_REMOVE', $pse_datas->{pseudonym}));
<form action="/smanager/pseudonyms2" method="POST">
<h2><%= l 'pse_REMOVE_PSEUDONYM' %></h2>
</p>
<%#= $c->render_to_string(inline => l('pse_ABOUT_TO_REMOVE', $pse_datas->{pseudonym})); %>
<p>
<br>
%= submit_button "$btn", class => ""
</p>
Thisis the old test that needs fixing in the language files
<%= l('pse_ABOUT_TO_REMOVE') %>
<br>
You are about to remove the pseudonym: <%= $pse_datas->{pseudonym} %>
<h6>Are you sure you wish to continue?</h6>
<br><br>
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
</div>
</div>
%= hidden_field 'trt' => $pse_datas->{trt}
%= hidden_field 'Pseudonym' => $pse_datas->{pseudonym}
% end
</form>
</div>

View File

@ -8,91 +8,81 @@
%= hidden_field 'trt' => 'ADD'
<p><br>
%= submit_button "$btn", class => ""
</p>
% end
<div class="row g-3 align-items-center">
<div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button>
</div>
</div>
% end
<br>
<h2><%= l 'pse_CURRENT_PSEUDONYMS' %></h2>
<br>
% my $numPseudonyms = @$pseudonyms;
% if ($numPseudonyms == 0) {
<%= l 'pse_ACCOUNT_PSEUDONYM_NONE' %>
% } else {
<table class="table table-bordered user-table-max-width">
<thead>
<tr>
<th class="col-sm"><%= l 'pse_PSEUDONYM' %></th>
<th class="col-sm"><%= l 'pse_USER_OR_GROUP' %></th>
<th class="col-sm user-valign-center" colspan="2"><%= l 'ACTION' %></th>
<!-- <th class="" style="display: normal;"></th> -->
</tr>
</thead>
<tbody>
<p><h2>
%=l 'pse_CURRENT_PSEUDONYMS'
</h2><br>
% my $numPseudonyms = @$pseudonyms;
% if ($numPseudonyms == 0){
%=l 'pse_ACCOUNT_PSEUDONYM_NONE'
% } else {
<table class="table table-bordered">
<thead>
<tr>
<th class="">
%=l 'pse_PSEUDONYM'
</th>
<th class="">
%=l 'pse_USER_OR_GROUP'
</th>
<th class="">
%=l 'ACTION'
</th>
% foreach my $pseudonym ( @$pseudonyms ) {
% my $modifiable = $pseudonym->prop('Changeable') || 'yes';
% my $removable = $pseudonym->prop('Removable') || 'yes';
<!-- <th class="" style="display: normal;"></th> -->
</tr>
</thead>
<tbody>
% my $account = $pseudonym->prop('Account');
% $account = "Administrator" if ($account eq "admin");
% $account = $c->l("pse_EVERYONE") if ($account eq "shared");
% foreach my $pseudonym ( @$pseudonyms )
% {
% my $modifiable = $pseudonym->prop('Changeable') || 'yes';
% my $removable = $pseudonym->prop('Removable') || 'yes';
% my $visible = $pseudonym->prop('Visible');
% $account .= $c->l("pse_LOCAL_ONLY")
% if (defined $visible && $visible eq "internal");
% my $account = $pseudonym->prop('Account');
% $account = "Administrator" if ($account eq "admin");
% $account = $c->l("pse_EVERYONE") if ($account eq "shared");
<tr>
<td><%= $pseudonym->key%></td>
<td><%= $account%></td>
% my $visible = $pseudonym->prop('Visible');
% $account .= $c->l("pse_LOCAL_ONLY")
% if (defined $visible && $visible eq "internal");
% my ($actionModify, $actionRemove) = '&nbsp;';
% if ($modifiable eq 'yes') {
%my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $pseudonyms_entry_name = $pseudonym->key; # pseudonyms_entry name extracted from the data structure
%$actionModify = qq{
% <a href="pseudonyms2?CsrfDef=$csrf_token&trt=UPD&pseudonym=$pseudonyms_entry_name">
% <button type='button' class="btn btn-primary" title='$modify_text' >
% $modify_text
% </button>
% </a>
%};
% }
<tr>
%= t td => (class => "") => $pseudonym->key
%= t td => (class => "") => $account
% if ($removable eq 'yes') {
%my $remove_text = l('REMOVE'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $pseudonyms_entry_name = $pseudonym->key; # pseudonyms_entry name extracted from the data structure
%$actionRemove = qq{
% <a href="pseudonyms2?CsrfDef=$csrf_token&trt=DEL&pseudonym=$pseudonyms_entry_name">
% <button type='button' class="btn btn-primary" title='$remove_text' >
% $remove_text
% </button>
% </a>
%};
% }
<td class="">
%my ($actionModify, $actionRemove) = '&nbsp;';
%if ($modifiable eq 'yes') {
%my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $pseudonyms_entry_name = $pseudonym->key; # pseudonyms_entry name extracted from the data structure
%$actionModify = qq{
% <a href="pseudonyms2?CsrfDef=$csrf_token&trt=UPD&pseudonym=$pseudonyms_entry_name">
% <button type='button' class="" title='$modify_text' >
% $modify_text
% </button>
% </a>
%};
%}
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
<td class="user-valign-center"><%= $c->render_to_string(inline => $actionRemove) %></td>
%if ($removable eq 'yes') {
%my $remove_text = l('REMOVE'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $pseudonyms_entry_name = $pseudonym->key; # pseudonyms_entry name extracted from the data structure
%$actionRemove = qq{
% <a href="pseudonyms2?CsrfDef=$csrf_token&trt=DEL&pseudonym=$pseudonyms_entry_name">
% <button type='button' class="" title='$remove_text' >
% $remove_text
% </button>
% </a>
%};
%}
<%= $c->render_to_string(inline => $actionModify) %> <%= $c->render_to_string(inline => $actionRemove) %>
</td>
</tr>
% }
</tbody>
</tr>
% }
</tbody>
</table>
<%} %>
</p>
% }
</div>

View File

@ -25,17 +25,15 @@
<form action="<%= $formUrl %>" method="POST" >
<div class="row g-3 align-items-center">
<div class="col-auto">
<label class="visually-hidden" for="inlineFormSelectPref">Preference</label>
%= select_field 'Theme' => $c->theme_list(), class => "form-select"
<!--<label class="visually-hidden" for="inlineFormSelectPref">Preference</label> -->
%= select_field 'Theme' => $c->theme_list(), class => "form-select", id => "Preference"
%= hidden_field 'From' => $c->tx->req->url
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary">Theme</button>
</div>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary">Theme</button>
</div>
</div>
</form>

View File

@ -10,11 +10,12 @@
%= dumper $pse_datas
</div>
% }
% if ( stash 'error' ) {
<br><div class="">
<%= $c->render_to_string(inline => stash 'error') %>
</div>
<br>
<div class="text-danger">
<%= $c->render_to_string(inline => stash 'error') %>
</div>
% }
<h1><%= $title%></h1>
@ -30,4 +31,5 @@
% }
</div>
%end

View File

@ -2,28 +2,22 @@
% content_for 'module' => begin
%#= include 'partials/_panel_card_top'
%#= include 'partials/_panel_card_header'
<div class="card-body">
<!-- /.card-body -->
% if (config->{debug} == 1) {
<p>
%= dumper $c->current_route
%= dumper $usr_datas
</p>
<div>
%= dumper $c->current_route
%= dumper $usr_datas
</div>
% }
<h1><%= $title%></h1>
% if ( $notif ) {
<br>
<span class="">
<%= $c->render_to_string(inline => $notif) %>
</span>
%}
<div class="text-danger">
<%= $c->render_to_string(inline => $notif) %>
</div>
% }
<h1><%= $title%></h1>
% if ($usr_datas->{trt} eq 'ADD' or $usr_datas->{trt} eq 'UPD') {
%= include 'partials/_usr_upd'
@ -43,8 +37,5 @@
</div>
%#= include 'partials/_panel_card_footer'
%#= include 'partials/_panel_card_bottom'
%end