X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Faccess_group.html;h=2df0ba053f06c2e78418918f758b61b2415deebc;hp=9ebb2b88234a4838364d2a65a5c80bd74f791680;hb=7d34aacffa38c4cac09b54080487a66c264e4668;hpb=c738a3c4923774b64960aa87fa58bd0751487edb diff --git a/httemplate/browse/access_group.html b/httemplate/browse/access_group.html index 9ebb2b882..2df0ba053 100644 --- a/httemplate/browse/access_group.html +++ b/httemplate/browse/access_group.html @@ -1,8 +1,35 @@ -<% +<% include( 'elements/browse.html', + 'title' => 'Employee Groups', + 'menubar' => [ 'View Employees' => $p.'browse/access_user.html', ], + 'html_init' => $html_init, + 'name' => 'employee groups', + 'query' => { 'table' => 'access_group', + 'hashref' => {}, + 'order_by' => 'ORDER BY groupname', #?? + }, + '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

!; + "Employee groups control access to the back-office interface. Each employee can be assigned to one or more groups.

". + qq!Add an employee group

!; #false laziness w/access_user.html & agent_type.cgi my $agents_sub = sub { @@ -26,20 +53,43 @@ my $agents_sub = sub { }; +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, + #[ 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 { $access_group->access_right($_); } + map { ref($_) ? $_->{'rightname'} : $_; } + @{ $rights{$_} } + ). + + '
'; }; @@ -47,32 +97,10 @@ my $count_query = 'SELECT COUNT(*) FROM access_group'; my $link = [ $p.'edit/access_group.html?', 'groupnum' ]; -%><%= include( 'elements/browse.html', - 'title' => 'Internal Access Groups', - 'menubar' => [ # 'Main menu' => $p, - 'Internal users' => $p.'browse/access_user.html', - ], - 'html_init' => $html_init, - 'name' => 'internal access groups', - 'query' => { 'table' => 'access_group', - 'hashref' => {}, - 'extra_sql' => 'ORDER BY groupname', #?? - }, - 'count_query' => $count_query, - 'header' => [ '#', - 'Group name', - 'Agents', - 'Rights', - ], - 'fields' => [ 'groupnum', - 'groupname', - $agents_sub, - $rights_sub, - ], - 'links' => [ $link, - $link, - '', - '', - ], - ) -%> + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +