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

@ -18,47 +18,42 @@
<%= $modul %> <%= $modul %>
<% my $btn = l('SAVE'); %> <% my $btn = l('SAVE'); %>
<br><br>
<form action="/smanager/clamav" method="POST">
<form action="/smanager/hostentriesd" method="POST"> <div class="row g-3 align-items-center">
%#= form_for 'clamav' => (method => 'POST') => begin <div class="col-auto">
<div> <h6><%= l 'clm_LABEL_FILESYSTEM_SCAN_PERIOD' %>:</h6>
<div>
<%= l 'clm_LABEL_FILESYSTEM_SCAN_PERIOD' %>
</div>
<div>
% param 'FilesystemScan' => $clm_datas->{FilesystemScan} unless param 'FilesystemScan'; % param 'FilesystemScan' => $clm_datas->{FilesystemScan} unless param 'FilesystemScan';
<%= select_field 'FilesystemScan' => [[ (l 'clm_DAILY') => 'daily'], [ (l 'clm_NEVER') => 'disabled'], [ (l 'clm_WEEKLY') => 'weekly']] %> <%= select_field 'FilesystemScan' => [[ (l 'clm_DAILY') => 'daily'], [ (l 'clm_NEVER') => 'disabled'], [ (l 'clm_WEEKLY') => 'weekly']], class => "form-select" %>
</div> </div>
</div> </div>
<br>
<div> <div class="row g-3 align-items-center">
<div> <br>
<%= l 'clm_LABEL_QUARANTINE' %> <div class="col-auto">
</div> <h6><%= l 'clm_LABEL_QUARANTINE' %>:</h6>
<div>
% param 'Quarantine' => $clm_datas->{Quarantine} unless param 'Quarantine'; % 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> <br>
</div> </div>
</div> </div>
<div> <div>
<div> <div>
<%= l 'clm_LABEL_CLAM_VERSIONS' %> <h6><%= l 'clm_LABEL_CLAM_VERSIONS' %>:</h6>
</div> </div>
<div> <div>
<%= $clm_datas->{clam_versions} %> <%= $clm_datas->{clam_versions} %>
</div>
</div>
<br> <br>
</div>
</div>
<div class="row g-3 align-items-center"> <div class="row g-3 align-items-center">
<div class="col-md-2"> <div class="col-md-2">
<button type="submit" class="btn btn-primary"><%= $btn %></button> <button type="submit" class="btn btn-primary"><%= $btn %></button>
</div> </div>
</div> </div>
%#end
</form> </form>
</div> </div>
%end %end

View File

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

View File

@ -1,4 +1,4 @@
<div class="container-sm"> <div>
<br> <br>
<!-- <h2><%#= l 'grp_FORM_TITLE' %></h2> --> <!-- <h2><%#= l 'grp_FORM_TITLE' %></h2> -->
@ -53,7 +53,7 @@
<br> <br>
<div> <div>
%= check_box 'groupMembers' => 'admin' <%= check_box 'groupMembers' => 'admin' %>
&nbspAdministrator (admin) &nbspAdministrator (admin)
<br> <br>
% my $users = $c->gen_users_list(); % my $users = $c->gen_users_list();

View File

@ -1,4 +1,4 @@
<div class="container-sm"> <div>
% my $btn = l('REMOVE'); % my $btn = l('REMOVE');

View File

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

View File

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

View File

@ -1,25 +1,30 @@
<div> <div>
% my $btn = l('REMOVE'); % my $btn = l('REMOVE');
%= form_for '/pseudonyms2' => (method => 'POST') => begin
<p>
<h2>
%=l 'pse_REMOVE_PSEUDONYM'
</h2>
<p> <form action="/smanager/pseudonyms2" method="POST">
%= $c->render_to_string(inline => l('pse_ABOUT_TO_REMOVE', $pse_datas->{pseudonym})); <h2><%= l 'pse_REMOVE_PSEUDONYM' %></h2>
</p> <%#= $c->render_to_string(inline => l('pse_ABOUT_TO_REMOVE', $pse_datas->{pseudonym})); %>
Thisis the old test that needs fixing in the language files
<%= l('pse_ABOUT_TO_REMOVE') %>
<p>
<br> <br>
%= submit_button "$btn", class => ""
</p> 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 'trt' => $pse_datas->{trt}
%= hidden_field 'Pseudonym' => $pse_datas->{pseudonym} %= hidden_field 'Pseudonym' => $pse_datas->{pseudonym}
</form>
% end
</div> </div>

View File

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

View File

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

View File

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

View File

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