
<& /Elements/ListActions, actions => \@results &>

<& /Admin/Tools/RightsMatrix/Elements/CustomFieldRightsMatrix, ObjectType => 'RTx::AssetTracker::Type', LookupType => 'RTx::AssetTracker::Type-RTx::AssetTracker::Asset', ObjectRights => \%a_rights, ObjectSystem => $RTx::AssetTracker::System, PrincipalObj => $principal, %ARGS &>

<h3>Asset Type Key:</h3>
For an asset type the possible permissions are:
<table border="1">
% foreach (keys %a_rights) {
<tr>
<td><%$_%></td><td><%$a_rights{$_}{RIGHT}%></td><td><%$a_rights{$_}{DESC}%></td>
</tr>
% }
</table>
<p>

<%INIT>

my $principal;
my @results;

if ($ARGS{Principal} =~ /^\d+$/) {
    $principal = RT::Principal->new($session{CurrentUser});
    my ($rv, $msg) = $principal->Load($ARGS{Principal});
    if (! $rv) {
        $m->comp("/Elements/Error", Why => loc("Principal not found"));
        $m->abort;
    }
}
elsif ($ARGS{Principal} =~ /^(.*)-Role$/) {
    $principal = RTx::RightsMatrix::RolePrincipal->new($1);
}
elsif ($ARGS{User}) {
    my $user = RT::User->new($session{CurrentUser});
    my ($rv, $msg) = $user->Load($ARGS{User});
    if (! $rv) {
        $m->comp("/Elements/Error", Why => loc("User [_1] not found: [_2]", $ARGS{User}, $msg));
        $m->abort;
    }
    $principal = $user->PrincipalObj;
}
else {
    $principal = $session{CurrentUser}->PrincipalObj;
}


</%INIT>
<%ARGS>
$User => undef
$Edit => 0
$Principal => 0
$Intersect => 0
</%ARGS>
<%ONCE>
my %a_rights = (
                  'q' => { RIGHT => 'SeeType',    DESC =>'Can see that asset type' },
                  'r' => { RIGHT => 'ShowAsset',    DESC =>'Can see assets of that type' },
                  'w' => { RIGHT => 'ModifyAsset', DESC =>'Can edit/modify assets of that type' },
                  'c' => { RIGHT => 'CreateAsset',  DESC =>'Can create assets of that type' },
                  'd' => { RIGHT => 'RetireAsset',  DESC =>'Can delete assets of that type' },
                 );

</%ONCE>
