[Rt-commit] rt branch, 3.999-trunk, updated. 3ef58d570de32ed1385149b8802c6c17b5af1fda
sartak at bestpractical.com
sartak at bestpractical.com
Tue Dec 1 05:30:48 EST 2009
The branch, 3.999-trunk has been updated
via 3ef58d570de32ed1385149b8802c6c17b5af1fda (commit)
from 752e912e577ea30f8b433fb05d307f977d209e18 (commit)
Summary of changes:
lib/RT/Model/Ticket.pm | 43 +++++++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 20 deletions(-)
- Log -----------------------------------------------------------------
commit 3ef58d570de32ed1385149b8802c6c17b5af1fda
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Dec 1 05:30:16 2009 -0500
Move CreateTicket check into validate_queue
diff --git a/lib/RT/Model/Ticket.pm b/lib/RT/Model/Ticket.pm
index 03bcb60..0f2bd0e 100755
--- a/lib/RT/Model/Ticket.pm
+++ b/lib/RT/Model/Ticket.pm
@@ -430,16 +430,7 @@ sub create {
}
#Now that we have a queue, Check the ACLS
- die caller unless $self->current_user->id;
- unless (
- $self->current_user->has_right(
- right => 'CreateTicket',
- object => $queue_obj
- )
- )
- {
- return ( 0, 0, _( "No permission to create tickets in the queue '%1'", $queue_obj->name ) );
- }
+ die caller unless $self->current_user->id;
unless ( $queue_obj->status_schema->is_valid( $args{'status'} ) ) {
return ( 0, 0, _('Invalid value for status') );
@@ -985,17 +976,29 @@ sub validate_queue {
my $queue_obj = RT::Model::Queue->new( current_user => $self->current_user );
my $id = $queue_obj->load($value);
- if ( $meta->{for} eq 'create' && $queue_obj->disabled ) {
- Jifty->log->debug( "$self Disabled queue '"
- . $queue_obj->name
- . "' given for ticket creation." );
- return (
- 0,
- _(
- 'Could not create ticket in disabled queue "%1"',
- $queue_obj->name
+ if ($meta->{for} eq 'create') {
+ if ( $queue_obj->disabled ) {
+ Jifty->log->debug( "$self Disabled queue '"
+ . $queue_obj->name
+ . "' given for ticket creation." );
+ return (
+ 0,
+ _(
+ 'Could not create ticket in disabled queue "%1"',
+ $queue_obj->name
+ )
+ );
+ }
+
+ unless (
+ $self->current_user->has_right(
+ right => 'CreateTicket',
+ object => $queue_obj
)
- );
+ )
+ {
+ return ( 0, _( "No permission to create tickets in the queue '%1'", $queue_obj->name ) );
+ }
}
if ($id) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list