[Rt-commit] rt branch, 4.2/unowned-create, created. rt-4.0.8-803-g95a8e2f
Alex Vandiver
alexmv at bestpractical.com
Mon Dec 3 19:01:59 EST 2012
The branch, 4.2/unowned-create has been created
at 95a8e2fe920765081918123c5f4aad9d5f076c41 (commit)
- Log -----------------------------------------------------------------
commit 95a8e2fe920765081918123c5f4aad9d5f076c41
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Mon Dec 3 18:50:43 2012 -0500
Remove a warning durng creation of unowned tickets
While 656b955 added the "Nobody" user to single-user groups during group
creation, 3911c5d and 3ae488e combine to parse an empty user as Nobody,
and then attempt to add that user to the group -- which already contains
it. This causes unwarranted warnings during ticket creation for unowned
tickets.
Avoid these warnings by, during creation, skipping group membership
addition of the principal is already present in the group. This also
avoids warnings in the case where a principal is provided twice to a
role.
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 927e662..ee5a8bc 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -2487,10 +2487,12 @@ sub _AddRolesOnCreate {
my $changed = 0;
for my $role (keys %{$roles}) {
+ my $group = $self->RoleGroup($role);
my @left;
for my $principal (@{$roles->{$role}}) {
if ($acls{$role}->($principal)) {
- my ($ok, $msg) = $self->RoleGroup($role)->_AddMember(
+ next if $group->HasMember($principal);
+ my ($ok, $msg) = $group->_AddMember(
PrincipalId => $principal->id,
InsideTransaction => 1,
RecordTransaction => 0,
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list