[Rt-commit] r8043 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Fri Jun 29 21:08:26 EDT 2007
Author: ruz
Date: Fri Jun 29 21:08:25 2007
New Revision: 8043
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket_Overlay.pm
Log:
* refactor it a little, add more debugging
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket_Overlay.pm Fri Jun 29 21:08:25 2007
@@ -397,40 +397,37 @@
my $Owner;
if ( ref( $args{'Owner'} ) eq 'RT::User' ) {
- $Owner = $args{'Owner'};
+ if ( $args{'Owner'}->id ) {
+ $Owner = $args{'Owner'};
+ } else {
+ $RT::Logger->error('passed not loaded owner object');
+ push @non_fatal_errors, $self->loc("Invalid owner object");
+ $Owner = undef;
+ }
}
#If we've been handed something else, try to load the user.
elsif ( $args{'Owner'} ) {
$Owner = RT::User->new( $self->CurrentUser );
$Owner->Load( $args{'Owner'} );
-
- push( @non_fatal_errors,
+ unless ( $Owner->Id ) {
+ push @non_fatal_errors,
$self->loc("Owner could not be set.") . " "
- . $self->loc( "User '[_1]' could not be found.", $args{'Owner'} )
- )
- unless ( $Owner->Id );
+ . $self->loc( "User '[_1]' could not be found.", $args{'Owner'} );
+ $Owner = undef;
+ }
}
#If we have a proposed owner and they don't have the right
#to own a ticket, scream about it and make them not the owner
my $DeferOwner;
- if (
- ( defined($Owner) )
- and ( $Owner->Id )
- and ( $Owner->Id != $RT::Nobody->Id )
- and (
- !$Owner->HasRight(
- Object => $QueueObj,
- Right => 'OwnTicket'
- )
- )
- )
+ if ( $Owner && $Owner->Id != $RT::Nobody->Id
+ && !$Owner->HasRight( Object => $QueueObj, Right => 'OwnTicket' ) )
{
-
$DeferOwner = $Owner;
$Owner = undef;
+ $RT::Logger->debug('going to deffer setting owner');
}
@@ -632,7 +629,7 @@
# }}}
# Now that we've created the ticket and set up its metadata, we can actually go and check OwnTicket on the ticket itself.
# This might be different than before in cases where extensions like RTIR are doing clever things with RT's ACL system
- if ( defined($DeferOwner) ) {
+ if ( $DeferOwner ) {
if (!$DeferOwner->HasRight( Object => $self, Right => 'OwnTicket')) {
$RT::Logger->warning( "User " . $Owner->Name . "(" . $Owner->id . ") was proposed " . "as a ticket owner but has no rights to own " . "tickets in " . $QueueObj->Name );
More information about the Rt-commit
mailing list