~bestpractical/rt/master

« back to all changes in this revision

Viewing changes to lib/RT/REST2/Resource/Ticket.pm

  • Committer: sunnavy
  • Date: 2023-10-19 19:45:11 UTC
  • mfrom: (8471.1.577)
  • Revision ID: git-v1:9fca83d11d15fb8034308194b9c9052d5df7d454
Merge branch '5.0-trunk'

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
    if ( $args{'Action'} eq 'create' ) {
226
226
        return (0, "Could not create ticket. Queue not set", 400) if !$data->{Queue};
227
227
 
228
 
        my $queue = RT::Queue->new(RT->SystemUser);
 
228
        my $queue = RT::Queue->new($self->current_user);
229
229
        $queue->Load($data->{Queue});
230
230
 
231
 
        return (0, "Unable to find queue", 400) if !$queue->Id;
232
 
 
233
 
        return (0, $self->record->loc("No permission to create tickets in the queue '[_1]'", $queue->Name), 403)
234
 
            unless $self->record->CurrentUser->HasRight(
235
 
                Right  => 'CreateTicket',
236
 
                Object => $queue,
237
 
            ) and $queue->Disabled != 1;
 
231
        return (0, $self->record->loc("No permission to create tickets in the queue '[_1]'", $data->{Queue}), 403)
 
232
            unless $queue->Id and $queue->__Value('Disabled') != 1 and $queue->CurrentUserHasRight('CreateTicket');
238
233
    }
239
234
 
240
235
    if ( $args{'Action'} eq 'update' ) {