<& /Admin/Elements/Header, Title => $title &> <& /Admin/Elements/UserTabs, id => $id, UserObj => $UserObj, current_tab => 'Admin/Users/GnuPG.html?id='. $id, Title => $title, &> <& /Elements/ListActions, actions => \@results &> % if ( $email ) { <& /Admin/Elements/ShowKeyInfo, EmailAddress => $email &> % } else {

<% loc("User has empty email address") %>

% }
<& /Widgets/Form/Select, Name => 'PrivateKey', Description => loc('Private Key'), Values => [ map $_->{'Key'}, @{ $keys_meta{'info'} } ], CurrentValue => $UserObj->PrivateKey, DefaultLabel => loc('No private key'), &> <& /Elements/Submit, Name => 'Update', Label => loc('Save Changes') &>
<%ARGS> $id => undef $Update => undef <%INIT> return unless RT->Config->Get('GnuPG')->{'Enable'}; require RT::Crypt::GnuPG; my @results; my $UserObj = RT::User->new( $session{'CurrentUser'} ); $UserObj->Load( $id ); unless ( $UserObj->id ) { Abort( loc("Couldn't load user #[_1]", $id) ); } $id = $ARGS{'id'} = $UserObj->id; my $email = $UserObj->EmailAddress; my %keys_meta = RT::Crypt::GnuPG::GetKeysForSigning( $email, 'force' ); $ARGS{'PrivateKey'} = $m->comp('/Widgets/Form/Select:Process', Name => 'PrivateKey', Arguments => \%ARGS, Default => 1, ); if ( $Update ) { my ($status, $msg) = $UserObj->SetPrivateKey( $ARGS{'PrivateKey'} ); push @results, $msg; } my $title = loc("User's GnuPG keys");