From 9f2280fbce022ab9bcfc46fe94483730b0aeb0f8 Mon Sep 17 00:00:00 2001 From: levinse Date: Tue, 21 Jun 2011 01:08:07 +0000 Subject: re-write RADIUS groups, RT13274 --- httemplate/edit/part_svc.cgi | 21 ++------------------- httemplate/edit/process/radius_group.html | 10 ++++++++++ httemplate/edit/radius_group.html | 16 ++++++++++++++++ httemplate/edit/svc_acct.cgi | 22 ++++++++++++++++------ 4 files changed, 44 insertions(+), 25 deletions(-) create mode 100644 httemplate/edit/process/radius_group.html create mode 100644 httemplate/edit/radius_group.html (limited to 'httemplate/edit') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 97e2d9694..8ca019649 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -314,32 +314,15 @@ Service
% qq!'; % -% } elsif ( $def->{type} eq 'select-svc_pbx.html' ) { +% } elsif ( $def->{type} =~ /select-(.*?).html/ ) { % -% $html .= include('/elements/select-svc_pbx.html', +% $html .= include("/elements/".$def->{type}, % 'curr_value' => $value, % 'element_name' => "${layer}__${field}", % 'element_etc' => $disabled, % 'multiple' => ($flag eq 'S'), % ); % -% } elsif ( $def->{type} eq 'select-lnp_status.html' ) { -% -% $html .= include('/elements/select-lnp_status.html', -% 'curr_value' => $value, -% 'element_name' => "${layer}__${field}", -% 'element_etc' => $disabled, -% 'multiple' => ($flag eq 'S'), -% ); -% -% } elsif ( $def->{type} eq 'radius_usergroup_selector' ) { -% -% #XXX disable the RADIUS usergroup selector? ugh it sure does need -% #an overhaul, people have dum group problems because of it -% -% $html .= FS::svc_acct::radius_usergroup_selector( -% [ split(',', $value) ], "${layer}__${field}" ); -% % } elsif ( $def->{type} eq 'communigate_pro-accessmodes' ) { % % $html .= include('/elements/communigate_pro-accessmodes.html', diff --git a/httemplate/edit/process/radius_group.html b/httemplate/edit/process/radius_group.html new file mode 100644 index 000000000..706813f2a --- /dev/null +++ b/httemplate/edit/process/radius_group.html @@ -0,0 +1,10 @@ +<& elements/process.html, + 'table' => 'radius_group', + 'viewall_dir' => 'browse', +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + + diff --git a/httemplate/edit/radius_group.html b/httemplate/edit/radius_group.html new file mode 100644 index 000000000..80e17ed83 --- /dev/null +++ b/httemplate/edit/radius_group.html @@ -0,0 +1,16 @@ +<& elements/edit.html, + 'name' => 'RADIUS Group', + 'table' => 'radius_group', + 'labels' => { + 'groupnum' => 'Group', + 'groupname' => 'RADIUS Group', + 'description' => 'Description', + }, + 'viewall_dir' => 'browse', +&> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + + diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index e6cd7d86c..33e5d0414 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -302,12 +302,21 @@ function randomPass() { <% mt('RADIUS groups') |h %> -% if ( $part_svc->part_svc_column('usergroup')->columnflag eq 'F' ) { - +% if ( $part_svc_usergroup->columnflag eq 'F' ) { <% join('
', @groups) %> % } else { - - <% FS::svc_acct::radius_usergroup_selector( \@groups ) %> +% my $radius_group_selected = ''; +% if ( $svc_acct->svcnum ) { +% $radius_group_selected = join(',',$svc_acct->radius_groups('NUMBERS')); +% } +% elsif ( !$svc_acct->svcnum && $part_svc_usergroup->columnflag eq 'D' ) { +% $radius_group_selected = $part_svc_usergroup->columnvalue; +% } + <& /elements/select-radius_group.html, + curr_value => $radius_group_selected, + element_name => 'radius_usergroup', + &> + % } @@ -433,9 +442,10 @@ unless ( $svcnum || $cgi->param('error') ) { #adding } +my $part_svc_usergroup = $part_svc->part_svc_column('usergroup'); #fixed radius groups always override & display -if ( $part_svc->part_svc_column('usergroup')->columnflag eq 'F' ) { - @groups = split(',', $part_svc->part_svc_column('usergroup')->columnvalue); +if ( $part_svc_usergroup->columnflag eq 'F' ) { + @groups = split(',', $part_svc_usergroup->columnvalue); } my $action = $svcnum ? 'Edit' : 'Add'; -- cgit v1.2.1