diff -Nur smeserver-user-webspace-0.1-old/createlinks smeserver-user-webspace-0.1/createlinks --- smeserver-user-webspace-0.1-old/createlinks 2000-08-02 17:05:42.000000000 -0400 +++ smeserver-user-webspace-0.1/createlinks 2013-11-23 17:45:11.000000000 -0500 @@ -1,51 +1,53 @@ #!/usr/bin/perl -w -# This script creates the symlinks needed by this RPM -# Specific support exists to create symlinks within e-smith web "panels" -# and for links from named "events" directories into the "actions" directory -sub panel_link +use esmith::Build::CreateLinks qw(:all); + +#################### +# links to add + +# templates to expand + + +# services to launch on event + + +#actions +for my $event (qw(user-create )) { - my ($function, $panel) = @_; + event_link("user-create-unix-webspace", $event, "15"); +} + - unlink "root/etc/e-smith/web/panels/$panel/cgi-bin/$function"; - symlink("../../../functions/$function", - "root/etc/e-smith/web/panels/$panel/cgi-bin/$function") - or die "Can't symlink to root/etc/e-smith/web/panels/$panel". - "/cgi-bin/$function: $!"; +for my $event (qw(user-create post-upgrade )) +{ + event_link("user-create-profiledir-webspace", $event, "25"); } -sub event_link +# event to revert changes before uninstall +for my $event (qw(user-webspace-revert )) { - my ($action, $event, $level) = @_; + event_link("user-force-revert-rights", $event, "25"); + templates2events("/etc/httpd/conf/httpd.conf", $event); + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); +} - unlink "root/etc/e-smith/events/${event}/S${level}${action}"; - symlink("../actions/${action}", - "root/etc/e-smith/events/${event}/S${level}${action}") - or die "Can't symlink to " . - "root/etc/e-smith/events/${event}/S${level}${action}: $!"; +#event to force existing users +for my $event (qw(user-webspace-force-existings )) +{ + event_link("user-force-create-every-webspace", $event, "25"); + templates2events("/etc/httpd/conf/httpd.conf", $event); + safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); } -#-------------------------------------------------- -# functions for manager panel -#-------------------------------------------------- -my $panel = "manager"; - -#panel_link("function1", $panel); -#panel_link("function2", $panel); - -#-------------------------------------------------- -# actions for console-save event: -#-------------------------------------------------- -$event = "console-save"; - -#event_link("action1", $event, "55"); -#event_link("action2", $event, "60"); - -#-------------------------------------------------- -# actions for domain-create event: -#-------------------------------------------------- -$event = "domain-create"; +# do we want to force webspaces to be created to all at reconfiguration ? +for my $event (qw( post-upgrade )) +{ + event_link("user-force-create-every-webspace", $event, "25"); + +} -#event_link("action1", $event, "55"); -#event_link("action2", $event, "90"); +#create default directories in skel + #my $root=$ARGV[0]; + system( "mkdir -p root/etc/e-smith/skel/user/tmp"); + system( "mkdir -p root/etc/e-smith/skel/user/home/public_html"); diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-profiledir-webspace smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-profiledir-webspace --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-profiledir-webspace 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-profiledir-webspace 2013-11-23 17:15:03.000000000 -0500 @@ -0,0 +1,63 @@ +#!/usr/bin/perl -w +#---------------------------------------------------------------------- +# copyright (C) 2001-2005 Mitel Networks Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +#---------------------------------------------------------------------- +package esmith; + +use strict; +use Errno; +use esmith::util; + +use esmith::AccountsDB; +my $adb = esmith::AccountsDB->open_ro(); + +my $event = $ARGV [0]; + +my @users = ('admin', map { $_->key } $adb->users); + +my @newusers = ($event eq "post-upgrade") ? @users : $ARGV[1] ; + +foreach my $user ( @newusers ) +{ + die "$user is not a user account\n" + unless ( grep /^$user$/, @users ); + next if $user eq "admin"; + my @dirs = ("/home/e-smith/files/samba/profiles/$user"); + + foreach my $dir (@dirs) + { + my $pre_existing = ( -d $dir ); + + $pre_existing || mkdir $dir, 750 || die "Couldn't create directory $dir\n"; + + chmod 0750, $dir; # Remove setgid bit + + next if $pre_existing; + system("chmod", "0750", "/home/e-smith/files/users/$user"); + system("chmod", "2770", "/home/e-smith/files/users/$user/home/public_html"); + system("chmod", "2770", "/home/e-smith/files/users/$user/tmp"); + system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/home/public_html"); + system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user"); + system("/bin/chown", "$user:www", "-R" , "/home/e-smith/files/users/$user/tmp"); + + esmith::util::chownFile($user, $user, $dir) || + die "Couldn't change ownership of $dir\n"; + } +} + +exit (0); diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-unix-webspace smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-unix-webspace --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-create-unix-webspace 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-create-unix-webspace 2013-11-23 17:16:03.000000000 -0500 @@ -0,0 +1,58 @@ +#!/usr/bin/perl -w + +#---------------------------------------------------------------------- +# copyright (C) 1999-2005 Mitel Networks Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Technical support for this program is available from Mitel Networks +# Please visit our web site www.mitel.com/sme/ for details. +#---------------------------------------------------------------------- + +package esmith; + +use strict; +use Errno; +use esmith::ConfigDB; +use esmith::AccountsDB; +use File::Temp; + +my $conf = esmith::ConfigDB->open_ro; +my $accounts = esmith::AccountsDB->open; + +my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled'; +my $x = 0; # exit value + +my $domain = $conf->get('DomainName') + || die("Couldn't determine domain name"); +$domain = $domain->value; + +my $event = $ARGV [0]; +my $userName = $ARGV [1]; + +#------------------------------------------------------------ +# Create the Unix account +#------------------------------------------------------------ + +die "username argument missing" unless defined ($userName); + +return if $userName eq "admin"; +system("chmod", "0750", "/home/e-smith/files/users/$userName"); +system("chmod", "2770", "/home/e-smith/files/users/$userName/home/public_html"); +system("chmod", "2770", "/home/e-smith/files/users/$userName/tmp"); +system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/home/public_html"); +system("/bin/chown", "$userName:www", "/home/e-smith/files/users/$userName"); +system("/bin/chown", "$userName:www", "-R", "/home/e-smith/files/users/$userName/tmp"); + diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-create-every-webspace smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-create-every-webspace --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-create-every-webspace 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-create-every-webspace 2013-11-23 17:42:19.000000000 -0500 @@ -0,0 +1,66 @@ +#!/usr/bin/perl -w +#---------------------------------------------------------------------- +# copyright (C) 2001-2005 Mitel Networks Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +#---------------------------------------------------------------------- +package esmith; + +use strict; +use Errno; +use esmith::util; + +use esmith::AccountsDB; +my $adb = esmith::AccountsDB->open_ro(); + +#my $event = $ARGV [0]; + +my @users = ('admin', map { $_->key } $adb->users); + +my @newusers = @users; +#($event eq "post-upgrade") ? @users : $ARGV[1] ; + +foreach my $user ( @newusers ) +{ + die "$user is not a user account\n" + unless ( grep /^$user$/, @users ); + + my @dirs = ("/home/e-smith/files/samba/profiles/$user"); + next if $user eq "admin"; + foreach my $dir (@dirs) + { + my $pre_existing = ( -d $dir ); + + $pre_existing || mkdir $dir, 750 || die "Couldn't create directory $dir\n"; + + chmod 0750, $dir; # Remove setgid bit + + #next if $pre_existing; + system("mkdir -p /home/e-smith/files/users/$user/home/public_html"); + system("mkdir -p /home/e-smith/files/users/$user/tmp"); + system("chmod", "0750", "/home/e-smith/files/users/$user"); + system("chmod", "2770", "/home/e-smith/files/users/$user/home/public_html"); + system("chmod", "2770", "/home/e-smith/files/users/$user/tmp"); + system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/home/public_html"); + system("/bin/chown", "$user:www", "/home/e-smith/files/users/$user"); + system("/bin/chown", "$user:www", "-R", "/home/e-smith/files/users/$user/tmp"); + + esmith::util::chownFile($user, $user, $dir) || + die "Couldn't change ownership of $dir\n"; + } +} + +exit (0); diff -Nur smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-revert-rights smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-revert-rights --- smeserver-user-webspace-0.1-old/root/etc/e-smith/events/actions/user-force-revert-rights 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-user-webspace-0.1/root/etc/e-smith/events/actions/user-force-revert-rights 2013-11-23 17:39:33.000000000 -0500 @@ -0,0 +1,59 @@ +#!/usr/bin/perl -w +#---------------------------------------------------------------------- +# copyright (C) 2001-2005 Mitel Networks Corporation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +#---------------------------------------------------------------------- +package esmith; + +use strict; +use Errno; +use esmith::util; + +use esmith::AccountsDB; +my $adb = esmith::AccountsDB->open_ro(); + +#my $event = $ARGV [0]; + +my @users = ('admin', map { $_->key } $adb->users); + +my @newusers = @users; +#($event eq "post-upgrade") ? @users : $ARGV[1] ; + +foreach my $user ( @newusers ) +{ + die "$user is not a user account\n" + unless ( grep /^$user$/, @users ); + + my @dirs = ("/home/e-smith/files/samba/profiles/$user"); + next if $user eq "admin"; + foreach my $dir (@dirs) + { + my $pre_existing = ( -d $dir ); + + $pre_existing || mkdir $dir, 700 || die "Couldn't create directory $dir\n"; + + chmod 0700, $dir; # Remove setgid bit + + #next if $pre_existing; + system("/bin/chown", "$user:$user", "-R", "/home/e-smith/files/users/$user"); + system("/bin/chmod", "0700", "/home/e-smith/files/users/$user"); + esmith::util::chownFile($user, $user, $dir) || + die "Couldn't change ownership of $dir\n"; + } +} + +exit (0);