[rt-devel] Getting Custom Fields for a User
Lee Wilson
leefm40 at yahoo.co.uk
Fri Apr 27 14:38:59 EDT 2012
On 16/04/2012 15:25, Ruslan Zakirov wrote:
>
> If you have user object then you can just call my $cfs = $user->CustomFIelds;.
> You can take a look at CustomFIelds method in lib/RT/Record.pm.
>
> Even if you don't have user object then create one:
>
> my $cfs = RT::User->new( RT->SystemUser )->CustomFields;
>
> Use $session{CurrentUser} instead of SystemUser if it's web interface and
> you want to respect ACLs.
Hi Ruslan,
Thanks for that. Looking at the perldoc for User.pm doesn't give any
mention of that but I guess it's inherited from Record.pm
Think I've sussed out the problem, I was trying to run this as a none
privileged user but it didn't have access to SeeCustomFields based on
the code in CustomFields->Next:
return $self->Next unless $CF->CurrentUserHasRight('SeeCustomField');
I tried granting the SeeCustomField and ModifyCustomField rights on the
specific customer queue but that still didn't make the fields appear.
In the end I granted those two rights onto the global unprivileged group
which has made the fields appear but it seems a bit too open to me.
Eventually I think applying those rights to the specific custom field
has given what I needed.
Would this generally be the right way to do it?
Thanks again
Lee
More information about the rt-devel
mailing list