[Rt-commit] r10096 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Mon Dec 24 18:50:56 EST 2007
Author: ruz
Date: Mon Dec 24 18:50:56 2007
New Revision: 10096
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/GnuPG.html
Log:
r9916 at cubic-pc (orig r9915): ruz | 2007-12-12 19:50:07 +0300
* add per user PrivateKey selector
Modified: rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/GnuPG.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/GnuPG.html (original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Admin/Users/GnuPG.html Mon Dec 24 18:50:56 2007
@@ -8,20 +8,59 @@
<& /Elements/ListActions, actions => \@results &>
-% if ( my $email = $UserObj->EmailAddress ) {
+% if ( $email ) {
<& /Admin/Elements/ShowKeyInfo, EmailAddress => $email &>
+% } else {
+<h2><% loc("User has empty email address") %></h2>
% }
+<form action="<%RT->Config->Get('WebPath')%>/Admin/Users/GnuPG.html" method="post" enctype="multipart/form-data">
+<input type="hidden" class="hidden" name="id" value="<% $UserObj->Id %>" />
+
+<& /Widgets/Form/Select,
+ Name => 'PrivateKey',
+ Description => loc('Private Key'),
+ Values => [ map $_->{'Key'}, @{ $keys_meta{'info'} } ],
+ CurrentValue => $private_key,
+ DefaultLabel => loc('No private key'),
+&>
+
+<& /Elements/Submit, Name => 'Update', Label => loc('Save Changes') &>
+</form>
+
<%ARGS>
-$id => undef
+$id => undef
+$Update => undef
</%ARGS>
<%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 );
+
+$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 $private_key = $UserObj->PrivateKey;
my $title = loc("User's GnuPG keys");
More information about the Rt-commit
mailing list