Re: [rt-users] ModifyCustomField without SeeCustomField

2016-08-19 Thread Woody - Wild Thing Safaris

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) );

  
<% $CustomField->Name %>:


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
 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

-
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - September 12-14, 2016


Re: [rt-users] ModifyCustomField without SeeCustomField

2016-08-14 Thread Matt Zagrabelny
On Sun, Aug 14, 2016 at 1:07 AM, Woody - Wild Thing Safaris
 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
-
RT 4.4 and RTIR Training Sessions https://bestpractical.com/training
* Los Angeles - September, 2016