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> % param 'FilesystemScan' => $clm_datas->{FilesystemScan} unless param 'FilesystemScan';
<%= l 'clm_LABEL_FILESYSTEM_SCAN_PERIOD' %> <%= select_field 'FilesystemScan' => [[ (l 'clm_DAILY') => 'daily'], [ (l 'clm_NEVER') => 'disabled'], [ (l 'clm_WEEKLY') => 'weekly']], class => "form-select" %>
</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']] %>
</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} %>
<br>
</div> </div>
</div> </div>
<br>
<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> -->
@ -48,12 +48,12 @@
<br> <br>
<div> <div>
<%= l 'GROUP_MEMBERS' %> <%= l 'GROUP_MEMBERS' %>
</div> </div>
<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

@ -19,55 +19,51 @@
<br> <br>
<h2><%=l 'grp_CURRENT_LIST' %></h2> <h2><%=l 'grp_CURRENT_LIST' %></h2>
<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 ) {
<tr>
<td><%= $group->key %></td>
<td><%= $group->prop('Description') %></td>
% foreach my $group ( @$groups ) % my $modify_text = l('MODIFY'); # Localized text
% { % my $csrf_token = "TOKEN"; # CSRF token for security
<tr> % my $group_name = $group->key; # group name extracted from the data structure
<td><%= $group->key %></td> % my $actionModify = qq{
<td><%= $group->prop('Description') %></td> % <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 <td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
%my $csrf_token = "TOKEN"; # CSRF token for security <td class="user-valign-center"><%= $c->render_to_string(inline => $actionRemove) %></td>
%my $group_name = $group->key; # group name extracted from the data structure </tr>
%my $actionModify = qq{ % }
%<a href="groups2?CsrfDef=$csrf_token&trt=UPD&group=$group_name"> </tbody>
% <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>
</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>
%= hidden_field 'trt' => $pse_datas->{trt} <div class="row g-3 align-items-center">
<div class="col-md-2">
<%=l 'pse_SELECT_ACCOUNT' %>
</div>
% end <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> </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})); %>
<p> Thisis the old test that needs fixing in the language files
<br> <%= l('pse_ABOUT_TO_REMOVE') %>
%= submit_button "$btn", class => ""
</p> <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 'trt' => $pse_datas->{trt}
%= hidden_field 'Pseudonym' => $pse_datas->{pseudonym} %= hidden_field 'Pseudonym' => $pse_datas->{pseudonym}
</form>
% end
</div> </div>

View File

@ -8,91 +8,81 @@
%= 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>
<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>
% foreach my $pseudonym ( @$pseudonyms ) {
% my $modifiable = $pseudonym->prop('Changeable') || 'yes';
% my $removable = $pseudonym->prop('Removable') || 'yes';
<p><h2> % my $account = $pseudonym->prop('Account');
%=l 'pse_CURRENT_PSEUDONYMS' % $account = "Administrator" if ($account eq "admin");
</h2><br> % $account = $c->l("pse_EVERYONE") if ($account eq "shared");
% 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>
<!-- <th class="" style="display: normal;"></th> --> % my $visible = $pseudonym->prop('Visible');
</tr> % $account .= $c->l("pse_LOCAL_ONLY")
</thead> % if (defined $visible && $visible eq "internal");
<tbody>
% foreach my $pseudonym ( @$pseudonyms ) <tr>
% { <td><%= $pseudonym->key%></td>
% my $modifiable = $pseudonym->prop('Changeable') || 'yes'; <td><%= $account%></td>
% my $removable = $pseudonym->prop('Removable') || 'yes';
% my $account = $pseudonym->prop('Account'); % my ($actionModify, $actionRemove) = '&nbsp;';
% $account = "Administrator" if ($account eq "admin"); % if ($modifiable eq 'yes') {
% $account = $c->l("pse_EVERYONE") if ($account eq "shared"); %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>
%};
% }
% my $visible = $pseudonym->prop('Visible'); % if ($removable eq 'yes') {
% $account .= $c->l("pse_LOCAL_ONLY") %my $remove_text = l('REMOVE'); # Localized text
% if (defined $visible && $visible eq "internal"); %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>
%};
% }
<tr> <td class="user-valign-center"><%= $c->render_to_string(inline => $actionModify) %></td>
%= t td => (class => "") => $pseudonym->key <td class="user-valign-center"><%= $c->render_to_string(inline => $actionRemove) %></td>
%= t td => (class => "") => $account
<td class=""> </tr>
%my ($actionModify, $actionRemove) = '&nbsp;'; % }
%if ($modifiable eq 'yes') { </tbody>
%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>
%};
%}
%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>
</table> </table>
<%} %> % }
</p>
</div> </div>

View File

@ -25,17 +25,15 @@
<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>
<div class="col-auto"> <div class="col-auto">
<button type="submit" class="btn btn-primary">Theme</button> <button type="submit" class="btn btn-primary">Theme</button>
</div> </div>
</div> </div>
</form> </form>

View File

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

View File

@ -2,28 +2,22 @@
% 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>
% } % }
<h1><%= $title%></h1>
% if ( $notif ) { % if ( $notif ) {
<br> <div class="text-danger">
<span class=""> <%= $c->render_to_string(inline => $notif) %>
<%= $c->render_to_string(inline => $notif) %> </div>
</span> % }
%}
<h1><%= $title%></h1>
% 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'
@ -43,8 +37,5 @@
</div> </div>
%#= include 'partials/_panel_card_footer'
%#= include 'partials/_panel_card_bottom'
%end %end