4 use vars qw($opt_s $opt_g $opt_n);
8 my $FREESIDE_CONF = "%%%FREESIDE_CONF%%%";
11 my $user = shift or die &usage;
15 #if ( -e "$FREESIDE_CONF/mapsecrets" ) {
16 # open(MAPSECRETS,"<$FREESIDE_CONF/mapsecrets")
17 # or die "can't open $FREESIDE_CONF/mapsecrets: $!";
18 # while (<MAPSECRETS>) {
19 # /^(\S+) / or die "unparsable line in mapsecrets: $_";
20 # die "user $user already exists\n" if $user eq $1;
25 #insert new entry before a wildcard...
26 open(MAPSECRETS,"<$FREESIDE_CONF/mapsecrets")
27 and flock(MAPSECRETS,LOCK_EX)
28 or die "can't open $FREESIDE_CONF/mapsecrets: $!";
29 open(NEW,">$FREESIDE_CONF/mapsecrets.new")
30 or die "can't open $FREESIDE_CONF/mapsecrets.new: $!";
33 print NEW "$user $opt_s\n";
37 close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!";
38 close NEW or die "can't close $FREESIDE_CONF/mapsecrets.new: $!";
39 rename("$FREESIDE_CONF/mapsecrets.new", "$FREESIDE_CONF/mapsecrets")
40 or die "can't move mapsecrets.new into place: $!";
50 use FS::UID qw(adminsuidsetup);
53 use FS::access_usergroup;
55 $FS::CurrentUser::upgrade_hack = 1;
56 #adminsuidsetup $rootuser;
59 my $access_user = new FS::access_user {
61 '_password' => 'notyet',
62 'first' => 'Firstname', # $opt_f ||
63 'last' => 'Lastname', # $opt_l ||
65 my $au_error = $access_user->insert;
66 die $au_error if $au_error;
70 my $access_usergroup = new FS::access_usergroup {
71 'usernum' => $access_user->usernum,
74 my $aug_error = $access_usergroup->insert;
75 die $aug_error if $aug_error;
82 die "Usage:\n\n freeside-adduser [ -n ] [ -s ] [ -g groupnum ] username [ password ]"
87 freeside-adduser - Command line interface to add (freeside) users.
91 freeside-adduser [ -n ] [ -s ] [ -g groupnum ] username [ password ]
95 Adds a user to the Freeside billing system. This is for adding users (internal
96 sales/tech folks) to the web interface, not for adding customer accounts.
98 This functionality is now available in the web interface as well, under
99 B<Configuration | Employees | View/Edit employees>.
103 Development/multi-DB options:
105 -s: alternate secrets file
107 -n: no ACL added, for bootstrapping
111 No explicit htpasswd options are available in 1.7 - passwords are now
112 maintained automatically.
116 Base Freeside documentation