[Rt-commit] rt branch, admin_ui, updated. 8cc1b04cdbaa14c7856051b560da9f3b1b106c58
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Sun Dec 27 22:49:12 EST 2009
The branch, admin_ui has been updated
via 8cc1b04cdbaa14c7856051b560da9f3b1b106c58 (commit)
from 6921c5e0266bfd7f4c471c4a5fbbd963f23048e0 (commit)
Summary of changes:
lib/RT/View/Admin/Users.pm | 55 +--------------------------------------
lib/RT/View/Helpers.pm | 60 +++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 61 insertions(+), 54 deletions(-)
- Log -----------------------------------------------------------------
commit 8cc1b04cdbaa14c7856051b560da9f3b1b106c58
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Dec 28 11:48:17 2009 +0800
abstract show_key_info stuff
diff --git a/lib/RT/View/Admin/Users.pm b/lib/RT/View/Admin/Users.pm
index 8bd9be1..ed0c698 100644
--- a/lib/RT/View/Admin/Users.pm
+++ b/lib/RT/View/Admin/Users.pm
@@ -50,6 +50,7 @@ use strict;
package RT::View::Admin::Users;
use Jifty::View::Declare -base;
+use RT::View::Helpers qw/show_key_info/;
use base 'RT::View::CRUD';
use constant page_title => 'User Management';
@@ -140,59 +141,7 @@ template 'gnupg' => page { title => _('User GnuPG') } content {
return;
}
- my %res = RT::Crypt::GnuPG::get_key_info( $user->email, 'public' );
-
- if ( $res{'exit_code'} || !keys %{ $res{'info'} } ) {
- outs( _('No keys for this address') );
- }
- else {
- h3 { _('GnuPG public key for %1', $user->email) };
- table {
- row {
- th { _( 'Trust' . ':' ) };
- cell {
- _( $res{'info'}{'trust'} );
- };
- };
- row {
- th { _( 'Created' . ':' ) };
- cell {
- $res{'info'}{'created'}
- ? $res{'info'}{'created'}->date
- : _('never');
- };
- };
-
- row {
- th { _('Expire') . ':' };
- cell {
- $res{'info'}{'expire'}
- ? $res{'info'}{'expire'}->date
- : _('never');
- };
- };
-
- for my $uinfo ( @{ $res{'info'}{'user'} } ) {
- row {
- th { _('User (Created - expire)') . ':' };
- cell {
- $uinfo->{'string'}
- . '(' . (
- $uinfo->{'created'} ? $uinfo->{'created'}->date
- : _('never') . ' - '
- )
- . (
- $uinfo->{'expire'} ? $uinfo->{'expire'}->date
- : _('never')
- ) . ')';
- };
- };
- }
- };
- }
-
- my %keys_meta =
- RT::Crypt::GnuPG::get_keys_for_signing( $user->email, 'force' );
+ show_key_info( $user->email, 'public' );
my $moniker = 'select_private_key';
my $action = new_action(
diff --git a/lib/RT/View/Helpers.pm b/lib/RT/View/Helpers.pm
index 28e53f3..da3c23d 100644
--- a/lib/RT/View/Helpers.pm
+++ b/lib/RT/View/Helpers.pm
@@ -49,9 +49,12 @@ use warnings;
use strict;
package RT::View::Helpers;
+use Jifty::View::Declare -base;
+
use base qw/Exporter/;
our @EXPORT = ();
-our @EXPORT_OK = qw(render_user render_user_concise render_user_verbose);
+our @EXPORT_OK = qw(render_user render_user_concise render_user_verbose
+ show_key_info );
sub render_user {
my $user = shift;
@@ -114,5 +117,60 @@ sub render_user_verbose {
return $address->format;
}
+sub show_key_info {
+ my $email = shift;
+ my $type = shift || 'public';
+ my %res = RT::Crypt::GnuPG::get_key_info( $email, $type );
+
+ if ( $res{'exit_code'} || !keys %{ $res{'info'} } ) {
+ outs( _('No keys for this address') );
+ }
+ else {
+ h3 { _('GnuPG public key for %1', $email) };
+ table {
+ row {
+ th { _( 'Trust' . ':' ) };
+ cell {
+ _( $res{'info'}{'trust'} );
+ };
+ };
+ row {
+ th { _( 'Created' . ':' ) };
+ cell {
+ $res{'info'}{'created'}
+ ? $res{'info'}{'created'}->date
+ : _('never');
+ };
+ };
+
+ row {
+ th { _('Expire') . ':' };
+ cell {
+ $res{'info'}{'expire'}
+ ? $res{'info'}{'expire'}->date
+ : _('never');
+ };
+ };
+
+ for my $uinfo ( @{ $res{'info'}{'user'} } ) {
+ row {
+ th { _('User (Created - expire)') . ':' };
+ cell {
+ $uinfo->{'string'}
+ . '(' . (
+ $uinfo->{'created'} ? $uinfo->{'created'}->date
+ : _('never') . ' - '
+ )
+ . (
+ $uinfo->{'expire'} ? $uinfo->{'expire'}->date
+ : _('never')
+ ) . ')';
+ };
+ };
+ }
+ };
+ }
+}
+
1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list