[vhffs-dev] [1290] vhffs-useradd now set the ACL on the created user

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1290
Author:   crafty
Date:     2008-10-19 03:01:28 +0200 (Sun, 19 Oct 2008)

Log Message:
-----------
vhffs-useradd now set the ACL on the created user 

Modified Paths:
--------------
    trunk/vhffs-tools/src/vhffs-useradd


Modified: trunk/vhffs-tools/src/vhffs-useradd
===================================================================
--- trunk/vhffs-tools/src/vhffs-useradd	2008-10-15 22:33:41 UTC (rev 1289)
+++ trunk/vhffs-tools/src/vhffs-useradd	2008-10-19 01:01:28 UTC (rev 1290)
@@ -1,13 +1,12 @@
-#!%PERL% -w
+#!%PERL%
 
 use strict;
-
 use lib '%VHFFS_LIB_DIR%';
 use Vhffs::User;
 use Vhffs::Main;
 use Vhffs::Constants;
 use Term::ReadPassword;
-
+use Vhffs::Functions;
 my $vhffs = init Vhffs::Main;
 
 my ($username, $password, $conf_password, $access_level, $mail, $firstname, $lastname, $city, $zipcode, $country, $address);
@@ -52,9 +51,14 @@
 chomp($country = <STDIN>);
 print 'Address: ';
 chomp($address = <STDIN>);
-	
-if(defined Vhffs::User::create($vhffs, $username, $password, $access_level, $mail, $firstname, $lastname, $city, $zipcode, $country, $address)) {
-	print "User successfully created\n";
+
+my $user = Vhffs::User::create( $vhffs, $username, $password, $access_level, $mail, $firstname, $lastname, $city, $zipcode, $country, $address, "");
+
+
+if(defined $user) {
+	print "User successfully created, setting default ACL\n";
+        Vhffs::Acl::add_acl( $user , $user , Vhffs::Constants::ACL_DELETE , $vhffs );
+        Vhffs::Acl::add_acl( $user->get_group , $user , Vhffs::Constants::ACL_DENIED , $vhffs );
 } else {
 	print "Unable to create user (duplicate ?)\n";
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/