X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Faccess_group.html;h=736ab9c62db9bf719852af1dbbab0f3367e489f7;hb=8a00b4c10743a314f4a298879141b60d6096eb3b;hp=6ba89ea816ecc787ec4a400cbe3b03f015ac15ff;hpb=2c757d7db4cb6a7b9655de13206fcc84fb7ce61f;p=freeside.git diff --git a/httemplate/browse/access_group.html b/httemplate/browse/access_group.html index 6ba89ea81..736ab9c62 100644 --- a/httemplate/browse/access_group.html +++ b/httemplate/browse/access_group.html @@ -1,18 +1,6 @@ -<% - -my $html_init = - "Internal access groups control access to the back-office interface.

". - qq!Add an internal access group

!; - -my $count_query = 'SELECT COUNT(*) FROM access_group'; - -my $link = [ $p.'edit/access_group.html?', 'groupnum' ]; - -%><%= include( 'elements/browse.html', +<% include( 'elements/browse.html', 'title' => 'Internal Access Groups', - 'menubar' => [ # 'Main menu' => $p, - 'Internal users' => $p.'browse/access_user.html', - ], + 'menubar' => [ 'Internal users' => $p.'browse/access_user.html', ], 'html_init' => $html_init, 'name' => 'internal access groups', 'query' => { 'table' => 'access_group', @@ -22,12 +10,99 @@ my $link = [ $p.'edit/access_group.html?', 'groupnum' ]; 'count_query' => $count_query, 'header' => [ '#', 'Group name', + 'Agents', + 'Rights', ], 'fields' => [ 'groupnum', 'groupname', + $agents_sub, + $rights_sub, ], 'links' => [ $link, $link, + '', + '', ], ) %> +<%once> + +my $html_init = + "Internal access groups control access to the back-office interface.

". + qq!Add an internal access group

!; + +#false laziness w/access_user.html & agent_type.cgi +my $agents_sub = sub { + my $access_group = shift; + + [ map { + my $access_groupagent = $_; + my $agent = $access_groupagent->agent; + [ + { + 'data' => $agent->agent, + 'align' => 'left', + 'link' => $p. 'edit/agent.cgi?'. $agent->agentnum, + }, + ]; + } + grep { $_->agent } #? + $access_group->access_groupagent, + + ]; + +}; + +tie my %rights, 'Tie::IxHash', FS::AccessRight->rights_info; + +my $rights_sub = sub { + my $access_group = shift; + + #[ map { my $access_right = $_; + # [ + # { + # 'data' => $access_right->rightname, + # 'align' => 'left', + # }, + # ]; + # } + # $access_group->access_rights, + #]; + + #some false laziness w/edit/access_group.html + my $columns = 3; + my $count = 0; + + #include('/elements/table-grid.html', bgcolor=>'#cccccc' ). + ''. + ''. join( '', map { + + ''. + ( ++$count % $columns ? '' : '') + + } keys %rights ). '
'. + ''. + '
'. $_. '
'. + + join('
', grep { warn "$access_group->access_right($_): ". + $access_group->access_right($_). "\n"; + $access_group->access_right($_); } + map { ref($_) ? $_->{'rightname'} : $_; } + @{ $rights{$_} } + ). + + '
'; + +}; + +my $count_query = 'SELECT COUNT(*) FROM access_group'; + +my $link = [ $p.'edit/access_group.html?', 'groupnum' ]; + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +