[Rt-commit] rt branch, 4.2/owner-validation, created. rt-4.2.1-5-g82514bf
Alex Vandiver
alexmv at bestpractical.com
Wed Nov 20 17:52:36 EST 2013
The branch, 4.2/owner-validation has been created
at 82514bf2d9172e6015dbff936cf642e7a5cd8868 (commit)
- Log -----------------------------------------------------------------
commit d27aa8fd55abb053da884cec698b61e51d12f26d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Nov 20 17:36:18 2013 -0500
Remove a duplicated clause
$roles->{$role}->id is guaranteed to be false, as it was checked but two
lines above.
diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index 21fb076..eb29dc8 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -526,7 +526,7 @@ sub _ResolveRoles {
}
unless ($roles->{$role}->id) {
push @errors, $self->loc("Invalid value for [_1]",loc($role));
- $roles->{$role} = RT->Nobody->PrincipalObj unless $roles->{$role}->id;
+ $roles->{$role} = RT->Nobody->PrincipalObj;
}
# For consistency, we always return an arrayref
$roles->{$role} = [ $roles->{$role} ];
commit 93bece21a16a87f8210c741a94184b0ff1921452
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Nov 20 17:33:05 2013 -0500
Resolve a runtime error if an invalid Owner was passed
In the event that AutocompleteOwners is enabled, users may enter
arbitrary values for Owner. If the load by id, name, and emailaddress
fails, the value of ->PrincipalObj was undef, leading to runtime errors
when ->id was called on it just below. This could also happen if an
unloaded user was passed in, which would similarly have an undef
->PrincipalObj.
Guard against this by checking first that the role's value is true,
before checking for its id.
diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index eb29dc8..2543032 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -524,7 +524,7 @@ sub _ResolveRoles {
$user->LoadByEmail( $value ) unless $user->id;
$roles->{$role} = $user->PrincipalObj;
}
- unless ($roles->{$role}->id) {
+ unless ($roles->{$role} and $roles->{$role}->id) {
push @errors, $self->loc("Invalid value for [_1]",loc($role));
$roles->{$role} = RT->Nobody->PrincipalObj;
}
commit 82514bf2d9172e6015dbff936cf642e7a5cd8868
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Nov 20 17:39:00 2013 -0500
Add a missing $self; loc() is a method on the record, not a subroutine
diff --git a/lib/RT/Record/Role/Roles.pm b/lib/RT/Record/Role/Roles.pm
index 2543032..29e17bf 100644
--- a/lib/RT/Record/Role/Roles.pm
+++ b/lib/RT/Record/Role/Roles.pm
@@ -525,7 +525,7 @@ sub _ResolveRoles {
$roles->{$role} = $user->PrincipalObj;
}
unless ($roles->{$role} and $roles->{$role}->id) {
- push @errors, $self->loc("Invalid value for [_1]",loc($role));
+ push @errors, $self->loc("Invalid value for [_1]",$self->loc($role));
$roles->{$role} = RT->Nobody->PrincipalObj;
}
# For consistency, we always return an arrayref
-----------------------------------------------------------------------
More information about the rt-commit
mailing list