Add SM2 panels - WIP
This commit is contained in:
parent
a81ae5e470
commit
e57170ba11
33
createlinks
Executable file → Normal file
33
createlinks
Executable file → Normal file
@ -4,46 +4,44 @@ use esmith::Build::CreateLinks qw(:all);
|
|||||||
|
|
||||||
# our event specific for updating with yum without reboot
|
# our event specific for updating with yum without reboot
|
||||||
$event = "smeserver-shared-folders-update";
|
$event = "smeserver-shared-folders-update";
|
||||||
|
|
||||||
# add here the path to your templates needed to expand
|
# add here the path to your templates needed to expand
|
||||||
# see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
# see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
||||||
#
|
|
||||||
foreach my $file (qw(
|
foreach my $file (qw(
|
||||||
/etc/systemd/system-preset/49-koozali.preset
|
/etc/systemd/system-preset/49-koozali.preset
|
||||||
/etc/httpd/conf/httpd.conf
|
/etc/httpd/conf/httpd.conf
|
||||||
))
|
)) {
|
||||||
{
|
|
||||||
templates2events($file, $event);
|
templates2events($file, $event);
|
||||||
}
|
}
|
||||||
|
|
||||||
# action needed in case we have a systemd unit
|
# action needed in case we have a systemd unit
|
||||||
event_link("systemd-default", $event, "10");
|
event_link("systemd-default", $event, "10");
|
||||||
event_link("systemd-reload", $event, "50");
|
event_link("systemd-reload", $event, "50");
|
||||||
# action specific to this package
|
# action specific to this package
|
||||||
# event_link("some event", $event, "30");
|
# event_link("some event", $event, "30");
|
||||||
|
|
||||||
# services we need to restart
|
# services we need to restart
|
||||||
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||||
#
|
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
# functions for manager panel
|
# functions for manager panel
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
my $panel = "manager";
|
my $panel = "manager";
|
||||||
|
|
||||||
panel_link("shares", $panel);
|
panel_link("shares", $panel);
|
||||||
panel_link("userpanel-encfs", $panel);
|
panel_link("userpanel-encfs", $panel);
|
||||||
|
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
# actions for group-delete and user-delete events
|
# actions for group-delete and user-delete events
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
|
foreach my $event (qw(group-delete user-delete)) {
|
||||||
foreach my $event (qw/group-delete user-delete/) {
|
|
||||||
event_link("group-share-modify", $event, "10");
|
event_link("group-share-modify", $event, "10");
|
||||||
}
|
}
|
||||||
|
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
# actions for share-delete event
|
# actions for share-delete event
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
|
|
||||||
$event = "share-delete";
|
$event = "share-delete";
|
||||||
|
|
||||||
event_link("share-delete", $event, "15");
|
event_link("share-delete", $event, "15");
|
||||||
|
|
||||||
foreach my $event (qw(share-create share-modify share-modify-files)) {
|
foreach my $event (qw(share-create share-modify share-modify-files)) {
|
||||||
@ -66,34 +64,28 @@ foreach my $event (qw(share-create share-modify share-delete share-modify-server
|
|||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
# actions for group-modify event
|
# actions for group-modify event
|
||||||
#--------------------------------------------------
|
#--------------------------------------------------
|
||||||
|
|
||||||
$event = 'group-modify';
|
$event = 'group-modify';
|
||||||
|
|
||||||
templates2events("/etc/httpd/conf/httpd.conf", $event);
|
templates2events("/etc/httpd/conf/httpd.conf", $event);
|
||||||
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
|
||||||
|
|
||||||
safe_touch("root/etc/e-smith/templates/etc/smb.conf/shares/template-begin");
|
safe_touch("root/etc/e-smith/templates/etc/smb.conf/shares/template-begin");
|
||||||
|
|
||||||
safe_touch("root/var/service/rsyncd/down");
|
safe_touch("root/var/service/rsyncd/down");
|
||||||
service_link_enhanced("rsyncd", "S95", "7");
|
service_link_enhanced("rsyncd", "S95", "7");
|
||||||
service_link_enhanced("rsyncd", "K05", "6");
|
service_link_enhanced("rsyncd", "K05", "6");
|
||||||
service_link_enhanced("rsyncd", "K05", "0");
|
service_link_enhanced("rsyncd", "K05", "0");
|
||||||
safe_symlink("../daemontools", 'root/etc/rc.d/init.d/supervise/rsyncd');
|
safe_symlink("../daemontools", 'root/etc/rc.d/init.d/supervise/rsyncd');
|
||||||
safe_symlink("/var/service/rsyncd", 'root/service/rsyncd');
|
safe_symlink("/var/service/rsyncd", 'root/service/rsyncd');
|
||||||
|
|
||||||
templates2events("/etc/rsyncd.conf", "bootstrap-console-save");
|
templates2events("/etc/rsyncd.conf", "bootstrap-console-save");
|
||||||
templates2events("/etc/rsyncd.conf", "remoteaccess-update");
|
templates2events("/etc/rsyncd.conf", "remoteaccess-update");
|
||||||
|
|
||||||
# for php-fpm
|
# for php-fpm
|
||||||
foreach my $service (qw(php-fpm php55-php-fpm php56-php-fpm php70-php-fpm php71-php-fpm php72-php-fpm php73-php-fpm php74-php-fpm php80-php-fpm php81-php-fpm)) {
|
foreach my $service (qw(php-fpm php55-php-fpm php56-php-fpm php70-php-fpm php71-php-fpm php72-php-fpm php73-php-fpm php74-php-fpm php80-php-fpm php81-php-fpm)) {
|
||||||
foreach my $event qw(share-create share-modify share-modify-server share-delete smeserver-shared-update){
|
foreach my $event (qw(share-create share-modify share-modify-server share-delete smeserver-shared-update)) {
|
||||||
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/$service");
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/$service");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach my $file (qw(
|
||||||
|
/etc/php-fpm.d/shares.conf
|
||||||
foreach my $file qw( /etc/php-fpm.d/shares.conf
|
|
||||||
/opt/remi/php55/root/etc/php-fpm.d/shares.conf
|
/opt/remi/php55/root/etc/php-fpm.d/shares.conf
|
||||||
/opt/remi/php56/root/etc/php-fpm.d/shares.conf
|
/opt/remi/php56/root/etc/php-fpm.d/shares.conf
|
||||||
/etc/opt/remi/php70/php-fpm.d/shares.conf
|
/etc/opt/remi/php70/php-fpm.d/shares.conf
|
||||||
@ -102,14 +94,13 @@ foreach my $file qw( /etc/php-fpm.d/shares.conf
|
|||||||
/etc/opt/remi/php73/php-fpm.d/shares.conf
|
/etc/opt/remi/php73/php-fpm.d/shares.conf
|
||||||
/etc/opt/remi/php74/php-fpm.d/shares.conf
|
/etc/opt/remi/php74/php-fpm.d/shares.conf
|
||||||
/etc/opt/remi/php80/php-fpm.d/shares.conf
|
/etc/opt/remi/php80/php-fpm.d/shares.conf
|
||||||
/etc/opt/remi/php81/php-fpm.d/shares.conf ){
|
/etc/opt/remi/php81/php-fpm.d/shares.conf
|
||||||
|
)) {
|
||||||
templates2events($file, qw(webapps-update bootstrap-console-save share-create share-modify share-modify-server share-delete smeserver-shared-update smeserver-php-update));
|
templates2events($file, qw(webapps-update bootstrap-console-save share-create share-modify share-modify-server share-delete smeserver-shared-update smeserver-php-update));
|
||||||
safe_symlink('/etc/e-smith/templates-default/template-begin-ini', "root/etc/e-smith/templates$file/template-begin");
|
safe_symlink('/etc/e-smith/templates-default/template-begin-ini', "root/etc/e-smith/templates$file/template-begin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
event_link("php-pool-dirs", "share-create", "90");
|
event_link("php-pool-dirs", "share-create", "90");
|
||||||
event_link("php-pool-dirs", "share-modify", "90");
|
event_link("php-pool-dirs", "share-modify", "90");
|
||||||
event_link("php-pool-dirs", "share-modify-server", "90");
|
event_link("php-pool-dirs", "share-modify-server", "90");
|
||||||
event_link("php-pool-dirs", "share-delete", "90");
|
event_link("php-pool-dirs", "share-delete", "90");
|
||||||
|
|
||||||
|
@ -1,337 +0,0 @@
|
|||||||
package SrvMngr::Controller::Shared_folders;
|
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# heading : Collaboration
|
|
||||||
# description : Shared Folders
|
|
||||||
# navigation : 2000 2600
|
|
||||||
#
|
|
||||||
# name : shared_foldersget, method : get, url : /shared_folders, ctlact : Shared_folders#main
|
|
||||||
# name : shared_folderss, method : post, url : /shared_folders, ctlact : Shared_folders#do_save
|
|
||||||
# name : shared_foldersc, method : get, url : /shared_foldersc, ctlact : Shared_folders#do_create_modify
|
|
||||||
# name : shared_foldersc, method : post, url : /shared_foldersc, ctlact : Shared_folders#do_create_modify
|
|
||||||
# name : shared_foldersd, method : get, url : /shared_foldersd, ctlact : Shared_folders#do_delete
|
|
||||||
# name : shared_foldersp, method : get, url : /shared_foldersp, ctlact : Shared_folders#do_permissions
|
|
||||||
# name : shared_folderse, method : get, url : /shared_folderse, ctlact : Shared_folders#do_encrypt
|
|
||||||
# routes : end
|
|
||||||
#
|
|
||||||
# Documentation : https://wiki.contribs.org/SharedFolders
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use Mojo::Base 'Mojolicious::Controller';
|
|
||||||
|
|
||||||
use Locale::gettext;
|
|
||||||
use SrvMngr::I18N;
|
|
||||||
use SrvMngr qw(theme_list init_session);
|
|
||||||
|
|
||||||
use Data::Dumper;
|
|
||||||
use esmith::util;
|
|
||||||
use esmith::HostsDB;
|
|
||||||
use esmith::AccountsDB;
|
|
||||||
|
|
||||||
our $db = esmith::ConfigDB->open();
|
|
||||||
our $adb = esmith::AccountsDB->open();
|
|
||||||
|
|
||||||
our $user = 'admin';
|
|
||||||
#$ENV{'REMOTE_USER'};
|
|
||||||
$user = $1 if ( $user =~ /^([a-z][\-a-z0-9]*)$/ );
|
|
||||||
our @usergroups = $adb->user_group_list($user);
|
|
||||||
|
|
||||||
use constant FALSE => 0;
|
|
||||||
use constant TRUE => 1;
|
|
||||||
|
|
||||||
my %shf_datas = ();
|
|
||||||
|
|
||||||
sub main {
|
|
||||||
#
|
|
||||||
# Main Panel
|
|
||||||
#
|
|
||||||
my $c = shift;
|
|
||||||
$c->app->log->info( $c->log_req );
|
|
||||||
$shf_datas{first} = 'shf_FIRSTPAGE_DESC';
|
|
||||||
do_display($c);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub do_display {
|
|
||||||
my $c = shift;
|
|
||||||
my $title = $c->l('shf_FORM_TITLE');
|
|
||||||
my $modul = '';
|
|
||||||
my @shares = get_all_shares($c);
|
|
||||||
my @encryptedfolders = get_all_encrypted_shares($c);
|
|
||||||
$shf_datas{trt} = 'LIST';
|
|
||||||
|
|
||||||
$c->stash(
|
|
||||||
title => $title,
|
|
||||||
modul => $modul,
|
|
||||||
shf_datas => \%shf_datas,
|
|
||||||
sharedfolders => \@shares,
|
|
||||||
encryptedfolders => \@encryptedfolders,
|
|
||||||
empty => ( scalar @shares == 0 ),
|
|
||||||
emptye => ( scalar @encryptedfolders == 0 )
|
|
||||||
);
|
|
||||||
|
|
||||||
$c->render( template => 'shared_folders' );
|
|
||||||
}
|
|
||||||
|
|
||||||
sub get_all_shares {
|
|
||||||
my $c = shift;
|
|
||||||
my @sharesdb = $adb->get_all_by_prop( type => 'share' );
|
|
||||||
my @shares = ();
|
|
||||||
foreach my $sharerec (@sharesdb) {
|
|
||||||
next if ( ( $sharerec->prop('Hide') || 'no' ) eq 'yes' );
|
|
||||||
my $removable = $sharerec->prop('Removable') || 'yes';
|
|
||||||
my %row = (
|
|
||||||
"Name" => $sharerec->key,
|
|
||||||
"Description" => $sharerec->prop("Name"),
|
|
||||||
"Removeable" => $removable
|
|
||||||
);
|
|
||||||
push( @shares, \%row );
|
|
||||||
}
|
|
||||||
return @shares;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub get_all_encrypted_shares {
|
|
||||||
|
|
||||||
my $c = shift;
|
|
||||||
my @shares = $adb->get_all_by_prop( type => 'share' );
|
|
||||||
my @encfs = ();
|
|
||||||
foreach (@shares) {
|
|
||||||
my @sharegroups = split( /[,;]/,
|
|
||||||
( $_->prop('WriteGroups') || '' ) . ','
|
|
||||||
. ( $_->prop('ReadGroups') || '' ) );
|
|
||||||
my @shareusers = split( /[,;]/,
|
|
||||||
( $_->prop('WriteUsers') || '' ) . ','
|
|
||||||
. ( $_->prop('ReadUsers') || '' ) );
|
|
||||||
@sharegroups = keys %{ { map { $_ => 1 } @sharegroups } };
|
|
||||||
|
|
||||||
my %count = ();
|
|
||||||
my @intersection = ();
|
|
||||||
foreach my $element ( @sharegroups, @usergroups ) { $count{$element}++ }
|
|
||||||
foreach my $element ( keys %count ) {
|
|
||||||
push @intersection, $element if ( $count{$element} > 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
# Only display the share in the list if encryption is enabled
|
|
||||||
# and the user has at least read access
|
|
||||||
if (
|
|
||||||
( ( $_->prop('Encryption') || 'disabled' ) eq 'enabled' )
|
|
||||||
&& ( ( scalar @intersection > 0 )
|
|
||||||
|| ( grep { $_ eq $user } @shareusers )
|
|
||||||
|| ( $user eq 'admin' ) )
|
|
||||||
)
|
|
||||||
{
|
|
||||||
push @encfs, $_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unless ( scalar @encfs > 0 ) {
|
|
||||||
return ();
|
|
||||||
}
|
|
||||||
|
|
||||||
my @encrypted_shares = ();
|
|
||||||
foreach my $i (@encfs) {
|
|
||||||
my $sharename = $i->key();
|
|
||||||
my $sharedesc = $i->prop('Name');
|
|
||||||
|
|
||||||
my $mountstatus =
|
|
||||||
`/bin/mount | /bin/grep /home/e-smith/files/shares/$sharename/ | grep -c fuse`;
|
|
||||||
chomp($mountstatus);
|
|
||||||
my $sharestatus =
|
|
||||||
( $mountstatus eq '1' )
|
|
||||||
? $c->l('shf_ENCRYPT_MOUNTED')
|
|
||||||
: $c->l('shf_ENCRYPT_NOT_MOUNTED');
|
|
||||||
|
|
||||||
my $actionMount = "shf_ENCRYPT_MOUNT"
|
|
||||||
; #$q->a({href => "${href}Mount&name=$sharename"},$self->localise('MOUNT')). ' ';
|
|
||||||
|
|
||||||
my $actionUmount = 'shf_ENCRYPT_UNMOUNT'
|
|
||||||
; #$q->a({href => "${href}Umount&name=$sharename"}, $self->localise('UMOUNT')). ' ';
|
|
||||||
|
|
||||||
my $action = ( $mountstatus eq '1' ) ? $actionUmount : $actionMount;
|
|
||||||
|
|
||||||
my %row = (
|
|
||||||
"Name" => $sharename,
|
|
||||||
"Description" => $sharedesc,
|
|
||||||
"Status" => $sharestatus,
|
|
||||||
"Action" => $action
|
|
||||||
);
|
|
||||||
push( @encrypted_shares, \%row );
|
|
||||||
}
|
|
||||||
return @encrypted_shares;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub do_encrypt {
|
|
||||||
#
|
|
||||||
# Enable/disable encrypt share clicked
|
|
||||||
#
|
|
||||||
my $c = shift;
|
|
||||||
$c->app->log->info( $c->log_req );
|
|
||||||
my $title = $c->l('shf_main_title');
|
|
||||||
my $modul = '';
|
|
||||||
my $mode = $c->param("mode");
|
|
||||||
|
|
||||||
#etc....
|
|
||||||
|
|
||||||
do_display($c); #If no errors
|
|
||||||
}
|
|
||||||
|
|
||||||
sub do_save {
|
|
||||||
#
|
|
||||||
# Save pressed
|
|
||||||
#
|
|
||||||
my $c = shift;
|
|
||||||
$c->app->log->info( $c->log_req );
|
|
||||||
|
|
||||||
my $title = $c->l('shf_main_title');
|
|
||||||
my $modul = '';
|
|
||||||
my $mode = $c->param("mode");
|
|
||||||
|
|
||||||
#etc....
|
|
||||||
if ( $mode = "DEL" ) {
|
|
||||||
my $name = $c->param("name");
|
|
||||||
my $msg = remove_share( $c, $name );
|
|
||||||
if ( $msg eq "ok" ) {
|
|
||||||
$shf_datas{success} = "shf_SUCCESSFULLY_DELETED_SHARE";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$shf_datas{error} = $msg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
do_display($c);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sub do_delete {
|
|
||||||
#
|
|
||||||
# Delete/Remove clicked
|
|
||||||
#
|
|
||||||
my $c = shift;
|
|
||||||
$c->app->log->info( $c->log_req );
|
|
||||||
|
|
||||||
my $title = $c->l('shf_REMOVE_TITLE');
|
|
||||||
my $modul = '';
|
|
||||||
|
|
||||||
#etc.....
|
|
||||||
$shf_datas{trt} = 'DEL';
|
|
||||||
$c->stash(
|
|
||||||
title => $title,
|
|
||||||
modul => $modul,
|
|
||||||
shf_datas => \%shf_datas,
|
|
||||||
);
|
|
||||||
$c->render( template => 'shared_folders' );
|
|
||||||
}
|
|
||||||
|
|
||||||
sub do_create_modify {
|
|
||||||
#
|
|
||||||
# Delete/Remove clicked
|
|
||||||
#
|
|
||||||
my $c = shift;
|
|
||||||
$c->app->log->info( $c->log_req );
|
|
||||||
|
|
||||||
my $title = $c->l('shf_create_modify_title');
|
|
||||||
my $modul = '';
|
|
||||||
my $empty;
|
|
||||||
|
|
||||||
#Selection options
|
|
||||||
$shf_datas{disable_enable} =
|
|
||||||
[ [ $c->l(''), 'disabled' ], [ $c->l(''), 'enabled' ] ];
|
|
||||||
$shf_datas{recyclebin} = [
|
|
||||||
[ $c->l('shf_DISABLED'), 'disabled' ],
|
|
||||||
[ $c->l('shf_DONT_KEEP_VERSIONS'), 'enabled' ],
|
|
||||||
[ $c->l('shf_KEEP_VERSIONS'), 'keep-versions' ]
|
|
||||||
];
|
|
||||||
$shf_datas{SMBaccess} = [
|
|
||||||
[ $c->l('shf_ENABLED_BROWSEABLE'), 'browseable' ],
|
|
||||||
[ $c->l('shf_ENABLED_NON_BROWSEABLE'), 'non-browseable' ],
|
|
||||||
[ 'No access', 'none' ]
|
|
||||||
];
|
|
||||||
$shf_datas{webaccess} = [
|
|
||||||
[ $c->l('shf_ENTIRE_INTERNET_NO_PASSWORD'), 'global' ],
|
|
||||||
[ $c->l('shf_ENTIRE_INTERNET_PASSWORD'), 'global-pw' ],
|
|
||||||
[ $c->l('shf_ENTIRE_INTERNET_PASSWORD_REMOTE'), 'global-pw-remote' ],
|
|
||||||
[ $c->l('shf_LOCAL_NETWORK_NO_PASSWORD'), 'local' ],
|
|
||||||
[ $c->l('shf_LOCAL_NETWORK_PASSWORD'), 'local-pw' ],
|
|
||||||
[ $c->l('shf_NO_ACCESS'), 'None' ]
|
|
||||||
];
|
|
||||||
$shf_datas{retention} = [
|
|
||||||
[ $c->l('shf_UNLIMITED'), 'unlimited' ],
|
|
||||||
[ $c->l('shf_ONE_WEEK'), 7 ],
|
|
||||||
[ $c->l('shf_ONE_MONTH'), 30 ],
|
|
||||||
[ $c->l('shf_SIX_MONTHS'), 180 ],
|
|
||||||
[ $c->l('shf_ONE_YEAR'), 365 ]
|
|
||||||
];
|
|
||||||
my $name = $c->param("name") || '';
|
|
||||||
my @params = ();
|
|
||||||
if ($name ne ''){
|
|
||||||
my $namedb = $adb->get($name);
|
|
||||||
my @params = ('SMBaccess' => $namedb->get_value("SMBaccess") || '',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$shf_datas{param_details} = \@params;
|
|
||||||
|
|
||||||
#etc.....
|
|
||||||
|
|
||||||
$shf_datas{trt} = 'CR_MOD';
|
|
||||||
$c->stash(
|
|
||||||
title => $title,
|
|
||||||
modul => $modul,
|
|
||||||
shf_datas => \%shf_datas,
|
|
||||||
empty => $empty
|
|
||||||
);
|
|
||||||
$c->render( template => 'shared_folders' );
|
|
||||||
}
|
|
||||||
|
|
||||||
sub do_permisssions {
|
|
||||||
#
|
|
||||||
# Delete/Remove clicked
|
|
||||||
#
|
|
||||||
my $c = shift;
|
|
||||||
$c->app->log->info( $c->log_req );
|
|
||||||
|
|
||||||
my $title = $c->l('shf_permissions_title');
|
|
||||||
my $modul = '';
|
|
||||||
|
|
||||||
#etc.....
|
|
||||||
|
|
||||||
$shf_datas{trt} = 'PERM';
|
|
||||||
$c->stash(
|
|
||||||
title => $title,
|
|
||||||
modul => $modul,
|
|
||||||
shf_datas => \%shf_datas,
|
|
||||||
);
|
|
||||||
$c->render( template => 'shared_folders' );
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove a share
|
|
||||||
sub remove_share {
|
|
||||||
my $c = shift;
|
|
||||||
my $name = shift;
|
|
||||||
my $acct = $adb->get($name);
|
|
||||||
|
|
||||||
#return $self->error('CANCELED','First') if ($c->param('cancel'));
|
|
||||||
return 'shf_CANT_FIND_SHARE'
|
|
||||||
unless ( $acct && $acct->prop('type') eq 'share' );
|
|
||||||
|
|
||||||
# Untaint $name before use in system()
|
|
||||||
$name =~ /(.+)/;
|
|
||||||
$name = $1;
|
|
||||||
my $encryption = $acct->prop('Encryption') || 'disabled';
|
|
||||||
my $mountstatus =
|
|
||||||
`/bin/mount | grep /home/e-smith/files/shares/$name/ | grep -c fuse`;
|
|
||||||
chomp($mountstatus);
|
|
||||||
|
|
||||||
if ( ( $encryption eq 'enabled' ) && ( $mountstatus eq '1' ) ) {
|
|
||||||
return "shf_ERROR_ENCRYPTED_ENABLED";
|
|
||||||
}
|
|
||||||
$acct->set_prop( 'type', 'share-deleted' );
|
|
||||||
if ( system( "/sbin/e-smith/signal-event", "share-delete", $name ) == 0 ) {
|
|
||||||
$acct->delete();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return "shf_ERROR_WHILE_DELETING_SHARE";
|
|
||||||
}
|
|
||||||
return "ok";
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
942
root/usr/share/smanager/lib/SrvMngr/Controller/Shares-Custom.pm
Normal file
942
root/usr/share/smanager/lib/SrvMngr/Controller/Shares-Custom.pm
Normal file
@ -0,0 +1,942 @@
|
|||||||
|
#
|
||||||
|
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Routines to be edited by the developer to provide content and validation for parameters
|
||||||
|
# and provison of the control data for table(s)
|
||||||
|
#
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::util::network;
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::NetworksDB;
|
||||||
|
use esmith::DomainsDB;
|
||||||
|
|
||||||
|
use constant FALSE => 0;
|
||||||
|
use constant TRUE => 1;
|
||||||
|
|
||||||
|
|
||||||
|
#The most common ones - open DB when required.
|
||||||
|
my $cdb;
|
||||||
|
my $adb;
|
||||||
|
my $ndb;
|
||||||
|
my $hdb;
|
||||||
|
my $ddb;
|
||||||
|
|
||||||
|
# Validation routines - parameters for each panel
|
||||||
|
|
||||||
|
sub validate_LIST {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
# Validation for each field
|
||||||
|
my $ret = "";
|
||||||
|
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_MODIFY {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
# Validation for each field
|
||||||
|
my $ret = "";
|
||||||
|
|
||||||
|
if (! TRUE) #validate $c->param('description')
|
||||||
|
{$ret .= 'Validation for description failed';}
|
||||||
|
if (! TRUE) #validate $c->param('smbaccess')
|
||||||
|
{$ret .= 'Validation for smbaccess failed';}
|
||||||
|
if (! TRUE) #validate $c->param('recyclebin')
|
||||||
|
{$ret .= 'Validation for recyclebin failed';}
|
||||||
|
if (! TRUE) #validate $c->param('retention')
|
||||||
|
{$ret .= 'Validation for retention failed';}
|
||||||
|
if (! TRUE) #validate $c->param('httpaccess')
|
||||||
|
{$ret .= 'Validation for httpaccess failed';}
|
||||||
|
if (! TRUE) #validate $c->param('webdav')
|
||||||
|
{$ret .= 'Validation for webdav failed';}
|
||||||
|
if (! TRUE) #validate $c->param('requireSSL')
|
||||||
|
{$ret .= 'Validation for requireSSL failed';}
|
||||||
|
if (! TRUE) #validate $c->param('indexes')
|
||||||
|
{$ret .= 'Validation for indexes failed';}
|
||||||
|
if (! TRUE) #validate $c->param('dynamic')
|
||||||
|
{$ret .= 'Validation for dynamic failed';}
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_PERMISSIONS {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
# Validation for each field
|
||||||
|
my $ret = "";
|
||||||
|
|
||||||
|
if (! TRUE) #validate $c->param('writegroup')
|
||||||
|
{$ret .= 'Validation for writegroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readgroup')
|
||||||
|
{$ret .= 'Validation for readgroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writegroup')
|
||||||
|
{$ret .= 'Validation for writegroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readgroup')
|
||||||
|
{$ret .= 'Validation for readgroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writegroup')
|
||||||
|
{$ret .= 'Validation for writegroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readgroup')
|
||||||
|
{$ret .= 'Validation for readgroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writegroup')
|
||||||
|
{$ret .= 'Validation for writegroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readgroup')
|
||||||
|
{$ret .= 'Validation for readgroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writegroup')
|
||||||
|
{$ret .= 'Validation for writegroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readgroup')
|
||||||
|
{$ret .= 'Validation for readgroup failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('writeuser')
|
||||||
|
{$ret .= 'Validation for writeuser failed';}
|
||||||
|
if (! TRUE) #validate $c->param('readuser')
|
||||||
|
{$ret .= 'Validation for readuser failed';}
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub validate_REMOVE {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
# Validation for each field
|
||||||
|
my $ret = "";
|
||||||
|
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get singleton data for each panel
|
||||||
|
|
||||||
|
sub get_data_for_panel_LIST {
|
||||||
|
# Return a hash with the fields required which will be loaded into the shared data
|
||||||
|
my $c = shift;
|
||||||
|
my %ret = (
|
||||||
|
'Data1'=>'Data for LIST', #Example
|
||||||
|
# fields from Inputs in LIST $fields['LIST']
|
||||||
|
|
||||||
|
);
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_data_for_panel_MODIFY {
|
||||||
|
# Return a hash with the fields required which will be loaded into the shared data
|
||||||
|
my $c = shift;
|
||||||
|
my $name = $c->param('Selected');
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
my $rec = $adb->get($name) || die("Share $name is not in DB ");
|
||||||
|
my %ret = (
|
||||||
|
'Data1'=>'Data for MODIFY', #Example
|
||||||
|
# fields from Inputs in MODIFY $fields['MODIFY']
|
||||||
|
'name' => $name,
|
||||||
|
'description'=>$rec->prop('Name'),
|
||||||
|
'smbaccess'=>$rec->prop('smbAccess'),
|
||||||
|
'recyclebin'=>$rec->prop('RecycleBin'),
|
||||||
|
'retention'=>$rec->prop('RecycleBinRetention'),
|
||||||
|
'httpaccess'=>$rec->prop('httpAccess'),
|
||||||
|
'webdav'=>$rec->prop('WebDav'),
|
||||||
|
'requireSSL'=>$rec->prop('RequireSSL'),
|
||||||
|
'indexes'=>$rec->prop('Indexes'),
|
||||||
|
'dynamic'=>$rec->prop('DynamicContent'),
|
||||||
|
|
||||||
|
);
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_data_for_panel_PERMISSIONS {
|
||||||
|
# Return a hash with the fields required which will be loaded into the shared data
|
||||||
|
my $c = shift;
|
||||||
|
my %ret = (
|
||||||
|
'Data1'=>'Data for PERMISSIONS', #Example
|
||||||
|
# fields from Inputs in PERMISSIONS $fields['PERMISSIONS']
|
||||||
|
'writegroup'=>'writegroup contents',
|
||||||
|
'readgroup'=>'readgroup contents',
|
||||||
|
'writegroup'=>'writegroup contents',
|
||||||
|
'readgroup'=>'readgroup contents',
|
||||||
|
'writegroup'=>'writegroup contents',
|
||||||
|
'readgroup'=>'readgroup contents',
|
||||||
|
'writegroup'=>'writegroup contents',
|
||||||
|
'readgroup'=>'readgroup contents',
|
||||||
|
'writegroup'=>'writegroup contents',
|
||||||
|
'readgroup'=>'readgroup contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
'writeuser'=>'writeuser contents',
|
||||||
|
'readuser'=>'readuser contents',
|
||||||
|
|
||||||
|
);
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_data_for_panel_REMOVE {
|
||||||
|
# Return a hash with the fields required which will be loaded into the shared data
|
||||||
|
my $c = shift;
|
||||||
|
my $name = $c->param('Selected');
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
my $rec = $adb->get($name) || die("Share $name is not in DB ");
|
||||||
|
my %ret = (
|
||||||
|
'Data1'=>'Data for MODIFY', #Example
|
||||||
|
# fields from Inputs in MODIFY $fields['MODIFY']
|
||||||
|
'name' => $name,
|
||||||
|
'description'=>$rec->prop('Name'),
|
||||||
|
);
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Get control data for table(s)
|
||||||
|
|
||||||
|
# Define a constant hash for field name mapping
|
||||||
|
use constant Table1_FIELD_MAPPING => (
|
||||||
|
'Table1_Name' => 'Table1_Name',
|
||||||
|
'Table1_Description' => 'Table1_Description',
|
||||||
|
'Table1_Actionp' => 'Table1_Actionp',
|
||||||
|
'Table1_Actionm' => 'Table1_Actionm',
|
||||||
|
'Table1_Actionr' => 'Table1_Actionr',
|
||||||
|
);
|
||||||
|
|
||||||
|
sub actual_Table1 {
|
||||||
|
my $c = shift;
|
||||||
|
my @ret = ();
|
||||||
|
# Actual code for extracting Table1
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
my @shares = $adb->get_all_by_prop(type => 'share');
|
||||||
|
foreach my $share (@shares) {
|
||||||
|
my $sharename = $share->key();
|
||||||
|
my $sharedesc = $share->prop('Name');
|
||||||
|
$c->app->log->info("$sharename : $sharedesc");
|
||||||
|
next if (($share->prop('Hide') || 'no') eq 'yes');
|
||||||
|
my $removable = $share->prop('Removable') || 'yes';
|
||||||
|
my $actionModify = '<a href="sharesd?trt=MODIFY&Selected='.$sharename.'">'.$c->l('sf_Modify').'</a>';
|
||||||
|
my $actionPerm = '<a href="sharesd?trt=PERMISSIONS&Selected='.$sharename.'">'.$c->l('sf_Permisssions').'</a>';
|
||||||
|
my $actionRemove = ($removable ne 'no') ?'<a href="sharesd?trt=REMOVE&Selected='.$sharename.'">'.$c->l('sf_Remove').'</a>': '';
|
||||||
|
push @ret,
|
||||||
|
{ Table1_Name => $sharename,
|
||||||
|
Table1_Description => $sharedesc,
|
||||||
|
Table1_Actionp => $actionPerm,
|
||||||
|
Table1_Actionm => $actionModify,
|
||||||
|
Table1_Actionr => $actionRemove,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return @ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_Table1 {
|
||||||
|
# Return an array of hashes of the contents for each row and column for Table1
|
||||||
|
my $c = shift;
|
||||||
|
my @source_records = $c->actual_Table1();
|
||||||
|
my @transformed_records;
|
||||||
|
my %Field_Mapping = Table1_FIELD_MAPPING();
|
||||||
|
# Iterate over each record in the source array
|
||||||
|
for my $source_record (@source_records) {
|
||||||
|
my %transformed_record;
|
||||||
|
# Iterate over each key-value pair in the $Field_Mapping constant
|
||||||
|
while (my ($target, $source) = each %Field_Mapping) {
|
||||||
|
# Check if the source field exists in the source record
|
||||||
|
if (exists $source_record->{$source}) {
|
||||||
|
# Assign the source field value to the target field in the transformed record
|
||||||
|
$transformed_record{$target} = $source_record->{$source};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Add transformed record to the array if it's not empty
|
||||||
|
push @transformed_records, \%transformed_record if %transformed_record;
|
||||||
|
}
|
||||||
|
return \@transformed_records;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Define a constant hash for field name mapping
|
||||||
|
use constant Table2_FIELD_MAPPING => (
|
||||||
|
'Table2-Groups' => 'Source-for-Table2-Groups',
|
||||||
|
'Table2-Description' => 'Source-for-Table2-Description',
|
||||||
|
'Table2-Read / Write' => 'Source-for-Table2-Read / Write',
|
||||||
|
'Table2-Read Only' => 'Source-for-Table2-Read Only'
|
||||||
|
#'target_field2' => 'source_field2',
|
||||||
|
# Add more mappings as needed
|
||||||
|
);
|
||||||
|
|
||||||
|
sub actual_Table2 {
|
||||||
|
my $c = shift;
|
||||||
|
my @ret = ();
|
||||||
|
# Actual code for extracting Table2
|
||||||
|
return @ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_Table2 {
|
||||||
|
# Return an array of hashes of the contents for each row and column for Table2
|
||||||
|
my $c = shift;
|
||||||
|
my @source_records = $c->actual_Table2();
|
||||||
|
my @transformed_records;
|
||||||
|
my %Field_Mapping = Table2_FIELD_MAPPING();
|
||||||
|
# Iterate over each record in the source array
|
||||||
|
for my $source_record (@source_records) {
|
||||||
|
my %transformed_record;
|
||||||
|
# Iterate over each key-value pair in the $Field_Mapping constant
|
||||||
|
while (my ($target, $source) = each %Field_Mapping) {
|
||||||
|
# Check if the source field exists in the source record
|
||||||
|
if (exists $source_record->{$source}) {
|
||||||
|
# Assign the source field value to the target field in the transformed record
|
||||||
|
$transformed_record{$target} = $source_record->{$source};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Add transformed record to the array if it's not empty
|
||||||
|
push @transformed_records, \%transformed_record if %transformed_record;
|
||||||
|
}
|
||||||
|
return \@transformed_records;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Return hash with values from row in which link clicked on table
|
||||||
|
|
||||||
|
sub get_selected_LIST {
|
||||||
|
my $c = shift;
|
||||||
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
|
my %ret = {};
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_selected_MODIFY {
|
||||||
|
my $c = shift;
|
||||||
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
|
my %ret = {};
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_selected_PERMISSIONS {
|
||||||
|
my $c = shift;
|
||||||
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
|
my %ret = {};
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub get_selected_REMOVE {
|
||||||
|
my $c = shift;
|
||||||
|
my $selected = shift; #Parameter is name of selected row.
|
||||||
|
my $is_new_record = shift; #Indicates new record required (defaults)
|
||||||
|
my %ret = {};
|
||||||
|
return %ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
|
||||||
|
|
||||||
|
sub perform_LIST {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
my $ret = "";
|
||||||
|
my $db = $cdb; #maybe one of the others
|
||||||
|
my $dbkey = 'ChangeThis';
|
||||||
|
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
||||||
|
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub perform_MODIFY {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
my $ret = "";
|
||||||
|
#my $db = $cdb; #maybe one of the others
|
||||||
|
#my $dbkey = 'ChangeThis';
|
||||||
|
## To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
||||||
|
|
||||||
|
#if (! TRUE) #copy or perform with value: description e.g. $db->set_prop($dbkey,'description',$c->param('description'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for description';}
|
||||||
|
#if (! TRUE) #copy or perform with value: smbaccess e.g. $db->set_prop($dbkey,'smbaccess',$c->param('smbaccess'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for smbaccess';}
|
||||||
|
#if (! TRUE) #copy or perform with value: recyclebin e.g. $db->set_prop($dbkey,'recyclebin',$c->param('recyclebin'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for recyclebin';}
|
||||||
|
#if (! TRUE) #copy or perform with value: retention e.g. $db->set_prop($dbkey,'retention',$c->param('retention'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for retention';}
|
||||||
|
#if (! TRUE) #copy or perform with value: httpaccess e.g. $db->set_prop($dbkey,'httpaccess',$c->param('httpaccess'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for httpaccess';}
|
||||||
|
#if (! TRUE) #copy or perform with value: webdav e.g. $db->set_prop($dbkey,'webdav',$c->param('webdav'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for webdav';}
|
||||||
|
#if (! TRUE) #copy or perform with value: requireSSL e.g. $db->set_prop($dbkey,'requireSSL',$c->param('requireSSL'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for requireSSL';}
|
||||||
|
#if (! TRUE) #copy or perform with value: indexes e.g. $db->set_prop($dbkey,'indexes',$c->param('indexes'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for indexes';}
|
||||||
|
#if (! TRUE) #copy or perform with value: dynamic e.g. $db->set_prop($dbkey,'dynamic',$c->param('dynamic'),type=>'service'))
|
||||||
|
#{$ret .= 'Perform/save failed for dynamic';}
|
||||||
|
$ret = $c->save_share();
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub perform_PERMISSIONS {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
my $ret = "";
|
||||||
|
my $db = $cdb; #maybe one of the others
|
||||||
|
my $dbkey = 'ChangeThis';
|
||||||
|
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
||||||
|
|
||||||
|
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writegroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readgroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writegroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readgroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writegroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readgroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writegroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readgroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: writegroup e.g. $db->set_prop($dbkey,'writegroup',$c->param('writegroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writegroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: readgroup e.g. $db->set_prop($dbkey,'readgroup',$c->param('readgroup'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readgroup';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: writeuser e.g. $db->set_prop($dbkey,'writeuser',$c->param('writeuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for writeuser';}
|
||||||
|
if (! TRUE) #copy or perform with value: readuser e.g. $db->set_prop($dbkey,'readuser',$c->param('readuser'),type=>'service'))
|
||||||
|
{$ret .= 'Perform/save failed for readuser';}
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub perform_REMOVE {
|
||||||
|
my $c = shift;
|
||||||
|
my $sf_data = shift; #Data hash as parameter
|
||||||
|
my $ret = "";
|
||||||
|
my $db = $cdb; #maybe one of the others
|
||||||
|
my $dbkey = 'ChangeThis';
|
||||||
|
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
|
||||||
|
|
||||||
|
if ($ret eq "") {$ret = 'ok';}
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub create_link{
|
||||||
|
# WIP
|
||||||
|
my ($c,$route, $panel, $index) = @_;
|
||||||
|
my $link = "$route?trt=$panel&Selected=$index";
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a new shared folder
|
||||||
|
|
||||||
|
#sub create_share {
|
||||||
|
#my $c = shift;
|
||||||
|
#my $name = $c->param('name');
|
||||||
|
#my $encryption = $c->param('encryption') || 'disabled';
|
||||||
|
#my $password = $c->param('password');
|
||||||
|
#my $password2 = $c->param('password2');
|
||||||
|
|
||||||
|
#my $msg = $c->validate_name($name);
|
||||||
|
|
||||||
|
#unless ($msg eq "OK") {
|
||||||
|
#return $c->error($msg);
|
||||||
|
#}
|
||||||
|
|
||||||
|
#$msg = $c->max_share_name_length($name);
|
||||||
|
|
||||||
|
#unless ($msg eq "OK") {
|
||||||
|
#return $c->error($msg);
|
||||||
|
#}
|
||||||
|
|
||||||
|
#$msg = $c->conflict_check($name);
|
||||||
|
#unless ($msg eq "OK") {
|
||||||
|
#return $c->error($msg);
|
||||||
|
#}
|
||||||
|
|
||||||
|
#$msg = ($encryption eq 'enabled') ? $c->confirm_password($password,$password2) : 'OK';
|
||||||
|
#unless ($msg eq "OK") {
|
||||||
|
#return $c->error($msg);
|
||||||
|
#}
|
||||||
|
|
||||||
|
#if (my $acct = $a->new_record($name, {
|
||||||
|
#Name => $c->param('description'),
|
||||||
|
#Encryption => $encryption,
|
||||||
|
#InactivityTimeOut => ($c->param('inactivity') || ''),
|
||||||
|
#RecycleBin => $c->param('recyclebin'),
|
||||||
|
#RecycleBinRetention => $c->param('retention'),
|
||||||
|
#smbAccess => $c->param('smbaccess'),
|
||||||
|
#httpAccess => $c->param('httpaccess'),
|
||||||
|
#WebDav => $c->param('webdav'),
|
||||||
|
#Pydio => ($c->param('pydio') || 'disabled'),
|
||||||
|
#RequireSSL => $c->param('requireSSL'),
|
||||||
|
#Indexes => $c->param('indexes'),
|
||||||
|
#DynamicContent => $c->param('dynamic'),
|
||||||
|
#type => 'share',
|
||||||
|
#}) ) {
|
||||||
|
## Untaint $name before use in system()
|
||||||
|
#$name =~ /(.+)/; $name = $1;
|
||||||
|
|
||||||
|
#if ($encryption eq 'enabled') {
|
||||||
|
#my $source = '/home/e-smith/files/shares/' . $name . '/.store';
|
||||||
|
#my $dest = '/home/e-smith/files/shares/' . $name . '/files';
|
||||||
|
#File::Path::mkpath ($source);
|
||||||
|
#mkdir $dest;
|
||||||
|
#open(DIR, "| /usr/bin/encfs -S --public -o nonempty,umask=000 $source $dest > /dev/null 2>&1");
|
||||||
|
#print DIR "\n$password";
|
||||||
|
#close DIR;
|
||||||
|
#$c->error("ERROR_WITH_ENCRYPTION") unless(
|
||||||
|
#system("/bin/fusermount -uz $dest") == 0
|
||||||
|
#);
|
||||||
|
#}
|
||||||
|
|
||||||
|
#if (system ("/sbin/e-smith/signal-event", "share-create", $name) == 0) {
|
||||||
|
#$c->success("SUCCESSFULLY_CREATED_SHARE", "Permissions");
|
||||||
|
#}
|
||||||
|
#else {
|
||||||
|
#$c->error("ERROR_WHILE_CREATING_SHARE");
|
||||||
|
#}
|
||||||
|
#}
|
||||||
|
#else {
|
||||||
|
#$c->error('CANT_CREATE_SHARE');
|
||||||
|
#}
|
||||||
|
#}
|
||||||
|
|
||||||
|
## Modify a share.
|
||||||
|
## This sub shares a lot of code with create share
|
||||||
|
## It should be merged
|
||||||
|
#sub modify_share {
|
||||||
|
#my $c = shift;
|
||||||
|
#my $name = $c->param('name');
|
||||||
|
#my $acct = $a->get($name);
|
||||||
|
|
||||||
|
#return $c->error('CANT_FIND_SHARE') unless($acct && $acct->prop('type') eq 'share');
|
||||||
|
|
||||||
|
#$acct->merge_props(
|
||||||
|
#Name => $c->param('description'),
|
||||||
|
#InactivityTimeOut => ($c->param('inactivity') || ''),
|
||||||
|
#RecycleBin => $c->param('recyclebin'),
|
||||||
|
#RecycleBinRetention => $c->param('retention'),
|
||||||
|
#smbAccess => $c->param('smbaccess'),
|
||||||
|
#httpAccess => $c->param('httpaccess'),
|
||||||
|
#WebDav => $c->param('webdav'),
|
||||||
|
#Pydio => ($c->param('pydio') || 'disabled'),
|
||||||
|
#RequireSSL => $c->param('requireSSL'),
|
||||||
|
#Indexes => $c->param('indexes'),
|
||||||
|
#DynamicContent => $c->param('dynamic'),
|
||||||
|
#);
|
||||||
|
|
||||||
|
## Untaint $name before use in system()
|
||||||
|
#$name =~ /(.+)/; $name = $1;
|
||||||
|
#if (system ("/sbin/e-smith/signal-event", "share-modify", $name) == 0) {
|
||||||
|
#$c->success("SUCCESSFULLY_MODIFIED_SHARE");
|
||||||
|
#}
|
||||||
|
#else {
|
||||||
|
#$c->error("ERROR_WHILE_MODIFYING_SHARE");
|
||||||
|
#}
|
||||||
|
#return undef;
|
||||||
|
#}
|
||||||
|
|
||||||
|
sub save_share {
|
||||||
|
#
|
||||||
|
# Merged the two subs
|
||||||
|
#
|
||||||
|
my $c = shift;
|
||||||
|
my $name = $c->param('name');
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
my $acct = $adb->get($name);
|
||||||
|
my $is_create = !$acct;
|
||||||
|
|
||||||
|
if ($is_create) {
|
||||||
|
# Validate new share parameters
|
||||||
|
my $msg = $c->validate_name($name);
|
||||||
|
return $c->l($msg) unless $msg eq 'ok';
|
||||||
|
|
||||||
|
$msg = $c->max_share_name_length($name);
|
||||||
|
return $c->l($msg) unless $msg eq 'ok';
|
||||||
|
|
||||||
|
$msg = $c->conflict_check($name);
|
||||||
|
return $c->l($msg) unless $msg eq 'ok';
|
||||||
|
|
||||||
|
# Handle encryption parameters
|
||||||
|
my $encryption = $c->param('encryption') || 'disabled';
|
||||||
|
my $password;
|
||||||
|
if ($encryption eq 'enabled') {
|
||||||
|
$password = $c->param('password');
|
||||||
|
my $password2 = $c->param('password2');
|
||||||
|
$msg = $c->confirm_password($password, $password2);
|
||||||
|
return $c->l($msg) unless $msg eq 'ok';
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create new share record
|
||||||
|
$acct = $adb->new_record($name, {
|
||||||
|
Name => $c->param('description'),
|
||||||
|
Encryption => $encryption,
|
||||||
|
InactivityTimeOut => ($c->param('inactivity') || ''),
|
||||||
|
RecycleBin => $c->param('recyclebin'),
|
||||||
|
RecycleBinRetention => $c->param('retention'),
|
||||||
|
smbAccess => $c->param('smbaccess'),
|
||||||
|
httpAccess => $c->param('httpaccess'),
|
||||||
|
WebDav => $c->param('webdav'),
|
||||||
|
Pydio => ($c->param('pydio') || 'disabled'),
|
||||||
|
RequireSSL => $c->param('requireSSL'),
|
||||||
|
Indexes => $c->param('indexes'),
|
||||||
|
DynamicContent => $c->param('dynamic'),
|
||||||
|
type => 'share',
|
||||||
|
}) or return $c->l('sf_CANT_CREATE_SHARE');
|
||||||
|
|
||||||
|
# Set up encrypted filesystem if needed
|
||||||
|
if ($encryption eq 'enabled') {
|
||||||
|
my $source = "/home/e-smith/files/shares/$name/.store";
|
||||||
|
my $dest = "/home/e-smith/files/shares/$name/files";
|
||||||
|
File::Path::mkpath($source);
|
||||||
|
mkdir $dest;
|
||||||
|
|
||||||
|
open(my $dir, "| /usr/bin/encfs -S --public -o nonempty,umask=000 $source $dest > /dev/null 2>&1")
|
||||||
|
or die "Failed to open encfs command: $!";
|
||||||
|
print $dir "\n$password";
|
||||||
|
close $dir;
|
||||||
|
|
||||||
|
return $c->l("sf_ERROR_WITH_ENCRYPTION") unless(
|
||||||
|
system("/bin/fusermount -uz $dest") == 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Validate existing share
|
||||||
|
return $c->l('sf_CANT_FIND_SHARE') unless $acct->prop('type') eq 'share';
|
||||||
|
|
||||||
|
# Update share properties
|
||||||
|
$acct->merge_props(
|
||||||
|
Name => $c->param('description'),
|
||||||
|
InactivityTimeOut => ($c->param('inactivity') || ''),
|
||||||
|
RecycleBin => $c->param('recyclebin'),
|
||||||
|
RecycleBinRetention => $c->param('retention'),
|
||||||
|
smbAccess => $c->param('smbaccess'),
|
||||||
|
httpAccess => $c->param('httpaccess'),
|
||||||
|
WebDav => $c->param('webdav'),
|
||||||
|
Pydio => ($c->param('pydio') || 'disabled'),
|
||||||
|
RequireSSL => $c->param('requireSSL'),
|
||||||
|
Indexes => $c->param('indexes'),
|
||||||
|
DynamicContent => $c->param('dynamic'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Untaint and execute system command
|
||||||
|
$name =~ /(.+)/ && ($name = $1);
|
||||||
|
my $event = $is_create ? "share-create" : "share-modify";
|
||||||
|
|
||||||
|
if (system("/sbin/e-smith/signal-event", $event, $name) == 0) {
|
||||||
|
return $c->l('ok')
|
||||||
|
# $is_create ? "SUCCESSFULLY_CREATED_SHARE" : "SUCCESSFULLY_MODIFIED_SHARE",
|
||||||
|
# $is_create ? "Permissions" : ()
|
||||||
|
# );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$c->l($is_create ? "sf_ERROR_WHILE_CREATING_SHARE" : "sf_ERROR_WHILE_MODIFYING_SHARE");
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub modify_perm {
|
||||||
|
my $c = shift;
|
||||||
|
my $name = $c->param('name');
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
my $acct = $adb->get($name);
|
||||||
|
|
||||||
|
return $c->l('sf_CANT_FIND_SHARE') unless($acct && $acct->prop('type') eq 'share');
|
||||||
|
|
||||||
|
my $encryption = $acct->prop('Encryption') || 'disabled';
|
||||||
|
|
||||||
|
my $WriteGroups = join(",", $c->param('writegroup'));
|
||||||
|
my $WriteUsers = join(",", $c->param('writeuser'));
|
||||||
|
|
||||||
|
my @CleanReadGroups = ();
|
||||||
|
my @CleanReadUsers = ();
|
||||||
|
|
||||||
|
# EncFS doesn't expose underlying ACLs
|
||||||
|
# So, just remove any read only groups
|
||||||
|
# Read Only is not supported with encryption
|
||||||
|
if ($encryption ne 'enabled'){
|
||||||
|
# No need to have read access if write is already granted
|
||||||
|
foreach my $group ($c->param('readgroup')){
|
||||||
|
push (@CleanReadGroups, $group) unless (grep { $_ eq $group } $c->param('writegroup'));
|
||||||
|
}
|
||||||
|
foreach my $user ($c->param('readuser')){
|
||||||
|
push (@CleanReadUsers, $user) unless (grep { $_ eq $user } $c->param('writeuser'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
my $ReadGroups = join(",",@CleanReadGroups);
|
||||||
|
my $ReadUsers = join(",",@CleanReadUsers);
|
||||||
|
|
||||||
|
$acct->merge_props(
|
||||||
|
WriteGroups => $WriteGroups,
|
||||||
|
ReadGroups => $ReadGroups,
|
||||||
|
WriteUsers => $WriteUsers,
|
||||||
|
ReadUsers => $ReadUsers,
|
||||||
|
);
|
||||||
|
|
||||||
|
# Untaint $name before use in system()
|
||||||
|
$name =~ /(.+)/; $name = $1;
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "share-modify", $name) == 0) {
|
||||||
|
return 'ok'; #$c->success("sf_SUCCESSFULLY_MODIFIED_SHARE");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $c->l("sf_ERROR_WHILE_MODIFYING_SHARE");
|
||||||
|
}
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove a share
|
||||||
|
sub remove_share {
|
||||||
|
my $c = shift;
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
my $name = $c->param('name');
|
||||||
|
my $acct = $adb->get($name);
|
||||||
|
return $c->l('sf_CANCELED','First') if ($c->param('cancel'));
|
||||||
|
return $c->l('sf_CANT_FIND_SHARE') unless ($acct && $acct->prop('type') eq 'share');
|
||||||
|
|
||||||
|
# Untaint $name before use in system()
|
||||||
|
$name =~ /(.+)/; $name = $1;
|
||||||
|
my $encryption = $acct->prop('Encryption') || 'disabled';
|
||||||
|
my $mountstatus = `/bin/mount | grep /home/e-smith/files/shares/$name/ | grep -c fuse`;
|
||||||
|
chomp($mountstatus);
|
||||||
|
|
||||||
|
if (($encryption eq 'enabled') && ($mountstatus eq '1')){
|
||||||
|
$c->l("sf_ERROR_ENCRYPTED_ENABLED");
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
|
||||||
|
$acct->set_prop('type', 'share-deleted');
|
||||||
|
|
||||||
|
if (system ("/sbin/e-smith/signal-event", "share-delete", $name) == 0) {
|
||||||
|
return 'ok'; #$c->success("SUCCESSFULLY_DELETED_SHARE");
|
||||||
|
$acct->delete();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$c->l("sf_ERROR_WHILE_DELETING_SHARE");
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check the proposed name for clashes with existing pseudonyms or other
|
||||||
|
# accounts of any type.
|
||||||
|
|
||||||
|
sub conflict_check {
|
||||||
|
my ($c, $name) = @_;
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
my $rec = $adb->get($name);
|
||||||
|
|
||||||
|
my $type;
|
||||||
|
if (defined $rec){
|
||||||
|
my $type = $rec->prop('type');
|
||||||
|
if ($type eq "pseudonym"){
|
||||||
|
my $acct = $rec->prop("Account");
|
||||||
|
my $acct_type = $adb->get($acct)->prop('type');
|
||||||
|
|
||||||
|
return $c->l('sf_ACCT_CLASHES_WITH_PSEUDONYM',
|
||||||
|
{acctName => $name, acctType => $acct_type, acct => $acct});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif (defined getpwnam($name) || defined getgrnam($name)){
|
||||||
|
$type = 'system';
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
# No account record and no account
|
||||||
|
return 'ok';
|
||||||
|
}
|
||||||
|
return $c->l('sf_ACCOUNT_EXISTS',
|
||||||
|
{acctName => $name, acctType => $type});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Checks that the name supplied does not contain any unacceptable chars.
|
||||||
|
# Returns OK on success or a localised error message otherwise.
|
||||||
|
sub validate_name {
|
||||||
|
my ($c, $acctName) = @_;
|
||||||
|
|
||||||
|
unless ($acctName =~ /^([a-z0-9][\_\.\-a-z0-9]*)\$?$/){
|
||||||
|
return $c->l('sf_ACCT_NAME_HAS_INVALID_CHARS',
|
||||||
|
{acctName => $acctName});
|
||||||
|
}
|
||||||
|
return 'ok';
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if inactivity is a number
|
||||||
|
sub validate_inactivity {
|
||||||
|
my ($c, $inac) = @_;
|
||||||
|
|
||||||
|
unless ($inac =~ /^\d+$/){
|
||||||
|
return $c->l('sf_INVALID_INACTIVITY',
|
||||||
|
{inactivity => $inac});
|
||||||
|
}
|
||||||
|
return 'ok';
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if both passwords match
|
||||||
|
# and are more than 8 chars
|
||||||
|
sub confirm_password {
|
||||||
|
|
||||||
|
my ($c, $pass1, $pass2) = @_;
|
||||||
|
|
||||||
|
return 'ok' if ($c->{cgi}->param('encryption') eq 'disabled');
|
||||||
|
|
||||||
|
my @num = split(//,$pass1);
|
||||||
|
unless (scalar (@num) >= 8){
|
||||||
|
return $c->l('sf_PASSWORD_TOO_SHORT');
|
||||||
|
}
|
||||||
|
|
||||||
|
unless ($pass1 eq $pass2){
|
||||||
|
return $c->l('sf_PASSWORD_MISMATCH');
|
||||||
|
}
|
||||||
|
return 'ok';
|
||||||
|
}
|
||||||
|
|
||||||
|
sub max_share_name_length {
|
||||||
|
my ($c, $data) = @_;
|
||||||
|
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||||
|
my $rec = $cdb->get('maxShareNameLength');
|
||||||
|
my $max = (defined $rec ? $rec->value : '12');
|
||||||
|
|
||||||
|
if (length($data) <= $max) {
|
||||||
|
return "ok";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $c->l("sf_MAX_SHARE_NAME_LENGTH_ERROR",
|
||||||
|
{acctName => $data,
|
||||||
|
maxShareNameLength => $max,
|
||||||
|
maxLength => $max});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
398
root/usr/share/smanager/lib/SrvMngr/Controller/Shares.pm
Normal file
398
root/usr/share/smanager/lib/SrvMngr/Controller/Shares.pm
Normal file
@ -0,0 +1,398 @@
|
|||||||
|
package SrvMngr::Controller::Shares;
|
||||||
|
#
|
||||||
|
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
# Remember that each route must be unique (else they just overwrite each other).
|
||||||
|
# you cannot have get and post on the same name and url.
|
||||||
|
#
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
# heading : Network
|
||||||
|
# description : Shared Folders
|
||||||
|
# navigation : 7000 400
|
||||||
|
#
|
||||||
|
# name : shares, method : get, url : /shares, ctlact : Shares#main
|
||||||
|
# name : sharesu, method : post, url : /sharesu, ctlact : Shares#do_update
|
||||||
|
# name : sharesd, method : get, url : /sharesd, ctlact : Shares#do_display
|
||||||
|
#
|
||||||
|
# routes : end
|
||||||
|
#
|
||||||
|
# Documentation: https://wiki.contribs.org/Shares
|
||||||
|
#----------------------------------------------------------------------
|
||||||
|
|
||||||
|
#
|
||||||
|
# Scheme of things:
|
||||||
|
#
|
||||||
|
# TBA!!
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Mojo::Base 'Mojolicious::Controller';
|
||||||
|
|
||||||
|
use constant FALSE => 0;
|
||||||
|
use constant TRUE => 1;
|
||||||
|
|
||||||
|
use Locale::gettext;
|
||||||
|
use SrvMngr::I18N;
|
||||||
|
use SrvMngr qw(theme_list init_session);
|
||||||
|
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
|
use esmith::util;
|
||||||
|
use esmith::util::network;
|
||||||
|
use esmith::ConfigDB;
|
||||||
|
use esmith::AccountsDB;
|
||||||
|
use esmith::NetworksDB;
|
||||||
|
use esmith::HostsDB;
|
||||||
|
use esmith::DomainsDB;
|
||||||
|
|
||||||
|
my $cdb;
|
||||||
|
my $adb;
|
||||||
|
my $ndb;
|
||||||
|
my $hdb;
|
||||||
|
my $ddb;
|
||||||
|
|
||||||
|
my %sf_data;
|
||||||
|
|
||||||
|
require '/usr/share/smanager/lib/SrvMngr/Controller/Shares-Custom.pm'; #The code that is to be added by the developer
|
||||||
|
|
||||||
|
sub main {
|
||||||
|
#
|
||||||
|
# Initial entry - route is "/<whatever>"
|
||||||
|
#
|
||||||
|
#set initial panel
|
||||||
|
#for initial panel:
|
||||||
|
#Specifiy panel to enter
|
||||||
|
#load up _data hash with DB fields
|
||||||
|
#load up stash with pointer(s) to control fields hash(= get-))
|
||||||
|
#and a pointer to the prefix_data hash
|
||||||
|
#render initial panel
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info( $c->log_req );
|
||||||
|
|
||||||
|
#The most common ones
|
||||||
|
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||||
|
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||||
|
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||||
|
|
||||||
|
%sf_data = ();
|
||||||
|
my $title = $c->l('sf_Shared_Folders');
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
$sf_data{'trt'} = 'LIST';
|
||||||
|
|
||||||
|
#Load any DB entries into the <prefix>_data area so as they are preset in the form
|
||||||
|
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
|
||||||
|
my $db = $cdb; #pickup local or global db or Default to config
|
||||||
|
|
||||||
|
|
||||||
|
$c->do_display($sf_data{'trt'});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Post request with params - submit from the form
|
||||||
|
sub do_update {
|
||||||
|
#
|
||||||
|
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
|
||||||
|
# parameters in the params hash.
|
||||||
|
#
|
||||||
|
#load up all params into prefix_data hash:
|
||||||
|
#By panel (series of if statements - only one executed):
|
||||||
|
#call validate-PANEL() - return ret = ok or error message
|
||||||
|
|
||||||
|
#if validation not ok:
|
||||||
|
#render back to current panel with error message in stash
|
||||||
|
#otherwise:
|
||||||
|
#By panel (series of if statements - only one executed):
|
||||||
|
#do whatever is required: call perform-PANEL() - return "ok" or Error Message
|
||||||
|
#call signal-event for any global actions specified (check it exists - error and continue?)
|
||||||
|
#if action smeserver-<whatever>-update exists
|
||||||
|
#signal_event smeserver-<whatever>-update
|
||||||
|
#call signal-event for any specific actions for thids panel (check it exists first - error and continue)
|
||||||
|
#set success in stash
|
||||||
|
#if no "nextpanel" entry:
|
||||||
|
#set firstpanel
|
||||||
|
#else
|
||||||
|
#set nextpanel
|
||||||
|
#call render
|
||||||
|
|
||||||
|
my $c = shift;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
my $modul = '';
|
||||||
|
|
||||||
|
#The most common ones - you might want to comment out any not used.
|
||||||
|
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||||
|
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||||
|
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||||
|
|
||||||
|
my $title = $c->l('sf_Shared_Folders');
|
||||||
|
|
||||||
|
# Accessing all POST/GET parameters
|
||||||
|
my $params = $c->req->params->to_hash;
|
||||||
|
|
||||||
|
# Get number of POST parameters
|
||||||
|
#my $num_params = keys scaler %$params;
|
||||||
|
|
||||||
|
#Params are available in the hash "params" - copy to the prefix_data hash
|
||||||
|
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
|
||||||
|
# $sf_data{$key} = $value;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# the value of trt will tell you which panel has returned
|
||||||
|
my $trt = $c->param('trt') || 'LIST'; #hidden control on every form.
|
||||||
|
my $ret = 'ok';
|
||||||
|
|
||||||
|
#Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
|
||||||
|
my $thispanel;
|
||||||
|
|
||||||
|
if ($trt eq 'LIST'){
|
||||||
|
#Validate form parameters for panel LIST
|
||||||
|
$ret = $c->validate_LIST(\%sf_data);
|
||||||
|
$thispanel = 'LIST';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'MODIFY'){
|
||||||
|
#Validate form parameters for panel MODIFY
|
||||||
|
$ret = $c->validate_MODIFY(\%sf_data);
|
||||||
|
$thispanel = 'MODIFY';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'PERMISSIONS'){
|
||||||
|
#Validate form parameters for panel PERMISSIONS
|
||||||
|
$ret = $c->validate_PERMISSIONS(\%sf_data);
|
||||||
|
$thispanel = 'PERMISSIONS';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'REMOVE'){
|
||||||
|
#Validate form parameters for panel REMOVE
|
||||||
|
$ret = $c->validate_REMOVE(\%sf_data);
|
||||||
|
$thispanel = 'REMOVE';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ret ne "ok"){
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->do_display($thispanel);
|
||||||
|
} else {
|
||||||
|
#Do whatever is needed, including writing values to the DB
|
||||||
|
|
||||||
|
|
||||||
|
if ($trt eq 'LIST'){
|
||||||
|
#do whatever is required ...
|
||||||
|
$ret = $c->perform_LIST(\%sf_data);
|
||||||
|
if ($ret ne "ok") {
|
||||||
|
# return to the panel with error message
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
sf_data => \%sf_data
|
||||||
|
);
|
||||||
|
$c->render(template => "shares");
|
||||||
|
} else {
|
||||||
|
$c->stash( success => $c->l('sf_LIST_panel_action_was_successful')); #A bit bland - edit it in the lex file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'MODIFY'){
|
||||||
|
#do whatever is required ...
|
||||||
|
$ret = $c->perform_MODIFY(\%sf_data);
|
||||||
|
if ($ret ne "ok") {
|
||||||
|
# return to the panel with error message
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
sf_data => \%sf_data
|
||||||
|
);
|
||||||
|
$c->render(template => "shares");
|
||||||
|
} else {
|
||||||
|
$c->stash( success => $c->l('sf_MODIFY_panel_action_was_successful')); #A bit bland - edit it in the lex file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'PERMISSIONS'){
|
||||||
|
#do whatever is required ...
|
||||||
|
$ret = $c->perform_PERMISSIONS(\%sf_data);
|
||||||
|
if ($ret ne "ok") {
|
||||||
|
# return to the panel with error message
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
sf_data => \%sf_data
|
||||||
|
);
|
||||||
|
$c->render(template => "shares");
|
||||||
|
} else {
|
||||||
|
$c->stash( success => $c->l('sf_PERMISSIONS_panel_action_was_successful')); #A bit bland - edit it in the lex file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'REMOVE'){
|
||||||
|
#do whatever is required ...
|
||||||
|
$ret = $c->perform_REMOVE(\%sf_data);
|
||||||
|
if ($ret ne "ok") {
|
||||||
|
# return to the panel with error message
|
||||||
|
$c->stash(error => $c->l($ret));
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
sf_data => \%sf_data
|
||||||
|
);
|
||||||
|
$c->render(template => "shares");
|
||||||
|
} else {
|
||||||
|
$c->stash( success => $c->l('sf_REMOVE_panel_action_was_successful')); #A bit bland - edit it in the lex file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# and call any signal-events needed
|
||||||
|
#TBD
|
||||||
|
# Setup shared data and call panel
|
||||||
|
if ('none' eq 'none') {
|
||||||
|
$sf_data{'trt'} = 'LIST';
|
||||||
|
} else {
|
||||||
|
$sf_data{'trt'} = 'none';
|
||||||
|
}
|
||||||
|
$c->do_display($sf_data{'trt'});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_display {
|
||||||
|
#
|
||||||
|
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
|
||||||
|
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
|
||||||
|
#
|
||||||
|
# OR it maybe a post from the main panel to add a new record
|
||||||
|
#
|
||||||
|
#load up all supplied params into prefix_data hash
|
||||||
|
#call get-selected-PANEL() - returns hash of all relevent parameters
|
||||||
|
#load up returned hash into prefix_data
|
||||||
|
#render - to called panel
|
||||||
|
|
||||||
|
my ($c,$trt) = @_;
|
||||||
|
$c->app->log->info($c->log_req);
|
||||||
|
|
||||||
|
#The most common ones - you might want to comment out any not used.
|
||||||
|
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
|
||||||
|
$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
|
||||||
|
$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
|
||||||
|
$hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
|
||||||
|
$ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
|
||||||
|
|
||||||
|
my $title = $c->l('sf_Shared_Folders');
|
||||||
|
my $modul = "";
|
||||||
|
|
||||||
|
# Accessing all parameters
|
||||||
|
my $params = $c->req->params->to_hash;
|
||||||
|
|
||||||
|
# Get number of parameters
|
||||||
|
my $num_params = keys %$params;
|
||||||
|
|
||||||
|
#Tag as Post or Get (ie. create new entry or edit existing one
|
||||||
|
my $is_new_record = ($c->req->method() eq 'POST');
|
||||||
|
|
||||||
|
#Params are available in the hash "params" - copy to the prefix_data hash
|
||||||
|
#while (my ($key, $value) = each %{$c->req->params->to_hash}) {
|
||||||
|
# $sf_data{$key} = $value;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# the value of trt will tell you which panel has returned
|
||||||
|
if (! $trt){
|
||||||
|
$trt = $c->param('trt') || 'LIST'; #Indicates where to go now
|
||||||
|
}
|
||||||
|
|
||||||
|
# Now add in the params from the selected row from the table
|
||||||
|
|
||||||
|
my %selectedrow;
|
||||||
|
|
||||||
|
if ($trt eq 'LIST'){
|
||||||
|
#Validate Get selected row (if applicable) LIST
|
||||||
|
%selectedrow = $c->get_selected_LIST($sf_data{'Selected'},$is_new_record);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'MODIFY'){
|
||||||
|
#Validate Get selected row (if applicable) MODIFY
|
||||||
|
%selectedrow = $c->get_selected_MODIFY($sf_data{'Selected'},$is_new_record);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'PERMISSIONS'){
|
||||||
|
#Validate Get selected row (if applicable) PERMISSIONS
|
||||||
|
%selectedrow = $c->get_selected_PERMISSIONS($sf_data{'Selected'},$is_new_record);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'REMOVE'){
|
||||||
|
#Validate Get selected row (if applicable) REMOVE
|
||||||
|
%selectedrow = $c->get_selected_REMOVE($sf_data{'Selected'},$is_new_record);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#Copy in the selected row params to the prefix_data hash to pass to the panel
|
||||||
|
while (my ($key, $value) = each %selectedrow){
|
||||||
|
$sf_data{$key} = $value;
|
||||||
|
}
|
||||||
|
# Where to go now
|
||||||
|
$sf_data{'trt'} = $trt;
|
||||||
|
|
||||||
|
# Set up other shared data according to the panel to go to
|
||||||
|
|
||||||
|
if ($trt eq 'LIST'){
|
||||||
|
# pickup any other contents needed and load them into hash shared with panel
|
||||||
|
my %returned_hash;
|
||||||
|
# subroutine returns a hash directly
|
||||||
|
%returned_hash = $c->get_data_for_panel_LIST();
|
||||||
|
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||||
|
while (my ($key, $value) = each %returned_hash) {
|
||||||
|
$sf_data{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'MODIFY'){
|
||||||
|
# pickup any other contents needed and load them into hash shared with panel
|
||||||
|
my %returned_hash;
|
||||||
|
# subroutine returns a hash directly
|
||||||
|
%returned_hash = $c->get_data_for_panel_MODIFY();
|
||||||
|
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||||
|
while (my ($key, $value) = each %returned_hash) {
|
||||||
|
$sf_data{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'PERMISSIONS'){
|
||||||
|
# pickup any other contents needed and load them into hash shared with panel
|
||||||
|
my %returned_hash;
|
||||||
|
# subroutine returns a hash directly
|
||||||
|
%returned_hash = $c->get_data_for_panel_PERMISSIONS();
|
||||||
|
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||||
|
while (my ($key, $value) = each %returned_hash) {
|
||||||
|
$sf_data{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($trt eq 'REMOVE'){
|
||||||
|
# pickup any other contents needed and load them into hash shared with panel
|
||||||
|
my %returned_hash;
|
||||||
|
# subroutine returns a hash directly
|
||||||
|
%returned_hash = $c->get_data_for_panel_REMOVE();
|
||||||
|
# Copy each key-value pair from the returned hash to the prefix data hash
|
||||||
|
while (my ($key, $value) = each %returned_hash) {
|
||||||
|
$sf_data{$key} = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# and table control fields
|
||||||
|
$c->stash(Table1=>$c->get_Table1());
|
||||||
|
$c->stash(Table2=>$c->get_Table2());
|
||||||
|
|
||||||
|
|
||||||
|
# Data for panel
|
||||||
|
$c->stash(
|
||||||
|
title => $title,
|
||||||
|
modul => $modul,
|
||||||
|
sf_data => \%sf_data
|
||||||
|
);
|
||||||
|
$c->render(template => "shares");
|
||||||
|
}
|
||||||
|
1;
|
@ -1,125 +0,0 @@
|
|||||||
package SrvMngr::I18N::Modules::Shared_folders::en;
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
use utf8;
|
|
||||||
use Mojo::Base 'SrvMngr::I18N';
|
|
||||||
|
|
||||||
use SrvMngr::I18N::Modules::General::en;
|
|
||||||
|
|
||||||
my %lexicon = (
|
|
||||||
|
|
||||||
'shf_title' => 'Shared Folders',
|
|
||||||
'shf_FORM_TITLE' => ' Create, modify, or remove shared folders',
|
|
||||||
'shf_FIRSTPAGE_DESC' => ' You can remove any shared folder by clicking on the corresponding command next to the shared folder.',
|
|
||||||
'shf_ADD_TITLE' => ' Create or modify a shared folder',
|
|
||||||
'shf_NAME_FIELD_DESC' => ' The share name should contain only lower-case letters, numbers, periods, hyphens and underscores, and should start with a lower-case letter. For example "johnson", "intra", and "cust3.prj12" are all valid names, but "3associates", "John Smith" and "Bus!Partner" are not. The name is limited to [_1] characters.',
|
|
||||||
'shf_NAME_LABEL' => ' Shared folder name',
|
|
||||||
'shf_REMOVE_TITLE' => ' Remove shared folder',
|
|
||||||
'shf_REMOVE_DESC' => '
|
|
||||||
You are about to remove the following shared folder<br>
|
|
||||||
All files belonging to this shared folder will be deleted.<br>
|
|
||||||
Are you sure you wish to remove it ?<br>
|
|
||||||
',
|
|
||||||
'shf_ERROR_WHILE_CREATING_SHARE' => ' An error occurred while creating the shared folder.',
|
|
||||||
'shf_SUCCESSFULLY_CREATED_SHARE' => ' Successfully created shared folder.',
|
|
||||||
'shf_NO_SHARES' => ' There are no shared folders currently configured.',
|
|
||||||
'shf_CANT_FIND_SHARE' => ' Can\'t find account for [_1] (does it exist?)',
|
|
||||||
'shf_CANT_CREATE_SHARE' => ' Can\'t create new account for [_1] (does it already exist?)',
|
|
||||||
'shf_ERROR_WHILE_MODIFYING_SHARE' => ' An error occurred while modifying the shared folder.',
|
|
||||||
'shf_SUCCESSFULLY_MODIFIED_SHARE' => ' Successfully modified shared folder.',
|
|
||||||
'shf_SUCCESSFULLY_DELETED_SHARE' => ' Successfully deleted shared folder.',
|
|
||||||
'shf_ERROR_WHILE_DELETING_SHARE' => ' An error occurred while deleting the share.',
|
|
||||||
'shf_Shares' =>
|
|
||||||
'Shares',
|
|
||||||
'shf_INVALID_SHARE_DESCRIPTION' =>
|
|
||||||
'Error: unexpected or missing characters in share description',
|
|
||||||
'shf_ACCT_NAME_HAS_INVALID_CHARS' =>
|
|
||||||
'The shared folder name "[_1]" contains invalid characters. Shared folder names must start with a lower case letter and contain only lower case letters, numbers, and hyphens.',
|
|
||||||
'shf_MAX_SHARE_NAME_LENGTH_ERROR' => ' The shared folder name "[_1]" is too long. The maximum is [_1] characters.',
|
|
||||||
'shf_ACCT_CLASHES_WITH_PSEUDONYM' => '
|
|
||||||
The account "[_1]" clashes with pseudonym details for [_2] account "[_3]". <p>[_2] is a pseudonym for [_1].</p>
|
|
||||||
',
|
|
||||||
'shf_ACCOUNT_EXISTS' => ' The account "[_1]" is an existing [_2] account.',
|
|
||||||
'shf_LABEL_ADD_SHARE_BUTTON' => ' Create a new shared folder',
|
|
||||||
'shf_DESC_PERMISSIONS' => ' You can use this matrix to define groups and users access permissions.',
|
|
||||||
'shf_DESC_SMB_SETTINGS' => ' The following settings control the access of this shared folder from the local network, using the SMB/CIFS protocol. ',
|
|
||||||
'shf_LABEL_SMB_ACCESS' => ' SMB Access',
|
|
||||||
'shf_LABEL_RECYCLEBIN' => ' Recycle bin',
|
|
||||||
'shf_LABEL_RETENTION' => ' Retention time',
|
|
||||||
'shf_UNLIMITED' => ' unlimited',
|
|
||||||
'shf_ONE_WEEK' => ' one week',
|
|
||||||
'shf_ONE_MONTH' => ' one month',
|
|
||||||
'shf_SIX_MONTHS' => ' six months',
|
|
||||||
'shf_ONE_YEAR' => ' one year',
|
|
||||||
'shf_DESC_HTTP_SETTINGS' => ' The following settings control the access of this shared folder using the HTTP/HTTPS protocol.',
|
|
||||||
'shf_LABEL_HTTP_ACCESS' => ' Web Access',
|
|
||||||
'shf_LABEL_WEBDAV' => ' WebDav support',
|
|
||||||
'shf_LABEL_REQUIRE_SSL' => ' Force secure connections',
|
|
||||||
'shf_LABEL_INDEXES' => ' Indexes',
|
|
||||||
'shf_LABEL_DYNAMIC_CONTENT' => ' Dynamic content execution (PHP, CGI, SSI)',
|
|
||||||
'shf_LOCAL_NETWORK_NO_PASSWORD' => 'Local network (no password required)',
|
|
||||||
'shf_LOCAL_NETWORK_PASSWORD' => 'Local network (password required)',
|
|
||||||
'shf_ENTIRE_INTERNET_NO_PASSWORD' => 'Entire Internet (no password required)',
|
|
||||||
'shf_ENTIRE_INTERNET_PASSWORD' => 'Entire Internet (password required)',
|
|
||||||
'shf_ENTIRE_INTERNET_PASSWORD_REMOTE' => 'Entire Internet (password required outside local network)',
|
|
||||||
'shf_NONE' => 'No access',
|
|
||||||
'shf_ENABLED_BROWSEABLE' => 'Enabled, browseable',
|
|
||||||
'shf_ENABLED_NON_BROWSEABLE' => 'Enabled, hidden',
|
|
||||||
'shf_DONT_KEEP_VERSIONS' => 'Enabled, keep only the latest version',
|
|
||||||
'shf_KEEP_VERSIONS' => 'Enabled, keep a copy of all versions',
|
|
||||||
'shf_PERMISSIONS' => ' Permissions',
|
|
||||||
'shf_WRITE_PERM' => ' Read / Write',
|
|
||||||
'shf_READ_PERM' => ' Read Only',
|
|
||||||
'shf_ENABLED' => ' enabled',
|
|
||||||
'shf_DISABLED' => ' disabled',
|
|
||||||
'shf_YES' => ' yes',
|
|
||||||
'shf_NO' => ' no',
|
|
||||||
'shf_NAME' => 'Name',
|
|
||||||
'shf_DESCRIPTION' => 'Description',
|
|
||||||
'shf_ACTION' => ' Action',
|
|
||||||
'shf_MODIFY' => ' Modify',
|
|
||||||
'shf_REMOVE' => ' Remove',
|
|
||||||
'shf_CANCELED' => ' Cancelled',
|
|
||||||
'shf_MANUAL_PERMS' => ' <span style="color:red">Permissions on this shared folder are managed manually, modifications will only affect web access if a password is required.</span><br><br>',
|
|
||||||
'shf_DESC_ENCRYPTION' => ' The followings options let you protect your data. If encryption is enabled, the data will never be stored in clear text on the server. Your share will either be "available" (data will appear as clear text, encryption/decryption is done on the fly), or protected (only the ciphered data is available on the server). Encryption can only be set at shared folder creation time. Also, read only groups are not supported with encrypted shared folders. If you enable encryption, only members of groups with read/write privileges will be able to access this share.',
|
|
||||||
'shf_LABEL_ENCRYPTION' => ' Encryption',
|
|
||||||
'shf_DESC_PASSWORD' => ' You need to choose a password to protect your data. This password must be at least 8 characters long. Do not loose this password. If you forget it, your data will be lost because there\'s no way to recover it.',
|
|
||||||
'shf_LABEL_PASSWORD' => ' Password',
|
|
||||||
'shf_LABEL_PASSWORD2' => ' Password (confirmation)',
|
|
||||||
'shf_DESC_INACTIVITY' => ' To provide additional security, you can set an inactivity time out (in minutes). When the data is available, if nobody access it for this period of time, the data will go back to protected mode automatically.',
|
|
||||||
'shf_INACTIVITY' => ' Inactivity timeout',
|
|
||||||
'shf_ERROR_WITH_ENCRYPTION' => ' An error occured while performing initial folder encryption',
|
|
||||||
'shf_ERROR_ENCRYPTED_ENABLED' => ' This shared folder is encrypted and access is enabled. You have to put it in protected mode before removing it',
|
|
||||||
'shf_INVALID_INACTIVITY' => ' Inactivity value must be numbers only',
|
|
||||||
'shf_PASSWORD_MISMATCH' => ' Passwords don\'t match',
|
|
||||||
'shf_PASSWORD_TOO_SHORT' => ' Password is too short, please use at least 8 characters',
|
|
||||||
'shf_DESC_PYDIO' => ' The following settings control the access of this shared folder with the web based file manager Pydio (formerly AjaXplorer)',
|
|
||||||
'shf_LABEL_PYDIO' => ' Pydio Access',
|
|
||||||
'shf_TITLE_PERMISSIONS' => ' Access right management',
|
|
||||||
'shf_USERS' => 'Users',
|
|
||||||
|
|
||||||
'shf_ENCRYPT_FORM_TITLE' => 'Shared Folders Encryption',
|
|
||||||
'shf_ENCRYPT_Shared Folders Encryption' => 'Shared Folders Encryption',
|
|
||||||
'shf_ENCRYPT_FIRSTPAGE_DESC' =>'This panel lets you enable encrypted shared folder access.',
|
|
||||||
'shf_ENCRYPT_STATUS' => 'Status',
|
|
||||||
'shf_ENCRYPT_MOUNTED' => 'Enabled',
|
|
||||||
'shf_ENCRYPT_NOT_MOUNTED' => 'Protected',
|
|
||||||
'shf_ENCRYPT_MOUNT' =>'Enable',
|
|
||||||
'shf_ENCRYPT_UMOUNT' => 'Protect',
|
|
||||||
'shf_ENCRYPT_ERROR_MOUNTING' => 'An error occured. Check that you have the correct password.',
|
|
||||||
'shf_ENCRYPT_UMOUNT_DESC' => 'Are you sure you want to protect this shared folder ? Once protected, the content won\'t be accessible until re-enabled with the associated password.',
|
|
||||||
'shf_ENCRYPT_MOUNT_DESC' => 'You have to enter the password to make this folder\'s content available.',
|
|
||||||
'shf_ENCRYPT_LABEL_MOUNT_PASSWORD' => 'Password',
|
|
||||||
'shf_ENCRYPT_VALIDATE' => 'Validate',
|
|
||||||
'shf_ENCRYPT_NO_ENCRYPTED_SHARE' => 'No encrypted share configured',
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
our %Lexicon = (
|
|
||||||
%{ SrvMngr::I18N::Modules::General::en::Lexicon },
|
|
||||||
%lexicon
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
1;
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
|||||||
|
package SrvMngr::I18N::Modules::Shares::en;
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use utf8;
|
||||||
|
use Mojo::Base 'SrvMngr::I18N';
|
||||||
|
|
||||||
|
use SrvMngr::I18N::Modules::General::en;
|
||||||
|
|
||||||
|
my %lexicon = (
|
||||||
|
#
|
||||||
|
# Generated by SM2Gen version: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
#
|
||||||
|
'sf_readgroup' => 'regroup',
|
||||||
|
'sf_Description' => 'Description',
|
||||||
|
'sf_dynamic' => 'Dynamic',
|
||||||
|
'sf_description' => 'Description',
|
||||||
|
'sf_The_following_settings_control_the' => 'The following settings control the access of this shared folder using the HTTP/HTTPS protocol',
|
||||||
|
'sf_Create,_modify,_or_remove_shared' => 'create modify Or remove shared folders',
|
||||||
|
'sf_Remove' => 'Remove',
|
||||||
|
'sf_httpaccess' => 'Httpaccess',
|
||||||
|
'sf_readuser' => 'reader',
|
||||||
|
'sf_Cancel' => 'Cancel',
|
||||||
|
'sf_All_files_belonging_to_this' => 'All files belonging to this shared folder will be deleted',
|
||||||
|
'sf_smbaccess' => 'Smbaccess',
|
||||||
|
'sf_You_can_use_this_matrix' => 'You can use this matrix to define groups and users access permissions',
|
||||||
|
'sf_webdav' => 'Webdav',
|
||||||
|
'sf_Create_a_new_shared_folder' => 'Create a new shared folder',
|
||||||
|
'sf_REMOVE_panel_action_was_successful' => 'REMOVE panel action was successful',
|
||||||
|
'sf_Actionr' => 'action',
|
||||||
|
'sf_You_are_about_to_remove' => 'You are about to remove the following shared folder',
|
||||||
|
'sf_Shared_Folders' => 'Shared Folders',
|
||||||
|
'sf_MODIFY_panel_action_was_successful' => 'MODIFY panel action was successful',
|
||||||
|
'sf_indexes' => 'Indexes',
|
||||||
|
'sf_Are_you_sure_you_wish' => 'Are you sure you wish to remove it ?',
|
||||||
|
'sf_Actionm' => 'action',
|
||||||
|
'sf_writeuser' => 'Writeuser',
|
||||||
|
'sf_LIST_panel_action_was_successful' => 'LIST panel action was successful',
|
||||||
|
'sf_Remove_shared_folder' => 'Remove shared folder',
|
||||||
|
'sf_PERMISSIONS_panel_action_was_successful' => 'PERMISSIONS panel action was successful',
|
||||||
|
'sf_Manage_shared-folders_settings:' => 'Manage shared-folders settings',
|
||||||
|
'sf_You_can_remove_any_shared' => 'You can remove any shared folder by clicking on the corresponding command next to the shared folder',
|
||||||
|
'sf_APPLY' => 'Apply',
|
||||||
|
'sf_requireSSL' => 'requires',
|
||||||
|
'sf_Groups' => 'Groups',
|
||||||
|
'sf_Save' => 'Save',
|
||||||
|
'sf_Actionp' => 'action',
|
||||||
|
'sf_writegroup' => 'Writegroup',
|
||||||
|
'sf_Name' => 'Name',
|
||||||
|
'sf_Read_Only' => 'Read Only',
|
||||||
|
'sf_retention' => 'Retention',
|
||||||
|
'sf_Access_right_management' => 'Access right management',
|
||||||
|
'sf_Read_/_Write' => 'Read / Write',
|
||||||
|
'sf_Create_or_modify_a_shared' => 'Create or modify a shared folder',
|
||||||
|
'sf_The_following_settings_control_the' => 'The following settings control the access of this shared folder from the local network Using the SMB/CIFS protocol',
|
||||||
|
'sf_recyclebin' => 'Recyclebin',
|
||||||
|
);
|
||||||
|
|
||||||
|
our %Lexicon = (
|
||||||
|
%{ SrvMngr::I18N::Modules::General::en::Lexicon },
|
||||||
|
%lexicon
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
@ -0,0 +1,46 @@
|
|||||||
|
#
|
||||||
|
# Generated by SM2Gen version: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
#
|
||||||
|
'sf_readgroup' => 'regroup',
|
||||||
|
'sf_Description' => 'Description',
|
||||||
|
'sf_dynamic' => 'Dynamic',
|
||||||
|
'sf_description' => 'Description',
|
||||||
|
'sf_The_following_settings_control_the' => 'The following settings control the access of this shared folder using the HTTP/HTTPS protocol',
|
||||||
|
'sf_Create,_modify,_or_remove_shared' => 'create modify Or remove shared folders',
|
||||||
|
'sf_Remove' => 'Remove',
|
||||||
|
'sf_httpaccess' => 'Httpaccess',
|
||||||
|
'sf_readuser' => 'reader',
|
||||||
|
'sf_Cancel' => 'Cancel',
|
||||||
|
'sf_All_files_belonging_to_this' => 'All files belonging to this shared folder will be deleted',
|
||||||
|
'sf_smbaccess' => 'Smbaccess',
|
||||||
|
'sf_You_can_use_this_matrix' => 'You can use this matrix to define groups and users access permissions',
|
||||||
|
'sf_webdav' => 'Webdav',
|
||||||
|
'sf_Create_a_new_shared_folder' => 'Create a new shared folder',
|
||||||
|
'sf_REMOVE_panel_action_was_successful' => 'REMOVE panel action was successful',
|
||||||
|
'sf_Actionr' => 'action',
|
||||||
|
'sf_You_are_about_to_remove' => 'You are about to remove the following shared folder',
|
||||||
|
'sf_Shared_Folders' => 'Shared Folders',
|
||||||
|
'sf_MODIFY_panel_action_was_successful' => 'MODIFY panel action was successful',
|
||||||
|
'sf_indexes' => 'Indexes',
|
||||||
|
'sf_Are_you_sure_you_wish' => 'Are you sure you wish to remove it ?',
|
||||||
|
'sf_Actionm' => 'action',
|
||||||
|
'sf_writeuser' => 'Writeuser',
|
||||||
|
'sf_LIST_panel_action_was_successful' => 'LIST panel action was successful',
|
||||||
|
'sf_Remove_shared_folder' => 'Remove shared folder',
|
||||||
|
'sf_PERMISSIONS_panel_action_was_successful' => 'PERMISSIONS panel action was successful',
|
||||||
|
'sf_Manage_shared-folders_settings:' => 'Manage shared-folders settings',
|
||||||
|
'sf_You_can_remove_any_shared' => 'You can remove any shared folder by clicking on the corresponding command next to the shared folder',
|
||||||
|
'sf_APPLY' => 'Apply',
|
||||||
|
'sf_requireSSL' => 'requires',
|
||||||
|
'sf_Groups' => 'Groups',
|
||||||
|
'sf_Save' => 'Save',
|
||||||
|
'sf_Actionp' => 'action',
|
||||||
|
'sf_writegroup' => 'Writegroup',
|
||||||
|
'sf_Name' => 'Name',
|
||||||
|
'sf_Read_Only' => 'Read Only',
|
||||||
|
'sf_retention' => 'Retention',
|
||||||
|
'sf_Access_right_management' => 'Access right management',
|
||||||
|
'sf_Read_/_Write' => 'Read / Write',
|
||||||
|
'sf_Create_or_modify_a_shared' => 'Create or modify a shared folder',
|
||||||
|
'sf_The_following_settings_control_the' => 'The following settings control the access of this shared folder from the local network Using the SMB/CIFS protocol',
|
||||||
|
'sf_recyclebin' => 'Recyclebin',
|
86
root/usr/share/smanager/themes/default/public/css/shares.css
Normal file
86
root/usr/share/smanager/themes/default/public/css/shares.css
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
*/
|
||||||
|
.Shares-panel {}
|
||||||
|
.name {}
|
||||||
|
.rout {}
|
||||||
|
.head {}
|
||||||
|
.subh {}
|
||||||
|
.para1 {}
|
||||||
|
.para2 {}
|
||||||
|
.link1 {}
|
||||||
|
.tabl1 {}
|
||||||
|
thead .tabl1 {}
|
||||||
|
tbody .tabl1 {}
|
||||||
|
.name {}
|
||||||
|
.rout {}
|
||||||
|
.head {}
|
||||||
|
.subh {}
|
||||||
|
.text100 {}
|
||||||
|
.para14 {}
|
||||||
|
.sele101 {}
|
||||||
|
.sele102 {}
|
||||||
|
.sele103 {}
|
||||||
|
.para2 {}
|
||||||
|
.sele104 {}
|
||||||
|
.sele105 {}
|
||||||
|
.sele106 {}
|
||||||
|
.sele107 {}
|
||||||
|
.sele108 {}
|
||||||
|
.subm109 {}
|
||||||
|
.name {}
|
||||||
|
.rout {}
|
||||||
|
.head {}
|
||||||
|
.subh {}
|
||||||
|
.para10 {}
|
||||||
|
.tabl2 {}
|
||||||
|
thead .tabl2 {}
|
||||||
|
tbody .tabl2 {}
|
||||||
|
.chec110 {}
|
||||||
|
.chec111 {}
|
||||||
|
.chec112 {}
|
||||||
|
.chec113 {}
|
||||||
|
.chec114 {}
|
||||||
|
.chec115 {}
|
||||||
|
.chec116 {}
|
||||||
|
.chec117 {}
|
||||||
|
.chec118 {}
|
||||||
|
.chec119 {}
|
||||||
|
.chec120 {}
|
||||||
|
.chec121 {}
|
||||||
|
.chec122 {}
|
||||||
|
.chec123 {}
|
||||||
|
.chec124 {}
|
||||||
|
.chec125 {}
|
||||||
|
.chec126 {}
|
||||||
|
.chec127 {}
|
||||||
|
.chec128 {}
|
||||||
|
.chec129 {}
|
||||||
|
.chec130 {}
|
||||||
|
.chec131 {}
|
||||||
|
.chec132 {}
|
||||||
|
.chec133 {}
|
||||||
|
.chec134 {}
|
||||||
|
.chec135 {}
|
||||||
|
.chec136 {}
|
||||||
|
.chec137 {}
|
||||||
|
.chec138 {}
|
||||||
|
.chec139 {}
|
||||||
|
.chec140 {}
|
||||||
|
.chec141 {}
|
||||||
|
.chec142 {}
|
||||||
|
.chec143 {}
|
||||||
|
.chec144 {}
|
||||||
|
.chec145 {}
|
||||||
|
.chec146 {}
|
||||||
|
.chec147 {}
|
||||||
|
.subm148 {}
|
||||||
|
.name {}
|
||||||
|
.rout {}
|
||||||
|
.head {}
|
||||||
|
.subh {}
|
||||||
|
.para11 {}
|
||||||
|
.para21 {}
|
||||||
|
.para31 {}
|
||||||
|
.subm149 {}
|
||||||
|
.subm150 {}
|
@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
//
|
||||||
|
$(document).ready(function() {
|
||||||
|
});
|
@ -0,0 +1,73 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
%#
|
||||||
|
<div id="Shares-LIST" class="partial Shares-LIST">
|
||||||
|
%# <script>
|
||||||
|
%# window.onload = function() {
|
||||||
|
%# SelectInput();
|
||||||
|
%# };
|
||||||
|
%# </script>
|
||||||
|
% if (config->{debug} == 1) {
|
||||||
|
<pre>
|
||||||
|
%= dumper $sf_data
|
||||||
|
</pre>
|
||||||
|
% }
|
||||||
|
|
||||||
|
% my $btn = l('sf_APPLY');
|
||||||
|
|
||||||
|
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
|
||||||
|
|
||||||
|
%= form_for "sharesu" => (method => 'POST') => begin
|
||||||
|
% param 'trt' => $sf_data->{trt} unless param 'trt';
|
||||||
|
%= hidden_field 'trt' => $sf_data->{trt}
|
||||||
|
%# Inputs etc in here.
|
||||||
|
|
||||||
|
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
|
||||||
|
|
||||||
|
<h2 class='subh'><%=l('sf_Manage_shared-folders_settings:')%></h2>
|
||||||
|
|
||||||
|
<p class='paragraph para1'>
|
||||||
|
%=l('sf_You_can_remove_any_shared')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<p class='paragraph para2'>
|
||||||
|
%=l('sf_Create_a_new_shared_folder')
|
||||||
|
</p>
|
||||||
|
-->
|
||||||
|
<br />
|
||||||
|
<div class = 'inline-buttons'>
|
||||||
|
<a href='sharesd?trt=MODIFY' class='link link1'>
|
||||||
|
%= l('sf_Create_a_new_shared_folder')
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br /><table class="sme-border TableSort sme-table tabl1 ">
|
||||||
|
<thead class='tabl1'>
|
||||||
|
<tr table-head-row>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Name '><%=l('sf_Name')%></th>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Description '><%=l('sf_Description')%></th>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Actionp '><%=l('sf_Actionp')%></th>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Actionm '><%=l('sf_Actionm')%></th>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Actionr '><%=l('sf_Actionr')%></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class='tabl1'>
|
||||||
|
% my $control_data = $c->stash('Table1');
|
||||||
|
% foreach my $row (@$control_data) {
|
||||||
|
<tr class='table-row'>
|
||||||
|
<td class='sme-border table-col table-col-Table1_Name'><%=$c->render_to_string(inline=>$row->{'Table1_Name'})%></td>
|
||||||
|
<td class='sme-border table-col table-col-Table1_Description'><%=$c->render_to_string(inline=>$row->{'Table1_Description'})%></td>
|
||||||
|
<td class='sme-border table-col table-col-Table1_Actionp'><%=$c->render_to_string(inline=>$row->{'Table1_Actionp'})%></td>
|
||||||
|
<td class='sme-border table-col table-col-Table1_Actionm'><%=$c->render_to_string(inline=>$row->{'Table1_Actionm'})%></td>
|
||||||
|
<td class='sme-border table-col table-col-Table1_Actionr'><%=$c->render_to_string(inline=>$row->{'Table1_Actionr'})%></td>
|
||||||
|
</tr>
|
||||||
|
%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
%# Probably finally by a submit.
|
||||||
|
%end
|
||||||
|
</div>
|
@ -0,0 +1,130 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
%#
|
||||||
|
<div id="Shares-MODIFY" class="partial Shares-MODIFY">
|
||||||
|
%# <script>
|
||||||
|
%# window.onload = function() {
|
||||||
|
%# SelectInput();
|
||||||
|
%# };
|
||||||
|
%# </script>
|
||||||
|
% if (config->{debug} == 1) {
|
||||||
|
<pre>
|
||||||
|
%= dumper $sf_data
|
||||||
|
</pre>
|
||||||
|
% }
|
||||||
|
% my $btn = l('sf_APPLY');
|
||||||
|
|
||||||
|
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
|
||||||
|
|
||||||
|
%= form_for "sharesu" => (method => 'POST') => begin
|
||||||
|
% param 'trt' => $sf_data->{trt} unless param 'trt';
|
||||||
|
%= hidden_field 'trt' => $sf_data->{trt}
|
||||||
|
%# Inputs etc in here.
|
||||||
|
|
||||||
|
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
|
||||||
|
|
||||||
|
<h2 class='subh'><%=l('sf_Create_or_modify_a_shared')%></h2>
|
||||||
|
|
||||||
|
|
||||||
|
% if ($sf_data->{name} eq ""){
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_name')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'name' => $sf_data->{name} unless param 'name';
|
||||||
|
%= text_field 'name', size => '50', class => 'textinput name' , pattern=>'.*' , placeholder=>'name', title =>'Pattern regex mismatch', id => 'name_text'
|
||||||
|
<br></span></p>
|
||||||
|
% } else {
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_name')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'name' => $sf_data->{name} unless param 'name';
|
||||||
|
%= text_field 'name', size => '50', class => 'textinput name' , pattern=>'.*' , placeholder=>'name', title =>'Pattern regex mismatch', id => 'name_text', readonly => 1
|
||||||
|
<br></span></p>
|
||||||
|
% }
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_description')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'description' => $sf_data->{description} unless param 'description';
|
||||||
|
%= text_field 'description', size => '50', class => 'textinput description' , pattern=>'.*' , placeholder=>'description', title =>'Pattern regex mismatch', id => 'description_text'
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
|
<p class='paragraph para14'>
|
||||||
|
%=l('sf_The_following_settings_control_the')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_smbaccess')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @smbaccess_options = [['Enabled, browseable' => 'browseable'], ['Enabled, hidden' => 'non-browseable'], ['No access' => 'none']];
|
||||||
|
% param 'smbaccess' => $sf_data->{smbaccess} unless param 'smbaccess';
|
||||||
|
%= select_field 'smbaccess' => @smbaccess_options, class => 'input', id => 'smbaccess_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_recyclebin')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @recyclebin_options = [['disabled' => 'disabled'], ['Enabled, keep only the latest version' => 'enabled'], ['Enabled, keep a copy of all versions' => 'keep-versions']];
|
||||||
|
% param 'recyclebin' => $sf_data->{recyclebin} unless param 'recyclebin';
|
||||||
|
%= select_field 'recyclebin' => @recyclebin_options, class => 'input', id => 'recyclebin_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_retention')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @retention_options = [['one month' => '30'], ['one week' => '7'], ['one year' => '365'], ['six months' => '180'], ['unlimited' => 'unlimited']];
|
||||||
|
% param 'retention' => $sf_data->{retention} unless param 'retention';
|
||||||
|
%= select_field 'retention' => @retention_options, class => 'input', id => 'retention_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p class='paragraph para2'>
|
||||||
|
%=l('sf_The_following_settings_control_the')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_httpaccess')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @httpaccess_options = [['Entire Internet (no password required)' => 'global'], ['Entire Internet (password required)' => 'global-pw'], ['Entire Internet (password required outside local network)' => 'global-pw-remote'], ['Local network (no password required)' => 'local'], ['Local network (password required)' => 'local-pw'], ['No access' => 'none']];
|
||||||
|
% param 'httpaccess' => $sf_data->{httpaccess} unless param 'httpaccess';
|
||||||
|
%= select_field 'httpaccess' => @httpaccess_options, class => 'input', id => 'httpaccess_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_webdav')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @webdav_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
|
||||||
|
% param 'webdav' => $sf_data->{webdav} unless param 'webdav';
|
||||||
|
%= select_field 'webdav' => @webdav_options, class => 'input', id => 'webdav_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_requireSSL')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @requireSSL_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
|
||||||
|
% param 'requireSSL' => $sf_data->{requireSSL} unless param 'requireSSL';
|
||||||
|
%= select_field 'requireSSL' => @requireSSL_options, class => 'input', id => 'requireSSL_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_indexes')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @indexes_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
|
||||||
|
% param 'indexes' => $sf_data->{indexes} unless param 'indexes';
|
||||||
|
%= select_field 'indexes' => @indexes_options, class => 'input', id => 'indexes_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_dynamic')
|
||||||
|
</span><span class=data>
|
||||||
|
% my @dynamic_options = [['disabled' => 'disabled'], ['enabled' => 'enabled']];
|
||||||
|
% param 'dynamic' => $sf_data->{dynamic} unless param 'dynamic';
|
||||||
|
%= select_field 'dynamic' => @dynamic_options, class => 'input', id => 'dynamic_select'
|
||||||
|
<br></span> </p>
|
||||||
|
|
||||||
|
<span class='data'>
|
||||||
|
%= submit_button l('sf_Save'), class => 'action subm109'
|
||||||
|
</span>
|
||||||
|
|
||||||
|
%# Probably finally by a submit.
|
||||||
|
%end
|
||||||
|
</div>
|
@ -0,0 +1,365 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
%#
|
||||||
|
<div id="Shares-PERMISSIONS" class="partial Shares-PERMISSIONS">
|
||||||
|
%# <script>
|
||||||
|
%# window.onload = function() {
|
||||||
|
%# SelectInput();
|
||||||
|
%# };
|
||||||
|
%# </script>
|
||||||
|
% if (config->{debug} == 1) {
|
||||||
|
<pre>
|
||||||
|
%= dumper $sf_data
|
||||||
|
</pre>
|
||||||
|
% }
|
||||||
|
% my $btn = l('sf_APPLY');
|
||||||
|
|
||||||
|
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
|
||||||
|
|
||||||
|
%= form_for "sharesu" => (method => 'POST') => begin
|
||||||
|
% param 'trt' => $sf_data->{trt} unless param 'trt';
|
||||||
|
%= hidden_field 'trt' => $sf_data->{trt}
|
||||||
|
%# Inputs etc in here.
|
||||||
|
|
||||||
|
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
|
||||||
|
|
||||||
|
<h2 class='subh'><%=l('sf_Access_right_management')%></h2>
|
||||||
|
|
||||||
|
<p class='paragraph para10'>
|
||||||
|
%=l('sf_You_can_use_this_matrix')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br /><table class="sme-border TableSort sme-table tabl2 ">
|
||||||
|
<thead class='tabl2'>
|
||||||
|
<tr table-head-row>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Groups '><%=l('sf_Groups')%></th>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Description '><%=l('sf_Description')%></th>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Read / Write '><%=l('sf_Read_/_Write')%></th>
|
||||||
|
<th class='sme-border table-head-col table-head-col-Read Only '><%=l('sf_Read_Only')%></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class='tabl2'>
|
||||||
|
% my $control_data = $c->stash('Table2');
|
||||||
|
% foreach my $row (@$control_data) {
|
||||||
|
<tr class='table-row'>
|
||||||
|
<td class='sme-border table-col table-col-Table2-Groups'><%=$c->render_to_string(inline=>$row->{'Table2-Groups'})%></td>
|
||||||
|
<td class='sme-border table-col table-col-Table2-Description'><%=$c->render_to_string(inline=>$row->{'Table2-Description'})%></td>
|
||||||
|
<td class='sme-border table-col table-col-Table2-Read / Write'><%=$c->render_to_string(inline=>$row->{'Table2-Read / Write'})%></td>
|
||||||
|
<td class='sme-border table-col table-col-Table2-Read Only'><%=$c->render_to_string(inline=>$row->{'Table2-Read Only'})%></td>
|
||||||
|
</tr>
|
||||||
|
%}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writegroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
|
||||||
|
%=checkbox_field 'writegroup', class => 'chec110'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readgroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
|
||||||
|
%=checkbox_field 'readgroup', class => 'chec111'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writegroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
|
||||||
|
%=checkbox_field 'writegroup', class => 'chec112'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readgroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
|
||||||
|
%=checkbox_field 'readgroup', class => 'chec113'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writegroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
|
||||||
|
%=checkbox_field 'writegroup', class => 'chec114'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readgroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
|
||||||
|
%=checkbox_field 'readgroup', class => 'chec115'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writegroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
|
||||||
|
%=checkbox_field 'writegroup', class => 'chec116'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readgroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
|
||||||
|
%=checkbox_field 'readgroup', class => 'chec117'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writegroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writegroup' => $sf_data->{writegroup} unless param 'writegroup';
|
||||||
|
%=checkbox_field 'writegroup', class => 'chec118'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readgroup')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readgroup' => $sf_data->{readgroup} unless param 'readgroup';
|
||||||
|
%=checkbox_field 'readgroup', class => 'chec119'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec120'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec121'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec122'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec123'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec124'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec125'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec126'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec127'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec128'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec129'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec130'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec131'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec132'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec133'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec134'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec135'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec136'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec137'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec138'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec139'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec140'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec141'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec142'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec143'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec144'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec145'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_writeuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'writeuser' => $sf_data->{writeuser} unless param 'writeuser';
|
||||||
|
%=checkbox_field 'writeuser', class => 'chec146'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<p><span class='label'>
|
||||||
|
%=l('sf_readuser')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'readuser' => $sf_data->{readuser} unless param 'readuser';
|
||||||
|
%=checkbox_field 'readuser', class => 'chec147'
|
||||||
|
</span></p>
|
||||||
|
|
||||||
|
|
||||||
|
<span class='data'>
|
||||||
|
%= submit_button l('sf_Save'), class => 'action subm148'
|
||||||
|
</span>
|
||||||
|
|
||||||
|
%# Probably finally by a submit.
|
||||||
|
%end
|
||||||
|
</div>
|
@ -0,0 +1,64 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
%#
|
||||||
|
<div id="Shares-REMOVE" class="partial Shares-REMOVE">
|
||||||
|
%# <script>
|
||||||
|
%# window.onload = function() {
|
||||||
|
%# SelectInput();
|
||||||
|
%# };
|
||||||
|
%# </script>
|
||||||
|
% if (config->{debug} == 1) {
|
||||||
|
<pre>
|
||||||
|
%= dumper $sf_data
|
||||||
|
</pre>
|
||||||
|
% }
|
||||||
|
% my $btn = l('sf_APPLY');
|
||||||
|
|
||||||
|
% $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table
|
||||||
|
|
||||||
|
%= form_for "sharesu" => (method => 'POST') => begin
|
||||||
|
% param 'trt' => $sf_data->{trt} unless param 'trt';
|
||||||
|
%= hidden_field 'trt' => $sf_data->{trt}
|
||||||
|
%# Inputs etc in here.
|
||||||
|
|
||||||
|
<h1 class='head'><%=l('sf_Create,_modify,_or_remove_shared')%></h1>
|
||||||
|
|
||||||
|
<h2 class='subh'><%=l('sf_Remove_shared_folder')%></h2>
|
||||||
|
|
||||||
|
<p class='paragraph para11'>
|
||||||
|
%=l('sf_You_are_about_to_remove')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_name')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'name' => $sf_data->{name} unless param 'name';
|
||||||
|
%= text_field 'name', size => '50', class => 'textinput name' , pattern=>'.*' , placeholder=>'name', title =>'Pattern regex mismatch', id => 'name_text', readonly => 1
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
|
<p><span class=label>
|
||||||
|
%=l('sf_description')
|
||||||
|
</span><span class=data>
|
||||||
|
% param 'description' => $sf_data->{description} unless param 'description';
|
||||||
|
%= text_field 'description', size => '50', class => 'textinput description' , pattern=>'.*' , placeholder=>'description', title =>'Pattern regex mismatch', id => 'description_text', readonly => 1
|
||||||
|
<br></span></p>
|
||||||
|
|
||||||
|
<p class='paragraph para21'>
|
||||||
|
%=l('sf_All_files_belonging_to_this')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class='paragraph para31'>
|
||||||
|
%=l('sf_Are_you_sure_you_wish')
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<span class='data'>
|
||||||
|
%= submit_button l('sf_Cancel'), class => 'action subm149'
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span class='data'>
|
||||||
|
%= submit_button l('sf_Remove'), class => 'action subm150'
|
||||||
|
</span>
|
||||||
|
|
||||||
|
%# Probably finally by a submit.
|
||||||
|
%end
|
||||||
|
</div>
|
@ -1,43 +0,0 @@
|
|||||||
% layout 'default', title => "Sme server 2 - Shared Folders", share_dir => './';
|
|
||||||
|
|
||||||
% content_for 'module' => begin
|
|
||||||
<div id="module">
|
|
||||||
|
|
||||||
% if ($config->{debug} == 1) {
|
|
||||||
<p>
|
|
||||||
%= dumper $c->current_route
|
|
||||||
</p>
|
|
||||||
% }
|
|
||||||
|
|
||||||
<h1><%=$title%></h1>
|
|
||||||
%= $modul
|
|
||||||
|
|
||||||
%if ($shf_datas->{first}) {
|
|
||||||
%=$c->render_to_string(inline =>$c->l($shf_datas->{first}))
|
|
||||||
|
|
||||||
%} elsif ($shf_datas->{success}) {
|
|
||||||
<div class='sme-success'>
|
|
||||||
<h2> Operation Status Report</h2>
|
|
||||||
%= $c->l($shf_datas->{success});
|
|
||||||
</div>
|
|
||||||
|
|
||||||
%} elsif ($shf_datas->{error}) {
|
|
||||||
<div class='sme-error'>
|
|
||||||
<h2> Operation Status Report - error</h2>
|
|
||||||
%= $c->l($shf_datas->{error});
|
|
||||||
</div>
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
||||||
% if ($shf_datas->{trt} eq 'CR_MOD') {
|
|
||||||
%= include 'partials/_shf_create_modify'
|
|
||||||
%} elsif ($shf_datas->{trt} eq 'DEL') {
|
|
||||||
%= include 'partials/_shf_delete'
|
|
||||||
%} elsif ($shf_datas->{trt} eq 'PERM') {
|
|
||||||
%= include 'partials/_shf_permissions'
|
|
||||||
%} else {
|
|
||||||
%= include 'partials/_shf_list'
|
|
||||||
%}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
%end
|
|
@ -0,0 +1,68 @@
|
|||||||
|
%#
|
||||||
|
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-21 08:46:42
|
||||||
|
%#
|
||||||
|
% layout 'default', title => "Sme server 2 - Shared Folders", share_dir => './';
|
||||||
|
%# css specific to this panel:
|
||||||
|
% content_for 'module' => begin
|
||||||
|
%= stylesheet '/css/shares.css'
|
||||||
|
%= javascript '/js/shares.js'
|
||||||
|
<div id="module" class="module Shares-panel">
|
||||||
|
|
||||||
|
% if (config->{debug} == 1) {
|
||||||
|
<pre>
|
||||||
|
%= dumper $c->current_route
|
||||||
|
%= dumper $c->stash()
|
||||||
|
</pre>
|
||||||
|
% }
|
||||||
|
|
||||||
|
<h1><%=$title%></h1>
|
||||||
|
|
||||||
|
% if ( stash('modul')) {
|
||||||
|
%= $c->render_to_string(inline => stash('modul') );
|
||||||
|
% }
|
||||||
|
|
||||||
|
%if ($c->stash('first')) {
|
||||||
|
<br><p>
|
||||||
|
%=$c->render_to_string(inline =>$c->l($c->stash('first')))
|
||||||
|
</p>
|
||||||
|
|
||||||
|
%} elsif ($c->stash('success')) {
|
||||||
|
<div class='success '>
|
||||||
|
<p>
|
||||||
|
%= $c->l($c->stash('success'));
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
%} elsif ($c->stash('error')) {
|
||||||
|
<div class='sme-error'>
|
||||||
|
<p>
|
||||||
|
%= $c->l($c->stash('error'));
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
%}
|
||||||
|
|
||||||
|
%#Routing to partials according to trt parameter.
|
||||||
|
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
|
||||||
|
|
||||||
|
% if ($sf_data->{trt} eq "LIST") {
|
||||||
|
%= include 'partials/_sf_LIST'
|
||||||
|
%}
|
||||||
|
|
||||||
|
% if ($sf_data->{trt} eq "MODIFY") {
|
||||||
|
%= include 'partials/_sf_MODIFY'
|
||||||
|
%}
|
||||||
|
|
||||||
|
% if ($sf_data->{trt} eq "PERMISSIONS") {
|
||||||
|
%= include 'partials/_sf_PERMISSIONS'
|
||||||
|
%}
|
||||||
|
|
||||||
|
% if ($sf_data->{trt} eq "REMOVE") {
|
||||||
|
%= include 'partials/_sf_REMOVE'
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
%end
|
@ -5,8 +5,8 @@
|
|||||||
Summary: sme server shared folders module
|
Summary: sme server shared folders module
|
||||||
%define name smeserver-shared-folders
|
%define name smeserver-shared-folders
|
||||||
Name: %{name}
|
Name: %{name}
|
||||||
%define version 0.3
|
%define version 11.0.0
|
||||||
%define release 25
|
%define release 1
|
||||||
Version: %{version}
|
Version: %{version}
|
||||||
Release: %{release}%{?dist}
|
Release: %{release}%{?dist}
|
||||||
License: GPL
|
License: GPL
|
||||||
@ -30,6 +30,9 @@ This module allows you to create network shares
|
|||||||
with more flexibility than ibays as it supports ACLs
|
with more flexibility than ibays as it supports ACLs
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu May 22 2025 Brian Read <brianr@koozali.org> 11.0.0-1.sme
|
||||||
|
- Add SM2 panel - WIP [SME: ]
|
||||||
|
|
||||||
* Sun Sep 08 2024 fix-e-smith-pkg.sh by Trevor Batley <trevor@batley.id.au> 0.3-25.sme
|
* Sun Sep 08 2024 fix-e-smith-pkg.sh by Trevor Batley <trevor@batley.id.au> 0.3-25.sme
|
||||||
- Fix e-smith references in smeserver-shared-folders [SME: 12732]
|
- Fix e-smith references in smeserver-shared-folders [SME: 12732]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user