More rigorous session-cleanup for BecomeUser
authorMikal Kolbein Gule <m.k.gule@usit.uio.no>
Tue, 10 Jul 2012 08:30:15 +0000 (10:30 +0200)
committerMikal Kolbein Gule <m.k.gule@usit.uio.no>
Tue, 10 Jul 2012 08:30:15 +0000 (10:30 +0200)
Kevin Falcone commented:
> We cheched it out with our become-user-thingie which basically
> does:
> $session{'CurrentUser'}->Load($user);
> delete $session{'my_rt_portlets'};
> $session{'CurrentUser'}->{'_principal_obj'}->{'values'}->{'id'} = $session{'CurrentUser'}->id;

That should be enough to work around the SeeQueue cache, although I'd
probably make the 3rd line just a
delete $session{'CurrentUser}{'_principal_obj'}
and let RT reload the Principal when it needs it. That avoids any
potential "what?" happening.

local/html/Admin/Tools/BecomeUser.html

index a39e3f6..1106ae6 100644 (file)
@@ -65,7 +65,7 @@
       } 
       delete $session{'my_rt_portlets'};
       unless ( defined($ARGS{'submit'}) && $ARGS{'submit'} =~ m/super/ ){
-          $session{'CurrentUser'}->{'_principal_obj'}->{'values'}->{'id'} = $session{'CurrentUser'}->id;
+          delete $session{'CurrentUser'}->{'_principal_obj'};
       }
    }