[Rt-commit] rt branch, 4.2/nobody-user-format, created. rt-4.1.6-383-ge7bd378
Alex Vandiver
alexmv at bestpractical.com
Wed Mar 27 18:33:48 EDT 2013
The branch, 4.2/nobody-user-format has been created
at e7bd378d438411e86bfcacb72032378e959c290c (commit)
- Log -----------------------------------------------------------------
commit f18f7ef25ac2c3f378ae13cc49ab2954ad8514e0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Mar 27 15:31:40 2013 -0700
Allow ->CustomFields on a RT::CurrentUser to work as for RT::User objects
Failure to explicitly set the CustomFieldLookupType means that CF
lookups on RT::CurrentUser objects fail because they limit on LookupType
= 'RT::CurrentUser'.
diff --git a/lib/RT/CurrentUser.pm b/lib/RT/CurrentUser.pm
index af3d53e..a87cec3 100644
--- a/lib/RT/CurrentUser.pm
+++ b/lib/RT/CurrentUser.pm
@@ -270,6 +270,10 @@ sub CurrentUser {
return shift;
}
+sub CustomFieldLookupType {
+ return "RT::User";
+}
+
RT::Base->_ImportOverlays();
1;
commit e7bd378d438411e86bfcacb72032378e959c290c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Mar 27 15:27:45 2013 -0700
Load a Nobody user, not the Nobody current user
RT->Nobody returns a RT::CurrentUser, whose current_user is Nobody.
This object often cannot have its custom fields inspected by a custom
->Format -- even with f18f7ef -- because the custom fields might well
not be visible because they are loaded as the Nobody user itself.
Load a RT::User object as the current user, rather than using
RT->Nobody, which loads it as a user with no permissions.
diff --git a/share/html/Elements/SelectOwnerDropdown b/share/html/Elements/SelectOwnerDropdown
index 17e6ac6..a291aee 100644
--- a/share/html/Elements/SelectOwnerDropdown
+++ b/share/html/Elements/SelectOwnerDropdown
@@ -51,7 +51,9 @@
%}
% $Default = 0 unless defined $Default && $Default =~ /^\d+$/;
% my @formatednames = sort {lc $a->[1] cmp lc $b->[1]} map {[$_, $_->Format]} grep { $_->id != RT->Nobody->id } @users;
-% my $nobody = [RT->Nobody, RT->Nobody->Format(CurrentUser => $session{CurrentUser})];
+% my $nobody_user = RT::User->new( $session{CurrentUser} );
+% $nobody_user->Load( RT->Nobody->id );
+% my $nobody = [$nobody_user, $nobody_user->Format];
% unshift @formatednames, $nobody;
%foreach my $UserRef ( @formatednames) {
%my $User = $UserRef->[0];
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list