[Rt-commit] r18675 - rt/3.999/trunk/lib/RT/Model
ruz at bestpractical.com
ruz at bestpractical.com
Wed Mar 4 20:31:21 EST 2009
Author: ruz
Date: Wed Mar 4 20:31:21 2009
New Revision: 18675
Modified:
rt/3.999/trunk/lib/RT/Model/Queue.pm
Log:
* use new role methods
Modified: rt/3.999/trunk/lib/RT/Model/Queue.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Model/Queue.pm (original)
+++ rt/3.999/trunk/lib/RT/Model/Queue.pm Wed Mar 4 20:31:21 2009
@@ -648,16 +648,12 @@
}
my $group = RT::Model::Group->new;
- $group->load_queue_role_group(
- type => $args{'type'},
- queue => $self->id
+ $group->create_role_group( # XXX: error checks
+ object => $self,
+ type => $args{'type'},
);
- unless ( $group->id ) {
- return ( 0, _("Group not found") );
- }
if ( $group->has_member($principal) ) {
-
return ( 0, _( 'That principal is already a %1 for this queue', $args{'type'} ) );
}
@@ -727,15 +723,6 @@
return ( 0, _("Could not find that principal") );
}
- my $group = RT::Model::Group->new;
- $group->load_queue_role_group(
- type => $args{'type'},
- queue => $self->id
- );
- unless ( $group->id ) {
- return ( 0, _("Group not found") );
- }
-
my $can_modify_queue = $self->current_user_has_right('ModifyQueueWatchers');
# {{{ Check ACLS
@@ -781,6 +768,14 @@
# see if this user is already a watcher.
+ my $group = RT::Model::Group->new;
+ $group->load_role_group(
+ object => $self,
+ type => $args{'type'},
+ );
+ unless ( $group->id ) {
+ return ( 0, _( 'That principal is not a %1 for this queue', $args{'type'} ) );
+ }
unless ( $group->has_member($principal) ) {
return ( 0, _( 'That principal is not a %1 for this queue', $args{'type'} ) );
}
@@ -812,10 +807,9 @@
my $role = shift;
my $group = RT::Model::Group->new;
if ( $self->current_user_has_right('SeeQueue') ) {
- $group->load_queue_role_group( type => $role, queue => $self->id );
+ $group->load_role_group( type => $role, object => $self );
}
return ($group);
-
}
@@ -845,10 +839,11 @@
# Load the relevant group.
my $group = RT::Model::Group->new;
- $group->load_queue_role_group(
- type => $args{'type'},
- queue => $self->id
+ $group->load_role_group(
+ object => $self,
+ type => $args{'type'},
);
+ return 0 unless $group->id;
# Ask if it has the member in question
More information about the Rt-commit
mailing list