[Jifty-commit] r7017 - in wifty/trunk/lib/Wifty: .

Jifty commits jifty-commit at lists.jifty.org
Tue May 12 19:22:14 EDT 2009


Author: ruz
Date: Tue May 12 19:22:14 2009
New Revision: 7017

Modified:
   wifty/trunk/lib/Wifty/Model/Revision.pm
   wifty/trunk/lib/Wifty/View.pm

Log:
* only admins can see IPs
* show IP in the history

Modified: wifty/trunk/lib/Wifty/Model/Revision.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Model/Revision.pm	(original)
+++ wifty/trunk/lib/Wifty/Model/Revision.pm	Tue May 12 19:22:14 2009
@@ -121,11 +121,22 @@
 sub current_user_can {
     my $self = shift;
     my $right = shift;
-    
-    if ($right ne 'read' and not $self->current_user->is_superuser) {
-        return 0;
+    my %args = @_;
+
+    return 1 if $self->current_user->is_superuser;
+
+    if ( $right eq 'read' ) {
+        return 0
+            if $args{'column'}
+            && $args{'column'} eq 'ip'
+            && !(
+                $self->current_user->id
+                && $self->current_user->user_object->admin
+            );
+        return 1;
     }
-    $self->SUPER::current_user_can($right, @_);
+
+    $self->SUPER::current_user_can($right, %args);
 }
 
 1;

Modified: wifty/trunk/lib/Wifty/View.pm
==============================================================================
--- wifty/trunk/lib/Wifty/View.pm	(original)
+++ wifty/trunk/lib/Wifty/View.pm	Tue May 12 19:22:14 2009
@@ -104,6 +104,9 @@
             );
             outs(' (');
             user($rev->created_by);
+            if ( my $ip = $rev->ip ) { # only admins can see IPs
+                outs( ' - '. $ip );
+            }
             outs(')');
             outs( ' ', _('%1 bytes', length $rev->content ) );
             render_region(


More information about the Jifty-commit mailing list