Skip to content

Commit

Permalink
Fixed evaluation of ticket ID parameter in generic interface operatio…
Browse files Browse the repository at this point in the history
…n TicketGet.
  • Loading branch information
jepf authored and dennykorsukewitz committed Aug 23, 2024
1 parent 1c5641c commit 92b917d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 7.1.3 2024-??-??
- 2024-08-23 Fixed evaluation of ticket ID parameter in generic interface operation TicketGet.
- 2024-08-22 Console command Admin::PostMasterFilter::Import now will also update existing filters instead of only create new ones. Thanks to @meisterheister for reporting the issue. [#527](https://github.com/znuny/Znuny/issues/527)
- 2024-08-22 Added '--single-transaction' option to scripts/backup.pl for MySQL/MariaDB. The --single-transaction flag will start a transaction before running.
- 2024-08-21 Improved CSS for skin 'Dark'. [#584](https://github.com/znuny/Znuny/issues/584)
Expand Down
11 changes: 10 additions & 1 deletion Kernel/GenericInterface/Operation/Ticket/TicketGet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ sub Run {
# all needed variables
my @TicketIDs;
if ( IsStringWithData( $Param{Data}->{TicketID} ) ) {
@TicketIDs = split( /,/, $Param{Data}->{TicketID} );
@TicketIDs = split( /\s*,\s*/, $Param{Data}->{TicketID} );
}
elsif ( IsArrayRefWithData( $Param{Data}->{TicketID} ) ) {
@TicketIDs = @{ $Param{Data}->{TicketID} };
Expand All @@ -286,6 +286,15 @@ sub Run {
);
}

# Check for IDs being integers.
my $NumberOfIntegers = grep { $_ =~ m{\A[1-9]\d*\z} } @TicketIDs;
if ( $NumberOfIntegers != @TicketIDs ) {
return $Self->ReturnError(
ErrorCode => 'TicketGet.WrongStructure',
ErrorMessage => "TicketGet: Invalid ticket ID parameter(s) found!",
);
}

# Get the list of article dynamic fields
my $ArticleDynamicFieldList = $Kernel::OM->Get('Kernel::System::DynamicField')->DynamicFieldList(
ObjectType => 'Article',
Expand Down
8 changes: 4 additions & 4 deletions scripts/test/GenericInterface/Operation/Ticket/TicketGet.t
Original file line number Diff line number Diff line change
Expand Up @@ -1169,19 +1169,19 @@ my @Tests = (
ExpectedReturnLocalData => {
Data => {
Error => {
ErrorCode => 'TicketGet.AccessDenied',
ErrorCode => 'TicketGet.WrongStructure',
ErrorMessage =>
'TicketGet: User does not have access to the ticket!'
'TicketGet: Invalid ticket ID parameter(s) found!'
}
},
Success => 1
},
ExpectedReturnRemoteData => {
Data => {
Error => {
ErrorCode => 'TicketGet.AccessDenied',
ErrorCode => 'TicketGet.WrongStructure',
ErrorMessage =>
'TicketGet: User does not have access to the ticket!'
'TicketGet: Invalid ticket ID parameter(s) found!'
}
},
Success => 1
Expand Down

0 comments on commit 92b917d

Please sign in to comment.