(RADIATOR) Rewriting Usernames on the Fly
Martin Edge
martin.edge at phoneware.net.au
Mon Oct 22 20:59:16 CDT 2001
Hey,
I'm having a few issues working with hooks within Radiator.
I'm trying to use a PreProcessing Hook, to modify the username of a user
as they come in. It appears to grab the right data, but when I change
the attribute, it doesn't appear to affect the username that is used to
process.
Is there another attribute or command I have to use to change the
username of a user?
The basic jist is, we are moving customers from they old usernames, to
new ones, in a new billing system, and I want to be able to detect that
they aren't using a normal username, use the one they entered to look
for a new one, and then set the new one, to it.
Any help would be appreciated, but I feel I'm probably just missing
something and this is simpler than it looks..
My code is below for the hook:
sub
{
my $p = ${$_[0]};
my $rp = ${$_[1]};
my $username = $p->get_attr('User-Name');
if ($username) {
if (!grep(/^[a-z][a-z][a-z][0-9][0-9][0-9][0-9][0-9].*/,
$username)) {
&main::log($main::LOG_DEBUG, "This isn't a
standard username, grabbing alternate");
my $user = "weee";
my $pwd = "bssss00";
my $dbh =
DBI->connect("dbi:Sybase:server=secure-nike.izone.net.au;database=nb9901
", $user, $pwd);
my $sth = $dbh->prepare("select id_user from
serviceuser where id_alternate = '$username'");
my $error = $sth->execute;
my @results = $sth->fetch;
#&main::log($main::LOG_DEBUG, "select id_user
from serviceuser where id_alternate = '$username'");
#&main::log($main::LOG_DEBUG, "my alternative
username $username translates to $results[0]->[0]");
# Find the new username
$p->change_attr('User-Name', $results[0]->[0]);
}
}
return;
}
-----------------------------------------
Martin Edge
Network Engineer
Phoneware Online
eMail: Martin.Edge at phoneware.net.au
Phone: +613 9640 4140 ext. 193
"Creating the structure necessary for your
business internet requirements"
-----------------------------------------
===
Archive at http://www.open.com.au/archives/radiator/
Announcements on radiator-announce at open.com.au
To unsubscribe, email 'majordomo at open.com.au' with
'unsubscribe radiator' in the body of the message.
More information about the radiator
mailing list