[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.4-203-ge31fa8917a
Jim Brandt
jbrandt at bestpractical.com
Fri Jan 15 17:10:56 EST 2021
The branch, 4.4-trunk has been updated
via e31fa8917a21eabad2c17ddc17d334ca602944bb (commit)
via 807fc60c2273a9bee39b6601bcfd845bb6c4448c (commit)
from 181ce8e91ed126aa4a7e4e5d14460ebf75c4cb79 (commit)
Summary of changes:
lib/RT/Record.pm | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 807fc60c2273a9bee39b6601bcfd845bb6c4448c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Feb 28 02:56:00 2019 +0800
Skip rights check when setting default object custom field values
Default values are fallbacks and we should fall back to them
unconditionally on object create, even if current user doesn't have
rights to see/modify them.
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 3503f67f30..d5a9d63d8b 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -2111,19 +2111,23 @@ Add default values to object's empty custom fields.
sub AddCustomFieldDefaultValues {
my $self = shift;
- my $cfs = $self->CustomFields;
+
+ my $object = ( ref $self )->new( RT->SystemUser );
+ $object->Load( $self->id );
+
+ my $cfs = $object->CustomFields;
my @msgs;
while ( my $cf = $cfs->Next ) {
- next if $self->CustomFieldValues($cf->id)->Count || !$cf->SupportDefaultValues;
+ next if $object->CustomFieldValues($cf->id)->Count || !$cf->SupportDefaultValues;
my ( $on ) = grep { $_->isa( $cf->RecordClassFromLookupType ) } $cf->ACLEquivalenceObjects;
my $values = $cf->DefaultValues( Object => $on || RT->System );
foreach my $value ( UNIVERSAL::isa( $values => 'ARRAY' ) ? @$values : $values ) {
- next if $self->CustomFieldValueIsEmpty(
+ next if $object->CustomFieldValueIsEmpty(
Field => $cf,
Value => $value,
);
- my ( $status, $msg ) = $self->_AddCustomFieldValue(
+ my ( $status, $msg ) = $object->_AddCustomFieldValue(
Field => $cf->id,
Value => $value,
RecordTransaction => 0,
commit e31fa8917a21eabad2c17ddc17d334ca602944bb
Merge: 181ce8e91e 807fc60c22
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Fri Jan 15 17:00:09 2021 -0500
Merge branch '4.4/skip-rights-check-on-setting-ocf-default-values' into 4.4-trunk
-----------------------------------------------------------------------
More information about the rt-commit
mailing list