X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Faccess_group.html;h=ccb64e1522e303fdf6f0864c266eb25c86fd0be7;hb=1f0e0fb65fdd32d57a3134c018d5a1dc0f09e249;hp=d1c3aea4cfb1036086a5c5e1b0bdba4ff94a292f;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0;p=freeside.git
diff --git a/httemplate/browse/access_group.html b/httemplate/browse/access_group.html
index d1c3aea4c..ccb64e152 100644
--- a/httemplate/browse/access_group.html
+++ b/httemplate/browse/access_group.html
@@ -1,53 +1,3 @@
-%
-%
-%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,
-%
-% ];
-%
-%};
-%
-%my $rights_sub = sub {
-% my $access_group = shift;
-%
-% [ map { my $access_right = $_;
-% [
-% {
-% 'data' => $access_right->rightname,
-% 'align' => 'left',
-% },
-% ];
-% }
-% $access_group->access_rights,
-%
-% ];
-%
-%};
-%
-%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,
@@ -77,3 +27,84 @@
],
)
%>
+<%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 {
+
+ ''.
+ ''. $_. ' | '.
+ ''.
+
+ join(' ', grep { warn "$access_group->access_right($_): ".
+ $access_group->access_right($_). "\n";
+ $access_group->access_right($_); }
+ map { ref($_) ? $_->{'rightname'} : $_; }
+ @{ $rights{$_} }
+ ).
+
+ ' | | '.
+ ( ++$count % $columns ? '' : '
')
+
+ } keys %rights ). '
';
+
+};
+
+my $count_query = 'SELECT COUNT(*) FROM access_group';
+
+my $link = [ $p.'edit/access_group.html?', 'groupnum' ];
+
+%once>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+%init>