[Rt-commit] r8332 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: . html/NoAuth html/Ticket

thayes at bestpractical.com thayes at bestpractical.com
Tue Jul 31 15:40:23 EDT 2007


Author: thayes
Date: Tue Jul 31 15:40:19 2007
New Revision: 8332

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-TUNIS/html/NoAuth/Logout.html
   rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html
   rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm

Log:
 r8482 at toth:  toth | 2007-07-31 15:39:13 -0400
 * Added method to remove all locks for a particular user
 * Added call to this method so that logging out removes a user's locks
 


Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/html/NoAuth/Logout.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/html/NoAuth/Logout.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/html/NoAuth/Logout.html	Tue Jul 31 15:40:19 2007
@@ -45,6 +45,7 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
+% RT::Ticket::RemoveUserLocks($session{'CurrentUser'});
 <html>
 <head>
 <title>RT: Logout</title>

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Ticket/Display.html	Tue Jul 31 15:40:19 2007
@@ -149,7 +149,6 @@
                 push @Actions, loc('You now have a lock on this ticket');
             } else {
                 push @Actions, loc('Your attempt to lock this ticket failed');
-
             }
         } elsif ( $ARGS{'Lock'} eq 'remove' ) {
             my $lock = $TicketObj->Locked();

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm	Tue Jul 31 15:40:19 2007
@@ -237,7 +237,7 @@
 sub Lock {
     my $ticket = shift;
 
-    if ( $ticket->RT::Ticket::Locked ) {
+    if ( $ticket->Locked() ) {
         return undef;
     } else {
         $ticket->SetAttribute(
@@ -269,6 +269,21 @@
     $ticket->DeleteAttribute('RT_Lock');
 }
 
+
+
+sub RemoveUserLocks {
+	my $user = shift;
+
+	return undef unless $user;
+	
+	my $attribs = RT::Attributes->new($user);
+	$attribs->Limit(FIELD => 'Creator', OPERATOR=> '=', VALUE => $user->id(), ENTRYAGGREGATOR => 'AND');
+	my @attributes = $attribs->Named('RT_Lock');
+	foreach my $lock (@attributes) {
+		$lock->Delete();
+	}
+}
+
 =head2 Type
 
 Returns the current value of Type. 


More information about the Rt-commit mailing list