freeside/bin ispman.ldap.import,NONE,1.1
ivan
ivan at pouncequick.420.am
Fri Aug 20 01:58:09 PDT 2004
- Previous message: freeside/httemplate/search cust_credit.html,1.1,1.2
- Next message: freeside/fs_selfservice/FS-SelfService/cgi agent_menu.html,NONE,1.1 provision_list.html,NONE,1.1 agent_provision.html,NONE,1.1 svc_acct.html,NONE,1.1 agent_provision_svc_acct.html,NONE,1.1 agent_delete_svc.html,NONE,1.1 agent_customer_menu.html,NONE,1.1 order_pkg.html,NONE,1.1 agent_order_pkg.html,NONE,1.1 agent_logout.html,NONE,1.1 agent.cgi,1.5,1.6 agent_main.html,1.2,1.3 list_customers.html,1.1,1.2 view_customer.html,1.1,1.2 selfservice.cgi,1.8,1.9 provision.html,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/bin
In directory pouncequick:/tmp/cvs-serv3669
Added Files:
ispman.ldap.import
Log Message:
adding
--- NEW FILE: ispman.ldap.import ---
#!/usr/bin/perl -w
use strict;
use Net::LDAP::LDIF;
use FS::UID qw(adminsuidsetup);
use FS::Record qw(qsearchs);
use FS::svc_domain;
use FS::svc_acct;
my $user = shift or die;
adminsuidsetup($user);
$FS::svc_Common::noexport_hack = 1;
$FS::svc_domain::whois_hack = 1;
my $domain_svcpart = 1;
my $account_svcpart = 2;
my $mailbox_svcpart = 3;
my $fedweeknet_svcpart = 4;
#my $ldif =
# Net::LDAP::LDIF->new( "ispman-06-23-04.ldif", "r", onerror => 'undef' );
my $ldif =
Net::LDAP::LDIF->new( "ispman-06-23-04.ldif", "r", onerror => 'warn' );
#my %objectclass;
my $acct = 0;
my $imported = 0;
my $entry;
while ( $entry = $ldif->read_entry ) {
#warn "$entry\n";
my %attributes = map { $_ => [ $entry->get_value( $_ ) ] } $entry->attributes;
my $objectclass = join('/', @{$attributes{'objectclass'}} );
next unless $objectclass eq 'posixAccount/ispmanDomainUser/radiusprofile';
foreach my $attr ( keys %attributes ) {
print join( " => ", substr($attr.' 'x30,0,30), @{$attributes{ $attr }} ), "\n";
#if ( $attr eq 'objectclass' ) {
# $objectclass{ join('/', @{$attributes{$attr}} ) }++;
#}
}
print "\n";
$acct++;
my $email = $attributes{'maillocaladdress'}->[0];
$email =~ /^(\w+)\@([\w\.\-]+)$/ or die $email;
die "$1 ne ". $attributes{'ispmanuserid'}->[0]. "\n"
unless lc($1) eq $attributes{'ispmanuserid'}->[0];
my $username = lc($1);
my $domain = lc($2);
my $svc_domain = qsearchs('svc_domain', { 'domain' => $domain } )
|| new FS::svc_domain { 'svcpart' => $domain_svcpart,
'domain' => $domain,
'action' => 'N',
};
unless ( $svc_domain->svcnum ) {
my $error = $svc_domain->insert;
if ( $error ) {
die "inserting domain: $error\n";
}
}
( my $password = $attributes{'userpassword'}->[0] ) =~ s/^\{crypt\}//;
# pick svcpart
my $svcpart = $account_svcpart;
if ( $domain eq 'fedweeknet.com' ) {
$svcpart = $fedweeknet_svcpart;
} elsif ( $attributes{'dialupaccess'}->[0] =~ /(false|no)/i ) {
$svcpart = $mailbox_svcpart;
}
my $dir = $attributes{'homedirectory'}->[0];
$dir =~ s/\s+//g;
$dir =~ s/\@/_/;
my $svc_acct = new FS::svc_acct {
'svcpart' => $svcpart,
'username' => $username,
'_password' => $password,
'finger' => $attributes{'cn'}->[0],
'domsvc' => $svc_domain->svcnum,
'shell' => $attributes{'loginshell'}->[0],
'uid' => $attributes{'uidnumber'}->[0],
'gid' => $attributes{'gidnumber'}->[0],
'dir' => $dir,
'quota' => $attributes{'mailquota'}->[0],
};
my $error = $svc_acct->insert;
#my $error = $svc_acct->check;
if ( $error ) {
warn "$error\n";
} else {
$imported++;
}
}
print "$imported of $acct imported\n";
#print "\n\n";
#foreach ( sort { $objectclass{$b} <=> $objectclass{$a} } keys %objectclass ) {
# print "$objectclass{$_}: $_\n";
#}
- Previous message: freeside/httemplate/search cust_credit.html,1.1,1.2
- Next message: freeside/fs_selfservice/FS-SelfService/cgi agent_menu.html,NONE,1.1 provision_list.html,NONE,1.1 agent_provision.html,NONE,1.1 svc_acct.html,NONE,1.1 agent_provision_svc_acct.html,NONE,1.1 agent_delete_svc.html,NONE,1.1 agent_customer_menu.html,NONE,1.1 order_pkg.html,NONE,1.1 agent_order_pkg.html,NONE,1.1 agent_logout.html,NONE,1.1 agent.cgi,1.5,1.6 agent_main.html,1.2,1.3 list_customers.html,1.1,1.2 view_customer.html,1.1,1.2 selfservice.cgi,1.8,1.9 provision.html,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list