initial commit of file from CVS for smeserver-webshare on Sat Sep 7 21:15:27 AEST 2024
This commit is contained in:
50
root/etc/e-smith/events/actions/webshare-adduser
Executable file
50
root/etc/e-smith/events/actions/webshare-adduser
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::ConfigDB;
|
||||
use Apache::Htpasswd;
|
||||
|
||||
my $db = esmith::ConfigDB->open_ro("WebShare");
|
||||
|
||||
my $projectName = $ARGV[0];
|
||||
my $userName = $ARGV[1];
|
||||
my $password = $ARGV[2];
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Create the MultiAccessWebshare account
|
||||
#------------------------------------------------------------
|
||||
|
||||
my $MultiAccessWebshare =
|
||||
$db->get_prop( "MultiAccess", "WebShareName" || "undefined" );
|
||||
my %MultiWebshares =
|
||||
sort( split( /,/, $db->get_prop( "MultiAccess", "WebShares" ) || "" ) );
|
||||
|
||||
if ( ( "$MultiAccessWebshare" eq "$projectName" )
|
||||
&& ( "%MultiWebshares" ne "" ) )
|
||||
{
|
||||
my $foo =
|
||||
new Apache::Htpasswd("/home/e-smith/db/webshare/htpasswd.$MultiAccessWebshare");
|
||||
$foo->htDelete("$userName");
|
||||
$foo->{'USEMD5'} = "MD5";
|
||||
$foo->htpasswd( "$userName", "$password" );
|
||||
|
||||
foreach my $MultiWebshares (%MultiWebshares) {
|
||||
my $foo1 =
|
||||
new Apache::Htpasswd("/home/e-smith/db/webshare/htpasswd.$MultiWebshares");
|
||||
$foo1->htDelete("$userName");i
|
||||
$foo->{'USEMD5'} = "MD5";
|
||||
$foo1->htpasswd( "$userName", "$password" );
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Create the webshare account
|
||||
#------------------------------------------------------------
|
||||
|
||||
my $foo = new Apache::Htpasswd("/home/e-smith/db/webshare/htpasswd.$projectName");
|
||||
$foo->{'USEMD5'} = "MD5";
|
||||
$foo->htpasswd( "$userName", "$password" );
|
||||
}
|
||||
|
||||
exit(0)
|
47
root/etc/e-smith/events/actions/webshare-create
Executable file
47
root/etc/e-smith/events/actions/webshare-create
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
my $projectName = $ARGV [0];
|
||||
my $indexer = $ARGV [1];
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Create the webshare project directory
|
||||
#------------------------------------------------------------
|
||||
|
||||
if ( -e "/opt/webshare/$projectName")
|
||||
{
|
||||
print "webshare $projectName already exists\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
system ("/bin/mkdir /opt/webshare/$projectName");
|
||||
|
||||
if ("$indexer" eq "Full")
|
||||
{
|
||||
system ("/bin/cp -R /opt/webshare-tools/phpfm/* /opt/webshare/$projectName/");
|
||||
system ("/bin/cp -f /opt/webshare/$projectName/conf/config.inc.php-full /opt/webshare/$projectName/conf/config.inc.php");
|
||||
}
|
||||
elsif ("$indexer" eq "NoDelete")
|
||||
{
|
||||
system ("/bin/cp -R /opt/webshare-tools/phpfm/* /opt/webshare/$projectName/");
|
||||
system ("/bin/cp -f /opt/webshare/$projectName/conf/config.inc.php-nodelete /opt/webshare/$projectName/conf/config.inc.php");
|
||||
}
|
||||
elsif ("$indexer" eq "UpDown")
|
||||
{
|
||||
system ("/bin/cp -R /opt/webshare-tools/phpfm/* /opt/webshare/$projectName/");
|
||||
system ("/bin/cp -f /opt/webshare/$projectName/conf/config.inc.php-updown /opt/webshare/$projectName/conf/config.inc.php");
|
||||
}
|
||||
elsif ("$indexer" eq "View")
|
||||
{
|
||||
system ("/bin/cp -R /opt/webshare-tools/phpfm/* /opt/webshare/$projectName/");
|
||||
system ("/bin/cp -f /opt/webshare/$projectName/conf/config.inc.php-view /opt/webshare/$projectName/conf/config.inc.php");
|
||||
}
|
||||
|
||||
system ("/usr/bin/find /opt/webshare/$projectName -type f -exec chmod 644 {} ';'");
|
||||
system ("/usr/bin/find /opt/webshare/$projectName -type d -exec chmod 755 {} ';'");
|
||||
system ("/bin/chown -R www:www /opt/webshare/$projectName/files");
|
||||
|
||||
system ("/bin/touch /home/e-smith/db/webshare/htpasswd.$projectName");
|
||||
system ("/sbin/e-smith/signal-event ibay-modify");
|
||||
}
|
||||
|
||||
exit (0);
|
16
root/etc/e-smith/events/actions/webshare-delete
Executable file
16
root/etc/e-smith/events/actions/webshare-delete
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
my $projectName = $ARGV[0];
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Delete the webshare project directory
|
||||
#------------------------------------------------------------
|
||||
|
||||
if ( -e "/opt/webshare/$projectName" ) {
|
||||
system("/bin/rm -Rf /opt/webshare/$projectName");
|
||||
system("/bin/rm -f /home/e-smith/db/webshare/htpasswd.$projectName");
|
||||
system("/sbin/e-smith/signal-event ibay-modify");
|
||||
}
|
||||
|
||||
exit(0);
|
||||
|
45
root/etc/e-smith/events/actions/webshare-deluser
Executable file
45
root/etc/e-smith/events/actions/webshare-deluser
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::ConfigDB;
|
||||
use Apache::Htpasswd;
|
||||
|
||||
my $db = esmith::ConfigDB->open_ro("WebShare");
|
||||
|
||||
my $projectName = $ARGV[0];
|
||||
my $userName = $ARGV[1];
|
||||
my $password = $ARGV[2];
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Delete the MultiAccessWebshare account
|
||||
#------------------------------------------------------------
|
||||
|
||||
my $MultiAccessWebshare =
|
||||
$db->get_prop( "MultiAccess", "WebShareName" || "undefined" );
|
||||
my %MultiWebshares =
|
||||
split( /,/, $db->get_prop( "MultiAccess", "WebShares" ) || "" );
|
||||
|
||||
if ( ( "$MultiAccessWebshare" eq "$projectName" )
|
||||
&& ( "%MultiWebshares" ne "" ) )
|
||||
{
|
||||
my $foo =
|
||||
new Apache::Htpasswd("/home/e-smith/db/webshare/htpasswd.$MultiAccessWebshare");
|
||||
$foo->htDelete("$userName");
|
||||
|
||||
foreach my $MultiWebshares ( sort %MultiWebshares ) {
|
||||
my $foo1 =
|
||||
new Apache::Htpasswd("/home/e-smith/db/webshare/htpasswd.$MultiWebshares");
|
||||
$foo1->htDelete("$userName");
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Delete the webshare account
|
||||
#------------------------------------------------------------
|
||||
|
||||
my $foo = new Apache::Htpasswd("/home/e-smith/db/webshare/htpasswd.$projectName");
|
||||
$foo->htDelete("$userName");
|
||||
}
|
||||
|
||||
exit(0)
|
64
root/etc/e-smith/events/actions/webshare-rebuild-htpasswd
Executable file
64
root/etc/e-smith/events/actions/webshare-rebuild-htpasswd
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use esmith::ConfigDB;
|
||||
use Apache::Htpasswd;
|
||||
|
||||
my $db = esmith::ConfigDB->open_ro("WebShare");
|
||||
|
||||
my @WebShare = $db->get_all_by_prop( type => 'WebShare' );
|
||||
my $MultiAccessWebshare = $db->get_prop( "MultiAccess", "WebShareName" ) || "";
|
||||
my %MultiWebshares = split( /,/, $db->get_prop( "MultiAccess", "WebShares" ) || "" );
|
||||
|
||||
foreach my $WebShare (@WebShare) {
|
||||
my $ws = $WebShare->key;
|
||||
my $rec = $db->get("$ws");
|
||||
|
||||
system( "/bin/rm -f /home/e-smith/db/webshare/htpasswd.$ws > /dev/null 2>&1" );
|
||||
system( "/bin/touch", "/home/e-smith/db/webshare/htpasswd.$ws" );
|
||||
|
||||
my %Users = split( /,/, $rec->prop("Users") || "" );
|
||||
|
||||
if ( "%Users" ne "" ) {
|
||||
foreach my $Users ( sort %Users ) {
|
||||
my @user = split( /:/, $Users );
|
||||
my $userName = $user[0];
|
||||
my $password = $user[1];
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Create the MultiAccessWebshare account
|
||||
#------------------------------------------------------------
|
||||
|
||||
if ( ( "$MultiAccessWebshare" eq "$ws" )
|
||||
&& ( "%MultiWebshares" ne "" ) )
|
||||
{
|
||||
my $foo =
|
||||
new Apache::Htpasswd(
|
||||
"/home/e-smith/db/webshare/htpasswd.$MultiAccessWebshare");
|
||||
$foo->htDelete("$userName");
|
||||
$foo->{'USEMD5'} = "MD5";
|
||||
$foo->htpasswd( "$userName", "$password" );
|
||||
|
||||
foreach my $MultiWebshares ( sort %MultiWebshares ) {
|
||||
my $foo1 =
|
||||
new Apache::Htpasswd(
|
||||
"/home/e-smith/db/webshare/htpasswd.$MultiWebshares");
|
||||
$foo1->htDelete("$userName");
|
||||
$foo->{'USEMD5'} = "MD5";
|
||||
$foo1->htpasswd( "$userName", "$password" );
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
#------------------------------------------------------------
|
||||
# Create the webshare account
|
||||
#------------------------------------------------------------
|
||||
|
||||
my $foo = new Apache::Htpasswd("/home/e-smith/db/webshare/htpasswd.$ws");
|
||||
$foo->htDelete("$userName");
|
||||
$foo->{'USEMD5'} = "MD5";
|
||||
$foo->htpasswd( "$userName", "$password" );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exit(0)
|
Reference in New Issue
Block a user