[Rt-commit] rt branch, 4.2/history-display-groups-in-roles, created. rt-4.1.8-301-g8c9be2d
Alex Vandiver
alexmv at bestpractical.com
Tue May 14 02:10:14 EDT 2013
The branch, 4.2/history-display-groups-in-roles has been created
at 8c9be2d9556cf9a5964921f9fca7b7ac60e3b72c (commit)
- Log -----------------------------------------------------------------
commit 8c9be2d9556cf9a5964921f9fca7b7ac60e3b72c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon May 13 20:43:58 2013 -0400
Properly display transactions dealing with groups in role groups
The new transaction code assumed that the principals added and removed
from role groups were always users; properly handle the case where they
are groups instead.
RT 4.0 and earlier displayed them as "AdminCc GroupName added"; this
changes the wording slightly to add the word "group" before the group
name, to differentiate it from the cases where a user of that name was
added.
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index af70088..67e650c 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -688,6 +688,16 @@ sub _ProcessReturnValues {
} @values;
}
+sub _FormatPrincipal {
+ my $self = shift;
+ my $principal = shift;
+ if ($principal->IsUser) {
+ return $self->_FormatUser( $principal->Object );
+ } else {
+ return $self->loc("group [_1]", $principal->Object->Name);
+ }
+}
+
sub _FormatUser {
my $self = shift;
my $user = shift;
@@ -832,19 +842,19 @@ sub _FormatUser {
my $self = shift;
my $principal = RT::Principal->new($self->CurrentUser);
$principal->Load($self->NewValue);
- return ( "[_1] [_2] added", $self->loc($self->Field), $self->_FormatUser($principal->Object)); #loc
+ return ( "[_1] [_2] added", $self->loc($self->Field), $self->_FormatPrincipal($principal)); #loc
},
DelWatcher => sub {
my $self = shift;
my $principal = RT::Principal->new($self->CurrentUser);
$principal->Load($self->OldValue);
- return ( "[_1] [_2] deleted", $self->loc($self->Field), $self->_FormatUser($principal->Object)); #loc
+ return ( "[_1] [_2] deleted", $self->loc($self->Field), $self->_FormatPrincipal($principal)); #loc
},
SetWatcher => sub {
my $self = shift;
my $principal = RT::Principal->new($self->CurrentUser);
$principal->Load($self->NewValue);
- return ( "[_1] set to [_2]", $self->loc($self->Field), $self->_FormatUser($principal->Object)); #loc
+ return ( "[_1] set to [_2]", $self->loc($self->Field), $self->_FormatPrincipal($principal)); #loc
},
Subject => sub {
my $self = shift;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list