[rt-users] ModifyCustomField without SeeCustomField

Woody - Wild Thing Safaris woody at wildthingsafaris.com
Fri Aug 19 07:57:10 EDT 2016


Hi all,

I did not succeed in working out how to get around it by using 
callbacks, but instead added some code to remove the values if the user 
is a member of some group.

I did this hack, which might be useful to someone someday

note i only edited the Freeform custom field file as that's all i needed 
and i preserved the oldvalue in the oldvalue= argument

in local/html/Elements/ShowCustomField line 53

% while ( my $CustomField = $CustomFields->Next ) {
% my $Values = $Object->CustomFieldValues( $CustomField->Id );
% my $count = $Values->Count;
% next if $HideEmpty and not $count;

%# skip if member of group "NoSeeCF"
% my $group = new RT::Group($RT::SystemUser);
% $group->LoadUserDefinedGroup("NoSeeCF");
% next if ($group->HasMember($session{'CurrentUser'}->PrincipalObj) );

   <tr id="CF-<%$CustomField->id%>-ShowRow">
     <td class="label"><% $CustomField->Name %>:</td>
     <td class="value<% $count ? '' : ' no-value' %>">

in local/html/Elements/EditCustomFieldFreeForm line 52

% if ( defined $Cols ) {
size="<% $Cols %>" \
% }

%# remove value if member of NoSeeCF
% my $group = new RT::Group($RT::SystemUser);
% $group->LoadUserDefinedGroup("NoSeeCF");
% if ($group->HasMember($session{'CurrentUser'}->PrincipalObj) ) {
class="CF-<%$CustomField->id%>-Edit" oldvalue="<% defined($Default) ? 
$Default : ''%>"  value="" />
% } else {
class="CF-<%$CustomField->id%>-Edit" value="<% defined($Default) ? 
$Default : ''%>" />
% }

Thanks Matt

w.


On 14/08/16 21:25, Matt Zagrabelny wrote:
> On Sun, Aug 14, 2016 at 1:07 AM, Woody - Wild Thing Safaris
> <woody at wildthingsafaris.com> wrote:
>> Hi all,
>>
>> Is it possible to allow a user to edit a custom field, without being able to
>> see it's value? My testing looks like ModifyCustomField is not enough for
>> the field to show up in the update page, and SeeCustomField my also be
>> checked?
> You can always hack around that "limitation" with the callbacks.
>
> /Elements/EditCustomFields/{After,Before}CustomFields
>
> -m
>
>

-- 

-----------------------

Richard Wood (Woody)
Managing Director
Wild Thing Safaris Ltd.

UK: 2B Habbo St, Greenwich, London
Dar es Salaam: 5 Ethan St, Mbezi beach
Arusha: 3 Ebeneezer Rd, Njiro
PO BOX 34514 DSM
Office: +255 (0) 222 617 166
Office Mobile: +255 (0) 773 503 502
Direct: +255 742 373 327
Skype: woody1tz
http://wildthingsafaris.com




More information about the rt-users mailing list