[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cobalt-developers] add user script
- Subject: [cobalt-developers] add user script
- From: Peter Blaser <blaser@xxxxxxxxxxx>
- Date: Tue May 29 15:40:42 2001
- List-id: Discussion Forum for developers on Cobalt Networks products <cobalt-developers.list.cobalt.com>
Hi
I use the following script to automatically add huge # of users.
I can add useres so far with it, but they arn't show in the users list of
the site in the HTML Gui.
do I miss something ?
Peter
#!/usr/bin/perl
# pass a comma separated list of
#
# username,fullname,password
#
use Getopt::Std;
require Cobalt::User;
use Cobalt::Meta;
my $addfile = '/tmp/users.dat'; # the file which contains the users to be
added
my $group = "site1"; # Change the group to the one for Virtual Site you
wanted
my $quota = 5; # Disk quota in MB
my $fpx = "off"; # Front Page Support
my $apop = "off"; # Apop support
my $admin = "off"; # User is admin or not
my $shell = "off"; # allow shell access
open IN, $addfile;
flock (IN,2);
@userdata = <IN>;
close IN;
foreach $usr (@userdata) {
chomp($usr);
($username, $name, $passwd) = split(/\,/,$usr);
print "creating $username ...";
my $m = Cobalt::Meta->new("type" => "users",
"name" => "$username",
"group" => "$group",
"fullname" => "$name",
"altname" => "",
"password1" => "$passwd",
"password2" => "$passwd",
"quota" => "$quota",
"fpx" => "$fpx",
"apop" => "$apop",
"shell" => "$shell",
"admin" => "$admin",
"suspend" => "",
"aliases" => "",
"forward" => "",
"vacation" => "",
"vacationmsg" => "");
print "m: $m";
my $res = &Cobalt::User::site_user_add($m);
if ($res) {
print " ERROR: $res\n";
} else {
print "ok\n";
}
}