diff options
author | levinse <levinse> | 2011-06-21 01:08:07 +0000 |
---|---|---|
committer | levinse <levinse> | 2011-06-21 01:08:07 +0000 |
commit | 9f2280fbce022ab9bcfc46fe94483730b0aeb0f8 (patch) | |
tree | 15865cb482bc3995d423f95f1d45ca13b90c4905 /httemplate | |
parent | 44ce5ab2e8edd012154d3bb7e5711341e8c6cf35 (diff) |
re-write RADIUS groups, RT13274
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/radius_group.html | 24 | ||||
-rwxr-xr-x | httemplate/edit/part_svc.cgi | 21 | ||||
-rw-r--r-- | httemplate/edit/process/radius_group.html | 10 | ||||
-rw-r--r-- | httemplate/edit/radius_group.html | 16 | ||||
-rwxr-xr-x | httemplate/edit/svc_acct.cgi | 22 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 3 | ||||
-rw-r--r-- | httemplate/elements/select-radius_group.html | 17 | ||||
-rw-r--r-- | httemplate/view/svc_acct/basics.html | 2 |
8 files changed, 89 insertions, 26 deletions
diff --git a/httemplate/browse/radius_group.html b/httemplate/browse/radius_group.html new file mode 100644 index 000000000..e2ac56363 --- /dev/null +++ b/httemplate/browse/radius_group.html @@ -0,0 +1,24 @@ +<& elements/browse.html, + 'title' => 'RADIUS Groups', + 'name' => 'RADIUS Groups', + 'menubar' => [ 'Add a RADIUS Group' => $p.'edit/radius_group.html', ], + 'query' => { 'table' => 'radius_group' }, + 'count_query' => 'SELECT COUNT(*) FROM radius_group', + 'header' => [ '#', 'RADIUS Group', 'Description' ], + 'fields' => [ 'groupnum', + 'groupname', + 'description', + ], + 'links' => [ [ $p.'edit/radius_group.html?', 'groupnum' ], + '', + '', + ], +&> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Configuration'); + +</%init> 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 <INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"><BR> % qq!<TEXTAREA NAME="${layer}__${field}">!. encode_entities($value). % '</TEXTAREA>'; % -% } 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'); + +</%init> 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'); + +</%init> 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() { <TR> <TD ALIGN="right"><% mt('RADIUS groups') |h %></TD> -% if ( $part_svc->part_svc_column('usergroup')->columnflag eq 'F' ) { - +% if ( $part_svc_usergroup->columnflag eq 'F' ) { <TD BGCOLOR="#eeeeee"><% join('<BR>', @groups) %></TD> % } else { - - <TD><% FS::svc_acct::radius_usergroup_selector( \@groups ) %></TD> +% 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; +% } + <TD><& /elements/select-radius_group.html, + curr_value => $radius_group_selected, + element_name => 'radius_usergroup', + &> + </TD> % } </TR> @@ -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'; diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index f5639a9ef..236fe6a53 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -545,6 +545,9 @@ $config_misc{'Inventory classes and inventory'} = [ $fsurl.'browse/inventory_cla $config_misc{'Hardware types'} = [ $fsurl.'browse/hardware_class.html', 'Set up hardware type catalog' ] if $curuser->access_right('Configuration'); +$config_misc{'RADIUS Groups'} = [ $fsurl.'browse/radius_group.html', 'Manage RADIUS groups' ] + if $curuser->access_right('Configuration'); + tie my %config_menu, 'Tie::IxHash'; if ( $curuser->access_right('Configuration' ) ) { %config_menu = ( diff --git a/httemplate/elements/select-radius_group.html b/httemplate/elements/select-radius_group.html new file mode 100644 index 000000000..eeaf5ac55 --- /dev/null +++ b/httemplate/elements/select-radius_group.html @@ -0,0 +1,17 @@ +<SELECT MULTIPLE NAME = "<% $opt{'element_name'} || $opt{'field'} || 'usergroup' %>" + <% $opt{'element_etc'} %> +> +% foreach my $selopt ( keys %groups ) { +% my $selected = (grep{ $_ eq $selopt } @sel_groups) ? 'SELECTED' : ''; + <OPTION VALUE="<%$selopt%>" <% $selected %>><% $groups{$selopt} %></OPTION> +% } +</SELECT> +<%init> + +my %opt = @_; + +my %groups = map { $_->groupnum => $_->description . " (" . $_->groupname . ")" } + qsearch('radius_group', {}); +my @sel_groups = split(/,/,$opt{'curr_value'}); + +</%init> diff --git a/httemplate/view/svc_acct/basics.html b/httemplate/view/svc_acct/basics.html index 4386a8318..6a0ed9260 100644 --- a/httemplate/view/svc_acct/basics.html +++ b/httemplate/view/svc_acct/basics.html @@ -100,7 +100,7 @@ % } <& /view/elements/tr.html, label=>mt('RADIUS groups'), - value=>join('<BR>', $svc_acct->radius_groups) &> + value=>join('<BR>', $svc_acct->radius_groups('COMBINED')) &> %# Can this be abstracted further? Maybe a library function like %# widget('HTML', 'view', $svc_acct) ? It would definitely make UI |