[freeside] svc_acct.export code functionality explanation?
Joel Griffiths
griff at aver-computer.com
Fri Jul 9 11:32:32 PDT 1999
On Thu, 08 Jul 1999, you wrote:
> ###
> # FORMAT OF THE USERS FILE HERE
> print USERS
> $svc_acct->username, qq(\tPassword = "$rpassword"\n\t),
>
> join ",\n\t",
> map {
> /^(radius_(.*))$/;
> my($field,$attrib)=($1,$2);
> $attrib =~ s/_/\-/g;
> "$attrib = \"". $svc_acct->getfield($field). "\"";
> } grep /^radius_/ && $svc_acct->getfield($_), fields('svc_acct')
> ;
> if ( $ip && $ip ne '0e0' ) {
> print USERS qq(,\n\tFramed-Address = "$ip"\n\n);
> } else {
> print USERS qq(\n\n);
> }
Basically, what this is doing is going through each svc_acct searching for the
radius_ attributes. $_ is set to the actual database identifier with the grep
line. Basically, this is doing a foreach on the fields for the svc_acct
record you are currently reading that start with radius_.
These fields are then passed to the inside of the map function as $_.
$attrib is set to (after some manipulation) the attribute (ie. Framed-Protocal
for the radius_framed_protocol field from your svc_acct record). $field is set
to radius_framed_protocol (example only).
The actual mapping is done (I think) by the "$attrib..." line:
ie:
"Framed-Protocol = svc_acct->getfield('radius_framed_protocol')"
The svc_acct->getfield('radius_framed_protocol') is the value you set in the
database.
The Framed-Protocol Radius attribute will not be on your system unless you told
Freeside about it during import. I just used it as an example here.
-- Joel Griffiths --
Senior Internet Engineer Aver, Inc.
(760) 568-4351 Phone (760) 341-8694 Fax
"The world won't change just because I complain."
Martina McBride
More information about the freeside-users
mailing list