From f17c3f4acb20b02308c280347586737f21de74c5 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 16 Jan 2018 12:14:54 -0500 Subject: RT# 39340 - Created minimal selfservice that only allows payments to be made, authorization is based on ip and mac address. This is not done yet need to write routine to get mac address from radius server based on ip address. --- FS/FS/ClientAPI/MyAccount.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'FS') diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index f32523e35..8c8cfc2ee 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -236,6 +236,13 @@ sub login { $svc_x = $svc_phone; + } elsif ( $p->{'domain'} eq 'ip_mac' ) { + + my $svc_broadband = qsearchs( 'svc_broadband', { 'mac_addr' => $p->{'username'} } ); + return { error => 'IP address not found' } + unless $svc_broadband; + $svc_x = $svc_broadband; + } elsif ( $p->{email} && (my $contact = FS::contact->by_selfservice_email($p->{email})) ) -- cgit v1.2.1 From ebacbee63dfb9fd7e4ddd0f4c50432299b5a7b49 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 11 Sep 2018 11:27:42 -0400 Subject: RT# 39340 - configured the minimal selfservice to get mac address from radius account table --- FS/FS/ClientAPI/MyAccount.pm | 30 ++++++++++++++++++++++++++++-- FS/FS/ClientAPI_XMLRPC.pm | 1 + 2 files changed, 29 insertions(+), 2 deletions(-) (limited to 'FS') diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 8c8cfc2ee..eda52e9b4 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -183,6 +183,29 @@ sub skin_info { } +sub get_mac_address { + my $p = shift; + +## access radius exports acct tables to get mac + my @part_export = (); + @part_export = ( + qsearch( 'part_export', { 'exporttype' => 'sqlradius' } ), + qsearch( 'part_export', { 'exporttype' => 'sqlradius_withdomain' } ), + qsearch( 'part_export', { 'exporttype' => 'broadband_sqlradius' } ), + ); + + my @sessions; + foreach my $part_export (@part_export) { + push @sessions, ( @{ $part_export->usage_sessions( { + 'ip' => $p->{'ip'}, + } ) } ); + } + + my $mac = $sessions[0]->{'callingstationid'}; + + return { 'mac_address' => $mac, }; +} + sub login_info { my $p = shift; @@ -238,8 +261,11 @@ sub login { } elsif ( $p->{'domain'} eq 'ip_mac' ) { - my $svc_broadband = qsearchs( 'svc_broadband', { 'mac_addr' => $p->{'username'} } ); - return { error => 'IP address not found' } + my $mac_address = $p->{'username'}; + $mac_address =~ s/\://g; + + my $svc_broadband = qsearchs( 'svc_broadband', { 'mac_addr' => $mac_address } ); + return { error => 'MAC address not found '.$p->{'username'} } unless $svc_broadband; $svc_x = $svc_broadband; diff --git a/FS/FS/ClientAPI_XMLRPC.pm b/FS/FS/ClientAPI_XMLRPC.pm index 0e7add063..76992af8d 100644 --- a/FS/FS/ClientAPI_XMLRPC.pm +++ b/FS/FS/ClientAPI_XMLRPC.pm @@ -222,6 +222,7 @@ sub ss2clientapi { 'quotation_add_pkg' => 'MyAccount/quotation/quotation_add_pkg', 'quotation_remove_pkg' => 'MyAccount/quotation/quotation_remove_pkg', 'quotation_order' => 'MyAccount/quotation/quotation_order', + 'get_mac_address' => 'MyAccount/get_mac_address', 'freesideinc_service' => 'Freeside/freesideinc_service', }; -- cgit v1.2.1 From 55e25606b4df2ac531cec49d219cfd53ffae8a2f Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Thu, 13 Sep 2018 14:08:17 -0400 Subject: RT 39340 - v3 fix --- FS/FS/ClientAPI/MyAccount.pm | 1 + 1 file changed, 1 insertion(+) (limited to 'FS') diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index eda52e9b4..3390687ae 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -367,6 +367,7 @@ sub login { return { 'error' => '', 'session_id' => $session_id, + %$session, }; } -- cgit v1.2.1