<%doc> HTML form for access rights (special case of edit) <%args> $table $id => undef $select_id => undef $selected => undef $showheader => undef $dowindow => 0 $object_class => undef @object_id => undef $person => undef $contactlist => undef @access => undef $submit => undef %args => undef <%init> my $DEBUG = 0; my $title = "$table " . $ui->table_descr_link($table, "[?]"); # Consolidate args variables foreach my $arg ( %args ){ $ARGS{$arg} = $args{$arg}; } print '%ARGS is
', Dumper(%ARGS), '

' if $DEBUG; if ( $submit ){ if ( !defined($access[0]) ){ $m->comp('error.mhtml', error=>"No Permissions were selected, please select one or more permissions to grant"); } if(! $object_id[0] ){ $m->comp('error.mhtml', error=>"No objects were selected, please select objects to grant permissions on"); } if(! $object_class){ $m->comp('error.mhtml', error=>"No object class was selected, please select an object class"); } eval { if ( $object_class && $object_id[0] ){ foreach my $object_id ( @object_id ){ foreach my $access ( @access ){ my $accessright = AccessRight->find_or_create({object_class => $object_class, object_id => $object_id, access => $access}); if ( $table eq 'Person' ){ UserRight->find_or_create({accessright=>$accessright, person=>$id}); }elsif ( $table eq 'ContactList' ){ GroupRight->find_or_create({accessright=>$accessright, contactlist=>$id}); } } } } }; if ( my $e= $@ ){ $m->comp('error.mhtml', error=>$e); } } % if( $id ) { % if ( $table eq 'Person' ){ % $m->comp('view.html', table=>$table, id=>$id); % }else{ % $m->comp('contactlist.html', id=>$id); % } % }else{ % if ( ! $showheader ){ % $m->clear_buffer; % my $js_prefix = $r->dir_config('NetdotPath') . "java_script"; % for my $script qw( select jsrsClient ) { % } %}
<% $title %>
<%perl> my (@field_headers, @cell_data); if ( $ARGS{person} ){ my $person = Person->retrieve($ARGS{person}); push @field_headers, 'User:'; push @cell_data, $person->get_label; print ""; print ""; }elsif ( $ARGS{contactlist} ){ my $cl = ContactList->retrieve($ARGS{contactlist}); push @field_headers, 'Contact List:'; push @cell_data, $cl->get_label; print ""; print ""; } push @field_headers, 'Object Class:'; my @classes = qw(ContactList Device Ipblock Zone); push @cell_data, &{sub{ my $out; $out .= ""; }}; push @field_headers, 'Object:'; push @cell_data, &{sub{ my $out; $out .= "
"; $out .= ""; $out .= ""; }}; push @field_headers, 'Permissions:'; push @cell_data, &{sub{ my $out; $out .= ""; }}; <& /generic/attribute_table.mhtml, field_headers=>\@field_headers, data=>\@cell_data, width=>"1", headercolwidth=>"15%", datacolwidth=>"35%" &>
% if ( $dowindow ){ % }else{ % }
% if ( $showheader ){ % }else{ % } % }