[Rt-commit] r10110 - in rt/branches/3.999-DANGEROUS: . html/Admin/Elements html/Elements html/Search/Elements html/Widgets lib/RT lib/RT/Interface lib/RT/Model lib/RT/Shredder t t/api t/delegation t/mail t/web

jesse at bestpractical.com jesse at bestpractical.com
Tue Dec 25 00:30:11 EST 2007


Author: jesse
Date: Tue Dec 25 00:30:09 2007
New Revision: 10110

Modified:
   rt/branches/3.999-DANGEROUS/   (props changed)
   rt/branches/3.999-DANGEROUS/html/Admin/Elements/SelectRights
   rt/branches/3.999-DANGEROUS/html/Elements/ShowSearch
   rt/branches/3.999-DANGEROUS/html/Search/Elements/EditSearches
   rt/branches/3.999-DANGEROUS/html/Widgets/SavedSearch
   rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/AttributeCollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
   rt/branches/3.999-DANGEROUS/lib/RT/SavedSearch.pm
   rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Shredder/Record.pm
   rt/branches/3.999-DANGEROUS/lib/RT/System.pm
   rt/branches/3.999-DANGEROUS/t/api/rights.t
   rt/branches/3.999-DANGEROUS/t/api/users.t
   rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t
   rt/branches/3.999-DANGEROUS/t/mail/gateway.t
   rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t
   rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t
   rt/branches/3.999-DANGEROUS/t/savedsearch.t
   rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t
   rt/branches/3.999-DANGEROUS/t/ticket/linking.t
   rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t
   rt/branches/3.999-DANGEROUS/t/web/gnupg-outgoing.t
   rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t
   rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t

Log:
 r74104 at pinglin:  jesse | 2007-12-25 00:02:57 -0500
 * lots of small cleanups


Modified: rt/branches/3.999-DANGEROUS/html/Admin/Elements/SelectRights
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Admin/Elements/SelectRights	(original)
+++ rt/branches/3.999-DANGEROUS/html/Admin/Elements/SelectRights	Tue Dec 25 00:30:09 2007
@@ -96,7 +96,7 @@
     my $ACE = RT::Model::ACE->new();
 
 
-    $ACLObj->LimitToObject( $Object);
+    $ACLObj->limit_to_object( $Object);
     $ACLObj->LimitToPrincipal( Id => $principal_id);
     $ACLObj->order_by(column=>'right_name'); 
 

Modified: rt/branches/3.999-DANGEROUS/html/Elements/ShowSearch
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Elements/ShowSearch	(original)
+++ rt/branches/3.999-DANGEROUS/html/Elements/ShowSearch	Tue Dec 25 00:30:09 2007
@@ -62,7 +62,7 @@
 
 if ($SavedSearch) {
     my ( $container_object, $search_id ) = _parse_saved_search($SavedSearch);
-    $search = $container_object->attributes->WithId($search_id);
+    $search = $container_object->attributes->with_id($search_id);
     unless ( $search->id && ref( $SearchArg = $search->Content ) eq 'HASH' ) {
         $m->out("Saved Search $SavedSearch not found");
         return;

Modified: rt/branches/3.999-DANGEROUS/html/Search/Elements/EditSearches
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Search/Elements/EditSearches	(original)
+++ rt/branches/3.999-DANGEROUS/html/Search/Elements/EditSearches	Tue Dec 25 00:30:09 2007
@@ -131,7 +131,7 @@
 
 if ( $ARGS{'SavedSearchLoad'} ) {
     my ($container, $id ) = _parse_saved_search ($ARGS{'SavedSearchLoad'});
-    my $search = $container->attributes->WithId( $id );
+    my $search = $container->attributes->with_id( $id );
 
     $SavedSearch->{'Id'}          = $ARGS{'SavedSearchLoad'};
     $SavedSearch->{'Object'}      = $search;
@@ -158,7 +158,7 @@
      && !$SavedSearch->{'Object'} )
 {
     my ($container, $id ) = _parse_saved_search( $ARGS{'SavedSearchId'} );
-    $SavedSearch->{'Object'} = $container->attributes->WithId( $id );
+    $SavedSearch->{'Object'} = $container->attributes->with_id( $id );
     $SavedSearch->{'Description'} ||= $SavedSearch->{'Object'}->Description;
 }
 
@@ -201,7 +201,7 @@
 
     if ( $status ) {
         $SavedSearch->{'Object'} =
-            Jifty->web->current_user->user_object->attributes->WithId( $saved_search->id );
+            Jifty->web->current_user->user_object->attributes->with_id( $saved_search->id );
         # Build new SearchId
         $SavedSearch->{'Id'} =
                 ref( Jifty->web->current_user->user_object ) . '-'

Modified: rt/branches/3.999-DANGEROUS/html/Widgets/SavedSearch
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Widgets/SavedSearch	(original)
+++ rt/branches/3.999-DANGEROUS/html/Widgets/SavedSearch	Tue Dec 25 00:30:09 2007
@@ -63,7 +63,7 @@
 my $SearchParams = { map { $_ => $args->{$_} } @{$self->{SearchFields}} };
 
 if ( my ( $container_object, $search_id ) = _parse_saved_search( $args->{'LoadSavedSearch'} ) ) {
-    my $search = $container_object->attributes->WithId($search_id);
+    my $search = $container_object->attributes->with_id($search_id);
     # We have a $search and now; import the others
     $self->{SearchId} = $args->{'LoadSavedSearch'};
     $self->{CurrentSearch}{Object} = $search;

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm	Tue Dec 25 00:30:09 2007
@@ -32,8 +32,7 @@
 
 # XXX TODO XXX SECURITY RISK - this regex is WRONG AND UNSAFE
 before qr'/(?!login)$' => run {
-    my $path = $1;
-    warn "my path is $path";
+    my $path = $1 ||'';
     tangent '/login' unless (Jifty->web->current_user->id || $path =~ /NoAuth/);
 };
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm	Tue Dec 25 00:30:09 2007
@@ -1333,7 +1333,7 @@
 
         #   If the action is comment, add a comment.
         if ( $action =~ /^(?:comment|correspond)$/i ) {
-            my $method = ucfirst lc $action;
+            my $method = lc $action;
             my ( $status, $msg ) = $Ticket->$method( MIMEObj => $Message );
             unless ($status) {
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm	Tue Dec 25 00:30:09 2007
@@ -87,7 +87,7 @@
 
 
 use vars qw (
-  %LOWERCASERIGHTnameS
+  %LOWERCASERIGHTNAMES
   %OBJECT_TYPES
   %TICKET_METAPRINCIPALS
 );
@@ -556,7 +556,8 @@
 
 sub canonicalize_right_name {
     my $self  = shift;
-    return $LOWERCASERIGHTnameS{ lc shift };
+    my $right = shift;
+    return $LOWERCASERIGHTNAMES{ lc $right } || $right;
 }
 
 # }}}

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm	Tue Dec 25 00:30:09 2007
@@ -76,15 +76,15 @@
 =cut
 
 
-# {{{ LimitToObject 
+# {{{ limit_to_object 
 
-=head2 LimitToObject $object
+=head2 limit_to_object $object
 
 Limit the ACL to rights for the object $object. It needs to be an RT::Record class.
 
 =cut
 
-sub LimitToObject {
+sub limit_to_object {
     my $self = shift;
     my $obj  = shift;
     unless ( defined($obj)

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/AttributeCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/AttributeCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/AttributeCollection.pm	Tue Dec 25 00:30:09 2007
@@ -124,7 +124,7 @@
     return (@attributes);   
 }
 
-=head2 WithId ID
+=head2 with_id ID
 
 Returns the RT::Model::Attribute objects with the id ID
 
@@ -132,7 +132,7 @@
 
 =cut
 
-sub WithId {
+sub with_id {
     my $self = shift;
     my $id = shift;
 
@@ -178,15 +178,15 @@
 }
 
 
-# {{{ LimitToObject 
+# {{{ limit_to_object 
 
-=head2 LimitToObject $object
+=head2 limit_to_object $object
 
 Limit the Attributes to rights for the object $object. It needs to be an RT::Record class.
 
 =cut
 
-sub LimitToObject {
+sub limit_to_object {
     my $self = shift;
     my $obj = shift;
     unless (defined($obj) && ref($obj) && UNIVERSAL::can($obj, 'id') && $obj->id) {

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm	Tue Dec 25 00:30:09 2007
@@ -139,7 +139,7 @@
 $RT::Model::ACE::OBJECT_TYPES{'RT::Model::CustomField'} = 1;
 
 foreach my $right ( keys %{$RIGHTS} ) {
-    $RT::Model::ACE::LOWERCASERIGHTnameS{ lc $right } = $right;
+    $RT::Model::ACE::LOWERCASERIGHTNAMES{ lc $right } = $right;
 }
 
 sub AvailableRights {
@@ -1100,7 +1100,7 @@
     
     $values->limit_to_custom_field($self->id);
     $values->LimitToEnabled();
-    $values->LimitToObject($object);
+    $values->limit_to_object($object);
 
     return ($values);
 }

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm	Tue Dec 25 00:30:09 2007
@@ -67,7 +67,7 @@
 # stuff the rights into a hash of rights that can exist.
 
 foreach my $right ( keys %{$RIGHTS} ) {
-    $RT::Model::ACE::LOWERCASERIGHTnameS{ lc $right } = $right;
+    $RT::Model::ACE::LOWERCASERIGHTNAMES{ lc $right } = $right;
 }
 
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValueCollection.pm	Tue Dec 25 00:30:09 2007
@@ -72,15 +72,15 @@
 
 # }}}
 
-# {{{ sub LimitToObject
+# {{{ sub limit_to_object
 
-=head2 LimitToObject OBJECT
+=head2 limit_to_object OBJECT
 
 Limits the returned set to values for the given OBJECT
 
 =cut
 
-sub LimitToObject {
+sub limit_to_object {
     my $self = shift;
     my $object = shift;
     $self->limit(

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Queue.pm	Tue Dec 25 00:30:09 2007
@@ -147,7 +147,7 @@
 # stuff the rights into a hash of rights that can exist.
 
 foreach my $right ( keys %{$RIGHTS} ) {
-    $RT::Model::ACE::LOWERCASERIGHTnameS{ lc $right } = $right;
+    $RT::Model::ACE::LOWERCASERIGHTNAMES{ lc $right } = $right;
 }
     
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm	Tue Dec 25 00:30:09 2007
@@ -36,7 +36,6 @@
 use Jifty::DBI::Record schema {
     column comments  => type is 'blob', default is '';
     column Signature => type is 'blob', default is '';
-    #column email => max_length is 120, type is 'varchar(120)', default is '';
     column freeform_contact_info => type is 'blob', default is '';
     column
         organization =>,
@@ -95,6 +94,9 @@
 use Jifty::Plugin::User::Mixin::Model::User; # name, email, email_confirmed
 use Jifty::Plugin::Authentication::Password::Mixin::Model::User;
 
+# XXX TODO, merging params should 'just work' but does not 
+ __PACKAGE__->column('email')->writable(1);
+
 
 
 # {{{ sub create 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Record.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Record.pm	Tue Dec 25 00:30:09 2007
@@ -148,7 +148,7 @@
     
     unless ($self->{'attributes'}) {
         $self->{'attributes'} = RT::Model::AttributeCollection->new;     
-       $self->{'attributes'}->LimitToObject($self); 
+       $self->{'attributes'}->limit_to_object($self); 
     }
     return ($self->{'attributes'}); 
 
@@ -1641,7 +1641,7 @@
     }
     # we're not limiting to a specific custom field;
     my $ocfs = RT::Model::ObjectCustomFieldValueCollection->new;
-    $ocfs->LimitToObject( $self );
+    $ocfs->limit_to_object( $self );
     return $ocfs;
 }
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/SavedSearch.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/SavedSearch.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/SavedSearch.pm	Tue Dec 25 00:30:09 2007
@@ -98,9 +98,9 @@
     my $object = $self->_GetObject($privacy);
 
     if ($object) {
-	$self->{'Attribute'} = $object->attributes->WithId($id);
+	$self->{'Attribute'} = $object->attributes->with_id($id);
 	if ($self->{'Attribute'}->id) {
-	    $self->{'Id'} = $self->{'Attribute'}->id;
+	    $self->{'id'} = $self->{'Attribute'}->id;
 	    $self->{'Privacy'} = $privacy;
 	    $self->{'Type'} = $self->{'Attribute'}->SubValue('SearchType');
 	    return (1, _("Loaded search %1", $self->name));
@@ -161,8 +161,8 @@
         'Content'     => \%params
     );
     if ($att_id) {
-        $self->{'Attribute'} = $object->attributes->WithId($att_id);
-        $self->{'Id'}        = $att_id;
+        $self->{'Attribute'} = $object->attributes->with_id($att_id);
+        $self->{'id'}        = $att_id;
         $self->{'Privacy'}   = $privacy;
         $self->{'Type'}      = $type;
         return ( 1, _( "Saved search %1", $name ) );
@@ -244,7 +244,7 @@
     return $self->{'Attribute'}->SubValue($param);
 }
 
-=head2 Id
+=head2 id
 
 Returns the numerical id of this search.
 
@@ -252,7 +252,7 @@
 
 sub id {
      my $self = shift;
-     return $self->{'Id'};
+     return $self->{'id'};
 }
 
 =head2 Privacy
@@ -306,7 +306,6 @@
     my $self    = shift;
     my $privacy = shift;
 
-    warn "Checking on privacy for $privacy";
 
     my ( $obj_type, $obj_id ) = split( /\-/, $privacy );
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm	Tue Dec 25 00:30:09 2007
@@ -82,7 +82,7 @@
     return $self;
 }
 
-=head2 LimitToPrivacy
+=head2 limit_to_privacy
 
 Takes two argumets: a privacy string, of the format "<class>-<id>", as
 produced by RT::SavedSearch::Privacy(); and a type string, as produced
@@ -93,7 +93,7 @@
 
 =cut
 
-sub LimitToPrivacy {
+sub limit_to_privacy {
     my $self = shift;
     my $privacy = shift;
     my $type = shift;
@@ -122,7 +122,7 @@
 
 =cut
 
-sub Next {
+sub next {
     my $self = shift;
     my $search = $self->{'objects'}->[$self->{'idx'}];
     if ($search) {

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Shredder/Record.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Shredder/Record.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Shredder/Record.pm	Tue Dec 25 00:30:09 2007
@@ -157,7 +157,7 @@
 
 # ACE records
     $objs = RT::Model::ACECollection->new;
-    $objs->LimitToObject( $self );
+    $objs->limit_to_object( $self );
     push( @$list, $objs );
 
     $deps->_PushDependencies(

Modified: rt/branches/3.999-DANGEROUS/lib/RT/System.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/System.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/System.pm	Tue Dec 25 00:30:09 2007
@@ -50,7 +50,7 @@
 $RT::Model::ACE::OBJECT_TYPES{'RT::System'} = 1;
 
 foreach my $right ( keys %{$RIGHTS} ) {
-    $RT::Model::ACE::LOWERCASERIGHTnameS{ lc $right } = $right;
+    $RT::Model::ACE::LOWERCASERIGHTNAMES{ lc $right } = $right;
 }
 
 

Modified: rt/branches/3.999-DANGEROUS/t/api/rights.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/rights.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/api/rights.t	Tue Dec 25 00:30:09 2007
@@ -65,7 +65,7 @@
 # clear all global right
 my $acl = RT::Model::ACECollection->new(current_user => RT->system_user);
 $acl->limit( column => 'right_name', operator => '!=', value => 'SuperUser' );
-$acl->LimitToObject( RT->system );
+$acl->limit_to_object( RT->system );
 while( my $ace = $acl->next ) {
 	$ace->delete;
 }

Modified: rt/branches/3.999-DANGEROUS/t/api/users.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/users.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/api/users.t	Tue Dec 25 00:30:09 2007
@@ -32,8 +32,8 @@
 
 my $RTxObj = {};
 bless $RTxObj, 'RTx::System::Record';
-*RTx::System::Record::Id = sub { 4; };
-*RTx::System::Record::id = *RTx::System::Record::Id;
+*RTx::System::Record::id = sub { 4; };
+*RTx::System::Record::id = *RTx::System::Record::id;
 
 $users = RT::Model::UserCollection->new(current_user => RT->system_user);
 $users->WhoHaveRight(Right => 'RTxUserRight', Object => $RTxSysObj);

Modified: rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t	Tue Dec 25 00:30:09 2007
@@ -174,7 +174,7 @@
             Right  => 'DelegateRights',
             Object => RT->system )),
     "Test personal group 1 lacks global DelegateRights after joining g1" );
-$ace = RT::Model::ACE->new($u1);
+$ace = RT::Model::ACE->new(current_user => RT::CurrentUser->new(id => $u1->id));
 ( $ret, $msg ) = $ace->load_by_values(
     right_name     => 'AdminGroup',
     Object        => $pg1,
@@ -238,7 +238,8 @@
 ok( $ret, "Add test user 1 to g1: $msg" );
 ( $ret, $msg ) = $g2->add_member( $u1->principal_id );
 ok( $ret, "Add test user 1 to g2: $msg" );
-$ace = RT::Model::ACE->new($u1);
+$ace = RT::Model::ACE->new(current_user => RT::CurrentUser->new( id => $u1->id));
+
 ( $ret, $msg ) = $ace->load_by_values(
     right_name     => 'AdminGroup',
     Object        => $pg1,
@@ -311,7 +312,8 @@
 ( $ret, $msg ) = $g2->add_member( $u1->principal_id );
 ok( $ret, "Add test user 1 to g2: $msg" );
 
-$ace = RT::Model::ACE->new($u1);
+$ace = RT::Model::ACE->new(current_user => RT::CurrentUser->new( id => $u1->id));
+
 ( $ret, $msg ) = $ace->load_by_values(
     right_name     => 'ShowConfigTab',
     Object        => RT->system,
@@ -357,7 +359,8 @@
 ok( $ret, "Grant ShowConfigTab to g2: $msg" );
 ( $ret, $msg ) = $g1->add_member( $u1->principal_id );
 ok( $ret, "Add test user 1 to g1: $msg" );
-$ace = RT::Model::ACE->new($u1);
+$ace = RT::Model::ACE->new(current_user => RT::CurrentUser->new( id => $u1->id));
+
 ( $ret, $msg ) = $ace->load_by_values(
     right_name     => 'DelegateRights',
     Object        => RT->system,
@@ -372,7 +375,8 @@
 ok( $ret, "Add test user 2 to pg1: $msg" );
 ( $ret, $msg ) = $g2->add_member( $u2->principal_id );
 ok( $ret, "Add test user 2 to g2: $msg" );
-$ace = RT::Model::ACE->new($u2);
+$ace = RT::Model::ACE->new(current_user => RT::CurrentUser->new( id => $u2->id));
+
 ( $ret, $msg ) = $ace->load_by_values(
     right_name     => 'ShowConfigTab',
     Object        => RT->system,
@@ -399,7 +403,8 @@
 
 ( $ret, $msg ) = $g1->add_member( $u1->principal_id );
 ok( $ret, "Add u1 to g1: $msg" );
-$ace = RT::Model::ACE->new($u1);
+$ace = RT::Model::ACE->new(current_user => RT::CurrentUser->new( id => $u1->id));
+
 ( $ret, $msg ) = $ace->load_by_values(
     right_name     => 'DelegateRights',
     Object        => RT->system,

Modified: rt/branches/3.999-DANGEROUS/t/mail/gateway.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gateway.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gateway.t	Tue Dec 25 00:30:09 2007
@@ -507,7 +507,8 @@
     # Grab the binary attachment via the web ui
     my $ua = new LWP::UserAgent;
     my $full_url = "$url/Ticket/Attachment/". $attachment->TransactionId
-        ."/". $attachment->id. "/bplogo.gif?&user=root&pass=password";
+        ."/". $attachment->id. "/bplogo.gif";
+        $ua->login();
     my $r = $ua->get( $full_url );
 
     # Verify that the downloaded attachment is the same as what we uploaded.
@@ -742,7 +743,7 @@
 $ace->delete;
 my $acl = RT::Model::ACECollection->new(current_user => RT->system_user);
 $acl->limit( column => 'right_name', value => 'ReplyToTicket' );
-$acl->LimitToObject( RT->system );
+$acl->limit_to_object( RT->system );
 while( my $ace = $acl->next ) {
 	$ace->delete;
 }

Modified: rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t	Tue Dec 25 00:30:09 2007
@@ -21,7 +21,7 @@
 
 my ($baseurl, $m) = RT::Test->started_ok;
 
-$m->get( $baseurl."?user=root;pass=password" );
+$m->login;
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );

Modified: rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t	Tue Dec 25 00:30:09 2007
@@ -10,7 +10,7 @@
 my $homedir = File::Spec->catdir( getcwd(), qw(lib t data crypt-gnupg) );
 
 # catch any outgoing emails
-unlink "t/mailbox";
+RT::Test->fetch_caught_mails;
 
 sub capture_mail {
     my $MIME = shift;
@@ -39,7 +39,7 @@
 my ($baseurl, $m) = RT::Test->started_ok;
 
 # configure key for General queue
-$m->get( $baseurl."?user=root;pass=password" );
+$m->login();
 $m->content_like(qr/Logout/, 'we did log in');
 $m->get( $baseurl.'/Admin/Queues/');
 $m->follow_link_ok( {text => 'General'} );

Modified: rt/branches/3.999-DANGEROUS/t/savedsearch.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/savedsearch.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/savedsearch.t	Tue Dec 25 00:30:09 2007
@@ -166,16 +166,24 @@
 		     SearchParams => {'Query' => "Queue = 'General'"});
 
 my $ticketsearches = RT::SavedSearches->new(current_user => $curruser);
-$ticketsearches->LimitToPrivacy('RT::Model::User-'.$curruser->id, 'Ticket');
+$ticketsearches->limit_to_privacy('RT::Model::User-'.$curruser->id, 'Ticket');
 is($ticketsearches->count, 1, "Found searchuser's ticket searches");
 
 my $allsearches = RT::SavedSearches->new(current_user => $curruser);
-$allsearches->LimitToPrivacy('RT::Model::User-'.$curruser->id);
+$allsearches->limit_to_privacy('RT::Model::User-'.$curruser->id);
 is($allsearches->count, 2, "Found all searchuser's searches");
 
 # Delete a search.
 ($ret, $msg) = $genericsearch->delete;
-ok($ret, "Deleted genericsearch");
-$allsearches->LimitToPrivacy('RT::Model::User-'.$curruser->id);
+ok($ret, "Deleted genericsearch ".$msg);
+
+
+
+$allsearches = RT::SavedSearches->new(current_user => $curruser);
+$allsearches->limit_to_privacy('RT::Model::User-'.$curruser->id);
 is($allsearches->count, 1, "Found all searchuser's searches after deletion");
 
+while (my $search = $allsearches->next) {
+    diag($search->id, $search->name);
+}
+

Modified: rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t	Tue Dec 25 00:30:09 2007
@@ -27,7 +27,7 @@
 create-2,$QUEUE,hello,new,root,3.0
 EOF
 
-my $action = RT::ScripAction::CreateTickets->new(CurrentUser => RT::CurrentUser->new('root'));
+my $action = RT::ScripAction::CreateTickets->new(current_user => RT::CurrentUser->new(name => 'root'));
 ok ($action->current_user->id , "WE have a current user");
  
 $action->Parse(Content => $data);

Modified: rt/branches/3.999-DANGEROUS/t/ticket/linking.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/linking.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/linking.t	Tue Dec 25 00:30:09 2007
@@ -95,7 +95,7 @@
 ($id,$msg) = $u1->principal_object->GrantRight ( Object => $q1, Right => 'CreateTicket');
 ok ($id,$msg);
 
-my $creator = RT::CurrentUser->new($u1->id);
+my $creator = RT::CurrentUser->new(id => $u1->id);
 
 diag('Create tickets without rights to link') if $ENV{'TEST_VERBOSE'};
 {
@@ -103,7 +103,7 @@
     my $parent = RT::Model::Ticket->new(current_user => RT->system_user );
     my ($id,$tid,$msg) = $parent->create( Subject => 'Link test 1', Queue => $q2->id );
     ok($id,$msg);
-    my $child = RT::Model::Ticket->new( $creator );
+    my $child = RT::Model::Ticket->new( current_user =>  $creator );
     ($id,$tid,$msg) = $child->create( Subject => 'Link test 1', Queue => $q1->id, MemberOf => $parent->id );
     ok($id,$msg);
     $child->current_user( RT->system_user );
@@ -118,7 +118,7 @@
     my $parent = RT::Model::Ticket->new(current_user => RT->system_user );
     my ($id,$tid,$msg) = $parent->create( Subject => 'Link test 1', Queue => $q2->id );
     ok($id,$msg);
-    my $child = RT::Model::Ticket->new( $creator );
+    my $child = RT::Model::Ticket->new( current_user => $creator );
     ($id,$tid,$msg) = $child->create( Subject => 'Link test 1', Queue => $q1->id, MemberOf => $parent->id );
     ok($id,$msg);
     $child->current_user( RT->system_user );
@@ -138,7 +138,7 @@
     my $parent = RT::Model::Ticket->new(current_user => RT->system_user );
     my ($id,$tid,$msg) = $parent->create( Subject => 'Link test 1', Queue => $q2->id );
     ok($id,$msg);
-    my $child = RT::Model::Ticket->new( $creator );
+    my $child = RT::Model::Ticket->new( current_user => $creator);
     ($id,$tid,$msg) = $child->create( Subject => 'Link test 1', Queue => $q1->id );
     ok($id,$msg);
     ($id, $msg) = $child->AddLink(Type => 'MemberOf', Target => $parent->id);
@@ -156,7 +156,7 @@
     my $parent = RT::Model::Ticket->new(current_user => RT->system_user );
     my ($id,$tid,$msg) = $parent->create( Subject => 'Link test 1', Queue => $q2->id );
     ok($id,$msg);
-    my $child = RT::Model::Ticket->new( $creator );
+    my $child = RT::Model::Ticket->new( current_user => $creator );
     ($id,$tid,$msg) = $child->create( Subject => 'Link test 1', Queue => $q1->id );
     ok($id,$msg);
     ($id, $msg) = $child->AddLink(Type => 'MemberOf', Target => $parent->id);
@@ -189,7 +189,7 @@
 }
 
 my $tid;
-my $ticket = RT::Model::Ticket->new( $creator);
+my $ticket = RT::Model::Ticket->new( current_user => $creator);
 ok($ticket->isa('RT::Model::Ticket'));
 ($id,$tid, $msg) = $ticket->create(Subject => 'Link test 1', Queue => $q1->id);
 ok ($id,$msg);

Modified: rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t	Tue Dec 25 00:30:09 2007
@@ -26,7 +26,6 @@
 use Cwd;
 use File::Temp qw(tempdir);
 my $homedir = tempdir( CLEANUP => 1 );
-
 use_ok('RT::Crypt::GnuPG');
 
 RT->Config->set( 'GnuPG',
@@ -70,7 +69,7 @@
 $m->field(Encrypt => 1);
 $m->submit;
 
-unlink "t/mailbox";
+RT::Test->fetch_caught_mails;
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');
@@ -86,7 +85,6 @@
 
 my @mail = RT::Test->fetch_caught_mails;
 ok(@mail, "got some mail");
-
 $user->set_email('general at example.com');
 for my $mail (@mail) {
     unlike $mail, qr/Some content/, "outgoing mail was encrypted";
@@ -140,7 +138,7 @@
 $m->field(Sign => 1);
 $m->submit;
 
-unlink "t/mailbox";
+RT::Test->fetch_caught_mails;
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');
@@ -212,7 +210,7 @@
 $m->field(Sign => 1);
 $m->submit;
 
-unlink "t/mailbox";
+RT::Test->fetch_caught_mails;
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');
@@ -277,7 +275,7 @@
     like($attachments[0]->Content, qr/$RT::rtname/, "RT's mail includes this instance's name");
 }
 
-unlink "t/mailbox";
+RT::Test->fetch_caught_mails;
 
 $m->goto_create_ticket( $queue );
 $m->form_name('TicketCreate');
@@ -406,7 +404,7 @@
 $m->select("PreferredKey" => $key2);
 $m->submit;
 
-ok($user = RT::Model::User->new($RT::system_user));
+ok($user = RT::Model::User->new(current_user => RT->system_user));
 ok($user->load('root'), "Loaded user 'root'");
 is($user->PreferredKey, $key2, "preferred key is set correctly to the new value");
 

Modified: rt/branches/3.999-DANGEROUS/t/web/gnupg-outgoing.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/gnupg-outgoing.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/web/gnupg-outgoing.t	Tue Dec 25 00:30:09 2007
@@ -248,7 +248,7 @@
     my %args = (@_);
 
     # cleanup mail catcher's storage
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     $m->goto_create_ticket( $queue );
     $m->form_name('TicketCreate');
@@ -280,7 +280,7 @@
     my %args = (@_);
 
     # cleanup mail catcher's storage
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );

Modified: rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t	Tue Dec 25 00:30:09 2007
@@ -45,7 +45,7 @@
 
 diag "check that signing doesn't work if there is no key";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -71,7 +71,7 @@
 
 diag "check that things don't work if there is no key";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -106,7 +106,7 @@
 
 diag "check that things still doesn't work if key is not trusted";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -153,7 +153,7 @@
 
 diag "check that things still doesn't work if two keys are not trusted";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -198,7 +198,7 @@
 
 diag "check that we see key selector even if only one key is trusted but there are more keys";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -225,7 +225,7 @@
 
 diag "check that key selector works and we can select trusted key";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);
@@ -257,7 +257,7 @@
 
 diag "check encrypting of attachments";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_create_ticket( $queue ), "UI -> create ticket";
     $m->form_number(3);

Modified: rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t	(original)
+++ rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t	Tue Dec 25 00:30:09 2007
@@ -56,7 +56,7 @@
 
 diag "check that signing doesn't work if there is no key";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -83,7 +83,7 @@
 
 diag "check that things don't work if there is no key";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -120,7 +120,7 @@
 
 diag "check that things still doesn't work if key is not trusted";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -168,7 +168,7 @@
 
 diag "check that things still doesn't work if two keys are not trusted";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -214,7 +214,7 @@
 
 diag "check that we see key selector even if only one key is trusted but there are more keys";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -242,7 +242,7 @@
 
 diag "check that key selector works and we can select trusted key";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );
@@ -275,7 +275,7 @@
 
 diag "check encrypting of attachments";
 {
-    unlink "t/mailbox";
+    RT::Test->fetch_caught_mails;
 
     ok $m->goto_ticket( $tid ), "UI -> ticket #$tid";
     $m->follow_link_ok( { text => 'Reply' }, 'ticket -> reply' );


More information about the Rt-commit mailing list