[Rt-commit] r18961 - in rt/3.999/trunk/lib/RT: . Interface Shredder

ruz at bestpractical.com ruz at bestpractical.com
Fri Mar 27 15:38:26 EDT 2009


Author: ruz
Date: Fri Mar 27 15:38:25 2009
New Revision: 18961

Modified:
   rt/3.999/trunk/lib/RT/Dashboard.pm
   rt/3.999/trunk/lib/RT/Interface/Web.pm
   rt/3.999/trunk/lib/RT/Model/GroupCollection.pm
   rt/3.999/trunk/lib/RT/Model/GroupMember.pm
   rt/3.999/trunk/lib/RT/Model/Queue.pm
   rt/3.999/trunk/lib/RT/Model/TicketCollection.pm
   rt/3.999/trunk/lib/RT/Model/User.pm
   rt/3.999/trunk/lib/RT/Model/UserCollection.pm
   rt/3.999/trunk/lib/RT/SavedSearches.pm
   rt/3.999/trunk/lib/RT/Shredder/Principal.pm

Log:
* more on principal_id => principal

Modified: rt/3.999/trunk/lib/RT/Dashboard.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Dashboard.pm	(original)
+++ rt/3.999/trunk/lib/RT/Dashboard.pm	Fri Mar 27 15:38:25 2009
@@ -248,7 +248,7 @@
     my $groups = RT::Model::GroupCollection->new( current_user => $CurrentUser );
     $groups->limit_to_user_defined_groups;
     $groups->with_member(
-        principal_id => $CurrentUser->id,
+        principal => $CurrentUser->id,
         recursively => 1
     );
 

Modified: rt/3.999/trunk/lib/RT/Interface/Web.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Interface/Web.pm	(original)
+++ rt/3.999/trunk/lib/RT/Interface/Web.pm	Fri Mar 27 15:38:25 2009
@@ -1240,7 +1240,7 @@
         # Delete deletable watchers
         if ( $key =~ /^Ticket-DeleteWatcher-Type-(.*)-Principal-(\d+)$/ ) {
             my ( $code, $msg ) = $Ticket->delete_watcher(
-                principal_id => $2,
+                principal => $2,
                 type         => $1
             );
             push @results, $msg;

Modified: rt/3.999/trunk/lib/RT/Model/GroupCollection.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Model/GroupCollection.pm	(original)
+++ rt/3.999/trunk/lib/RT/Model/GroupCollection.pm	Fri Mar 27 15:38:25 2009
@@ -218,7 +218,7 @@
 }
 
 
-=head2 with_member {principal_id => PRINCIPAL_ID, recursively => undef}
+=head2 with_member {principal => PRINCIPAL_ID, recursively => undef}
 
 Limits the set of groups returned to groups which have
 Principal PRINCIPAL_ID as a member
@@ -228,7 +228,7 @@
 sub with_member {
     my $self = shift;
     my %args = (
-        principal_id => undef,
+        principal => undef,
         recursively  => undef,
         @_
     );
@@ -250,14 +250,14 @@
         alias    => $members,
         column   => 'member_id',
         operator => '=',
-        value    => $args{'principal_id'}
+        value    => $args{'principal'}
     );
 }
 
 sub without_member {
     my $self = shift;
     my %args = (
-        principal_id => undef,
+        principal => undef,
         recursively  => undef,
         @_
     );
@@ -274,7 +274,7 @@
         alias     => $members_alias,
         column    => 'member_id',
         operator  => '=',
-        value     => $args{'principal_id'},
+        value     => $args{'principal'},
     );
     $self->limit(
         alias       => $members_alias,
@@ -349,7 +349,7 @@
     }
     $self->limit(
         alias       => $args{'aclalias'},
-        column      => 'principal_id',
+        column      => 'principal',
         value       => "main.id",
         quote_value => 0,
     );

Modified: rt/3.999/trunk/lib/RT/Model/GroupMember.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Model/GroupMember.pm	(original)
+++ rt/3.999/trunk/lib/RT/Model/GroupMember.pm	Fri Mar 27 15:38:25 2009
@@ -90,7 +90,7 @@
 use Scalar::Util qw(blessed);
 
 
-=head2 create { Group => undef, Member => undef }
+=head2 create { group => undef, member => undef }
 
 Add a Principal to the group Group.
 if the Principal is a group, automatically inserts all
@@ -292,22 +292,22 @@
     # a member of A, will delete C as a member of A without touching
     # C as a member of B
 
-    my $cached_submembers = RT::Model::CachedGroupMemberCollection->new( current_user => $self->current_user );
-
+    my $cached_submembers = RT::Model::CachedGroupMemberCollection->new(
+        current_user => $self->current_user
+    );
     $cached_submembers->limit(
         column   => 'member_id',
         operator => '=',
         value    => $self->member->id
     );
-
     $cached_submembers->limit(
         column   => 'immediate_parent',
         operator => '=',
         value    => $self->group->id
     );
 
-    while ( my $item_to_del = $cached_submembers->next() ) {
-        my ( $del_err, $del_msg ) = $item_to_del->delete();
+    while ( my $item_to_del = $cached_submembers->next ) {
+        my ( $del_err, $del_msg ) = $item_to_del->delete;
         unless ($del_err) {
             Jifty->handle->rollback();
             Jifty->log->warn( "Couldn't delete cached group submember " . $item_to_del->id );

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	Fri Mar 27 15:38:25 2009
@@ -64,6 +64,8 @@
 use RT::Interface::Email;
 use RT::StatusSchema;
 
+use Scalar::Util qw(blessed);
+
 use base qw/RT::HasRoleGroups RT::Record/;
 
 sub table {'Queues'}
@@ -587,7 +589,7 @@
     my %args = (
         action       => 'add',
         type         => undef,
-        principal_id => undef,
+        principal => undef,
         email        => undef,
         @_
     );
@@ -596,9 +598,9 @@
     return 1 if $self->current_user_has_right('ModifyQueueWatchers');
 
     # if it's a new user in the system then user must have ModifyTicket
-    return 0 unless $args{'principal_id'};
+    return 0 unless $args{'principal'};
     # If the watcher isn't the current user then the current user has no right
-    return 0 unless $self->current_user->id == $args{'principal_id'};
+    return 0 unless $self->current_user->id == (blessed $args{'principal'}? $args{'principal'}->id : $args{'principal'});
 
     #  If it's an admin_cc and they don't have 'WatchAsadmin_cc', bail
     if ( $args{'type'} eq 'admin_cc' ) {

Modified: rt/3.999/trunk/lib/RT/Model/TicketCollection.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Model/TicketCollection.pm	(original)
+++ rt/3.999/trunk/lib/RT/Model/TicketCollection.pm	Fri Mar 27 15:38:25 2009
@@ -2102,7 +2102,7 @@
     $ACL->limit( column => 'type', operator => '!=', value => 'Group' );
     my $principal_alias = $ACL->join(
         alias1 => 'main',
-        column1 => 'principal_id',
+        column1 => 'principal',
         table2 => 'Principals',
         column2 => 'id',
     );
@@ -2141,14 +2141,14 @@
     $ACL->limit( column => 'right_name', value => 'ShowTicket' );
     my $principal_alias = $ACL->join(
         alias1 => 'main',
-        column1 => 'principal_id',
+        column1 => 'principal',
         table2 => 'Principals',
         column2 => 'id',
     );
     $ACL->limit( alias => $principal_alias, column => 'disabled', value => 0 );
     my $cgm_alias = $ACL->join(
         alias1 => 'main',
-        column1 => 'principal_id',
+        column1 => 'principal',
         table2 => 'CachedGroupMembers',
         column2 => 'group_id',
     );

Modified: rt/3.999/trunk/lib/RT/Model/User.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Model/User.pm	(original)
+++ rt/3.999/trunk/lib/RT/Model/User.pm	Fri Mar 27 15:38:25 2009
@@ -930,7 +930,7 @@
     my $groups = RT::Model::GroupCollection->new( current_user => $self->current_user );
     $groups->limit_to_user_defined_groups;
     $groups->with_member(
-        principal_id => $self->id,
+        principal => $self->id,
         recursively  => 1
     );
     return $groups;

Modified: rt/3.999/trunk/lib/RT/Model/UserCollection.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Model/UserCollection.pm	(original)
+++ rt/3.999/trunk/lib/RT/Model/UserCollection.pm	Fri Mar 27 15:38:25 2009
@@ -452,7 +452,7 @@
     my $group_members = $self->_join_group_members(%args);
     $self->limit(
         alias       => $args{'aclalias'},
-        column      => 'principal_id',
+        column      => 'principal',
         value       => "$group_members.group_id",
         quote_value => 0,
     );

Modified: rt/3.999/trunk/lib/RT/SavedSearches.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/SavedSearches.pm	(original)
+++ rt/3.999/trunk/lib/RT/SavedSearches.pm	Fri Mar 27 15:38:25 2009
@@ -175,7 +175,7 @@
     my $groups = RT::Model::GroupCollection->new( current_user => $self->current_user );
     $groups->limit_to_user_defined_groups;
     $groups->with_member(
-        principal_id => $self->current_user->id,
+        principal => $self->current_user->id,
         recursively  => 1
     );
 

Modified: rt/3.999/trunk/lib/RT/Shredder/Principal.pm
==============================================================================
--- rt/3.999/trunk/lib/RT/Shredder/Principal.pm	(original)
+++ rt/3.999/trunk/lib/RT/Shredder/Principal.pm	Fri Mar 27 15:38:25 2009
@@ -77,7 +77,7 @@
     # Access Control List
     my $objs = RT::Model::ACECollection->new( current_user => $self->current_user );
     $objs->limit(
-        column   => 'principal_id',
+        column   => 'principal',
         operator => '=',
         value    => $self->id
     );


More information about the Rt-commit mailing list