[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-210-gc0eb022

Jesse Vincent jesse at bestpractical.com
Tue Nov 30 15:51:28 EST 2010


The branch, 3.8-trunk has been updated
       via  c0eb022dc1ddec7467baf26c3ece12dd78c2f8fd (commit)
       via  fcb23d724cee6cf58dbd15ee8354f947de146ffb (commit)
       via  1826f20e159b63d87c0f21980f592ee2422f4b59 (commit)
       via  88d2fa854f8957b0d7f589bc14dd366424687e61 (commit)
      from  5cfe42f5303fdcabf5b25654643ed9af6b76585c (commit)

Summary of changes:
 etc/RT_SiteConfig.pm                  |    1 +
 lib/RT/User_Overlay.pm                |   28 +++++++++++++++++++++++++---
 share/html/Admin/Elements/ShowKeyInfo |   10 ++++++----
 share/html/Admin/Users/GnuPG.html     |    6 ++++--
 4 files changed, 36 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit 88d2fa854f8957b0d7f589bc14dd366424687e61
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 30 15:12:32 2010 -0500

    Fix a variable name in lib/RT/User_Overlay.pm

diff --git a/lib/RT/User_Overlay.pm b/lib/RT/User_Overlay.pm
index 21a9e4f..c6dd38d 100755
--- a/lib/RT/User_Overlay.pm
+++ b/lib/RT/User_Overlay.pm
@@ -1352,7 +1352,7 @@ admin right) 'ModifySelf', return 1. otherwise, return undef.
 
 sub CurrentUserCanModify {
     my $self  = shift;
-    my $right = shift;
+    my $field = shift;
 
     if ( $self->CurrentUser->HasRight(Right => 'AdminUsers', Object => $RT::System) ) {
         return (1);
@@ -1360,7 +1360,7 @@ sub CurrentUserCanModify {
 
     #If the field is marked as an "administrators only" field, 
     # don\'t let the user touch it.
-    elsif ( $self->_Accessible( $right, 'admin' ) ) {
+    elsif ( $self->_Accessible( $field, 'admin' ) ) {
         return (undef);
     }
 

commit 1826f20e159b63d87c0f21980f592ee2422f4b59
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 30 15:47:27 2010 -0500

    ACLing for Private/Public key methods (which aren't accessible through a
    non-ACLed codepath, but better safe than sorry)

diff --git a/lib/RT/User_Overlay.pm b/lib/RT/User_Overlay.pm
index c6dd38d..ab252bb 100755
--- a/lib/RT/User_Overlay.pm
+++ b/lib/RT/User_Overlay.pm
@@ -1706,6 +1706,14 @@ sub PreferredKey
 {
     my $self = shift;
     return undef unless RT->Config->Get('GnuPG')->{'Enable'};
+
+    if ( ($self->CurrentUser->Id != $self->Id )  &&
+          !$self->CurrentUser->HasRight(Right =>'AdminUsers', Object => $RT::System) ) {
+          return undef;
+    }
+
+
+
     my $prefkey = $self->FirstAttribute('PreferredKey');
     return $prefkey->Content if $prefkey;
 
@@ -1732,6 +1740,16 @@ sub PreferredKey
 sub PrivateKey {
     my $self = shift;
 
+
+    #If the user wants to see their own values, let them.
+    #If the user is an admin, let them.
+    #Otherwwise, don't let them.
+    #
+    if ( ($self->CurrentUser->Id != $self->Id )  &&
+          !$self->CurrentUser->HasRight(Right =>'AdminUsers', Object => $RT::System) ) {
+          return undef;
+    }
+
     my $key = $self->FirstAttribute('PrivateKey') or return undef;
     return $key->Content;
 }
@@ -1739,7 +1757,11 @@ sub PrivateKey {
 sub SetPrivateKey {
     my $self = shift;
     my $key = shift;
-    # XXX: ACL
+
+    unless ($self->CurrentUserCanModify('PrivateKey')) {
+        return (0, $self->loc("Permission Denied"));
+    }
+
     unless ( $key ) {
         my ($status, $msg) = $self->DeleteAttribute('PrivateKey');
         unless ( $status ) {

commit fcb23d724cee6cf58dbd15ee8354f947de146ffb
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 30 15:49:10 2010 -0500

    UI improvements for key management

diff --git a/share/html/Admin/Elements/ShowKeyInfo b/share/html/Admin/Elements/ShowKeyInfo
index a6afa29..d4b99ef 100644
--- a/share/html/Admin/Elements/ShowKeyInfo
+++ b/share/html/Admin/Elements/ShowKeyInfo
@@ -52,17 +52,19 @@
 <table>
 
 % unless ( $Type eq 'private' ) {
-<tr><th><% loc('Trust') %>:</th>  <td><% loc( $res{'info'}{'Trust'} ) %></td></tr>
+<tr><th class="label"><% loc('Trust') %>:</th>  <td><% loc( $res{'info'}{'Trust'} ) %></td></tr>
 % }
 
-<tr><th><% loc('Created') %>:</th>
+<tr><th class="label"><% loc('Fingerprint') %>:</th>
+<td><% $res{'info'}{'Fingerprint'} %></td></tr>
+<tr><th class="label"><% loc('Created') %>:</th>
 <td><% $res{'info'}{'Created'}? $res{'info'}{'Created'}->AsString( Time => 0 ): loc('never') %></td></tr>
 
-<tr><th><% loc('Expire') %>:</th>
+<tr><th class="label"><% loc('Expire') %>:</th>
 <td><% $res{'info'}{'Expire'}? $res{'info'}{'Expire'}->AsString( Time => 0 ): loc('never') %></td></tr>
 
 % foreach my $uinfo( @{ $res{'info'}{'User'} } ) {
-<tr><th><% loc('User (created - expire)') %>:</th>
+<tr><th class="label"><% loc('User (created - expire)') %>:</th>
 <td><% $uinfo->{'String'} %>\
 (<% $uinfo->{'Created'}? $uinfo->{'Created'}->AsString( Time => 0 ): loc('never') %> - \
 <% $uinfo->{'Expire'}? $uinfo->{'Expire'}->AsString( Time => 0 ): loc('never') %>)
diff --git a/share/html/Admin/Users/GnuPG.html b/share/html/Admin/Users/GnuPG.html
index c4e3906..5b55b3e 100644
--- a/share/html/Admin/Users/GnuPG.html
+++ b/share/html/Admin/Users/GnuPG.html
@@ -61,9 +61,11 @@
 <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/TitleBox, title => 'GnuPG private key'&>
 <& /Widgets/Form/Select,
     Name         => 'PrivateKey',
     Description  => loc('Private Key'),
@@ -71,10 +73,10 @@
     CurrentValue => $UserObj->PrivateKey,
     DefaultLabel => loc('No private key'),
 &>
+</&>
 
 <& /Elements/Submit, Name => 'Update', Label => loc('Save Changes') &>
 </form>
-
 <%ARGS>
 $id         => undef
 $Update     => undef

commit c0eb022dc1ddec7467baf26c3ece12dd78c2f8fd
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Nov 30 15:49:22 2010 -0500

    Better page name for user key management page

diff --git a/etc/RT_SiteConfig.pm b/etc/RT_SiteConfig.pm
index 1661e4d..a0cdede 100755
--- a/etc/RT_SiteConfig.pm
+++ b/etc/RT_SiteConfig.pm
@@ -16,4 +16,5 @@
 
 Set( $rtname, 'example.com');
 #Set(@Plugins,(qw(Extension::QuickDelete RT::FM)));
+Set($DevelMode => 1);
 1;
diff --git a/share/html/Admin/Users/GnuPG.html b/share/html/Admin/Users/GnuPG.html
index 5b55b3e..1a80877 100644
--- a/share/html/Admin/Users/GnuPG.html
+++ b/share/html/Admin/Users/GnuPG.html
@@ -109,6 +109,6 @@ if ( $Update ) {
     push @results, $msg;
 }
 
-my $title = loc("User's GnuPG keys");
+my $title = loc("[_1]'s GnuPG keys",$UserObj->Name);
 
 </%INIT>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list