[Rt-commit] r10056 - in rt/branches/3.999-DANGEROUS: . lib lib/RT
lib/RT/Interface/Email/Auth lib/RT/Model lib/RT/Shredder
t/api t/shredder
jesse at bestpractical.com
jesse at bestpractical.com
Mon Dec 24 00:30:02 EST 2007
Author: jesse
Date: Mon Dec 24 00:30:01 2007
New Revision: 10056
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/lib/RT.pm
rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/MailFrom.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm
rt/branches/3.999-DANGEROUS/lib/RT/Shredder/GroupMember.pm
rt/branches/3.999-DANGEROUS/t/api/currentuser.t
rt/branches/3.999-DANGEROUS/t/api/groups.t
rt/branches/3.999-DANGEROUS/t/api/i18n.t
rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t
rt/branches/3.999-DANGEROUS/t/shredder/utils.pl
rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t
Log:
r74090 at pinglin: jesse | 2007-12-24 00:23:34 -0500
* snapshot
Modified: rt/branches/3.999-DANGEROUS/lib/RT.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT.pm Mon Dec 24 00:30:01 2007
@@ -358,8 +358,8 @@
sub system_user {
my $system_user = RT::CurrentUser->new(name => 'RT_System');
- $system_user->is_superuser(1);
- return $system_user;
+ $system_user->is_superuser(1);
+ return $system_user;
}
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 Mon Dec 24 00:30:01 2007
@@ -30,8 +30,11 @@
};
-before qr'/(?!login)' => run {
- tangent '/login' unless (Jifty->web->current_user->id);
+# XXX TODO XXX SECURITY RISK - this regex is WRONG AND UNSAFE
+before qr'/(?!login)$' => run {
+ my $path = $1;
+ warn "my path is $path";
+ tangent '/login' unless (Jifty->web->current_user->id || $path =~ /NoAuth/);
};
before qr/(.*)/ => run {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/MailFrom.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/MailFrom.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/MailFrom.pm Mon Dec 24 00:30:01 2007
@@ -67,9 +67,10 @@
return ( $args{'CurrentUser'}, -1 );
}
- my $CurrentUser = RT::CurrentUser->new;
- $CurrentUser->new( email => $Address );
- $CurrentUser->new( name => $Address ) unless $CurrentUser->id;
+ my $CurrentUser = RT::CurrentUser->new(email => $Address);
+ unless ($CurrentUser->id ) {
+ $CurrentUser = RT::CurrentUser->new( name => $Address )
+ }
if ( $CurrentUser->id ) {
$RT::Logger->debug("Mail from user #". $CurrentUser->id ." ($Address)" );
return ( $CurrentUser, 1 );
@@ -173,9 +174,4 @@
return ( $CurrentUser, 1 );
}
-eval "require RT::Interface::Email::Auth::MailFrom_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Email/Auth/MailFrom_Vendor.pm});
-eval "require RT::Interface::Email::Auth::MailFrom_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Email/Auth/MailFrom_Local.pm});
-
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm Mon Dec 24 00:30:01 2007
@@ -75,9 +75,10 @@
=cut
+use strict;
+use warnings;
package RT::Model::TicketCollection;
use base qw/RT::SearchBuilder/;
-use strict;
no warnings qw(redefine);
use RT::Model::CustomFieldCollection;
@@ -2448,7 +2449,6 @@
# {{{ sub _init
sub _init {
my $self = shift;
- $self->{'table'} = "Tickets";
$self->{'RecalcTicketLimits'} = 1;
$self->{'looking_at_effective_id'} = 0;
$self->{'looking_at_type'} = 0;
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 Mon Dec 24 00:30:01 2007
@@ -36,7 +36,7 @@
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 email => max_length is 120, type is 'varchar(120)', default is '';
column freeform_contact_info => type is 'blob', default is '';
column
organization =>,
Modified: rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm Mon Dec 24 00:30:01 2007
@@ -67,7 +67,7 @@
use strict;
use base qw/RT::Base/;
-use base qw/Jifty::DBI::Collection/;
+use base qw/Jifty::Collection/;
use UNIVERSAL::require;
sub _handle {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Shredder/GroupMember.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Shredder/GroupMember.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Shredder/GroupMember.pm Mon Dec 24 00:30:01 2007
@@ -119,7 +119,7 @@
my( $status, $msg ) = $group->add_member( RT->nobody->id );
RT::Shredder::Exception->throw( $msg ) unless $status;
- my $ticket = RT::Model::Ticket->new( $group->current_user );
+ my $ticket = RT::Model::Ticket->new(current_user => $group->current_user );
$ticket->load( $group->Instance );
RT::Shredder::Exception->throw( "Couldn't load ticket" ) unless $ticket->id;
Modified: rt/branches/3.999-DANGEROUS/t/api/currentuser.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/currentuser.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/currentuser.t Mon Dec 24 00:30:01 2007
@@ -1,33 +1,23 @@
use strict;
use warnings;
-use RT::Test; use Test::More;
-plan tests => 8;
+use RT::Test;
+use Test::More;
+plan tests => 4;
use RT;
+ok( require RT::CurrentUser );
-
-{
-
-ok (require RT::CurrentUser);
-
-
-}
-
-{
-
-ok (my $cu = RT::CurrentUser->new('root'));
-isnt ($lh, undef, '$lh is defined');
-ok ($lh->isa('Locale::Maketext'));
-is ($cu->_('TEST_STRING'), "Concrete Mixer", "Localized TEST_STRING into English");
+ok( my $cu = RT::CurrentUser->new('root') );
+is( _('TEST_STRING'), "Concrete Mixer",
+ "Localized TEST_STRING into English" );
SKIP: {
skip "French localization is not enabled", 2
- unless grep $_ && $_ =~ /^(\*|fr)$/, RT->Config->Get('LexiconLanguages');
- ok ($lh = $cu->LanguageHandle('fr'));
- is ($cu->_('Before'), "Avant", "Localized TEST_STRING into French");
-}
-
+ unless grep $_ && $_ =~ /^(\*|fr)$/,
+ RT->Config->Get('LexiconLanguages');
+ Jifty::I18N->get_handle('FR-fr');
+ is( _('Before'), "Avant", "Localized TEST_STRING into French" );
}
1;
Modified: rt/branches/3.999-DANGEROUS/t/api/groups.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/groups.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/groups.t Mon Dec 24 00:30:01 2007
@@ -6,20 +6,11 @@
-{
- undef $main::_STDOUT_;
- undef $main::_STDERR_;
ok (require RT::Model::GroupCollection);
- undef $main::_STDOUT_;
- undef $main::_STDERR_;
-}
-
{
- undef $main::_STDOUT_;
- undef $main::_STDERR_;
# next had bugs
# Groups->limit( column => 'id', operator => '!=', value => xx );
@@ -95,16 +86,16 @@
my $RTxSysObj = {};
bless $RTxSysObj, 'RTx::System';
-*RTx::System::Id = sub { 1; };
-*RTx::System::id = *RTx::System::Id;
+*RTx::System::id = sub { 1; };
+*RTx::System::id = *RTx::System::id;
my $ace = RT::Model::ACE->new(current_user => RT->system_user);
($id, $msg) = $ace->RT::Record::create( principal_id => $RTxGroup->id, principal_type => 'Group', right_name => 'RTxGroupRight', object_type => 'RTx::System', object_id => 1);
ok ($id, "ACL for RTxSysObj Created");
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;
$groups = RT::Model::GroupCollection->new(current_user => RT->system_user);
$groups->WithRight(Right => 'RTxGroupRight', Object => $RTxSysObj);
@@ -125,7 +116,7 @@
my $RTxObj2 = {};
bless $RTxObj2, 'RTx::System::Record';
-*RTx::System::Record::Id = sub { 5; };
+*RTx::System::Record::id = sub { 5; };
$groups = RT::Model::GroupCollection->new(current_user => RT->system_user);
$groups->WithRight(Right => 'RTxGroupRight', Object => $RTxObj2);
Modified: rt/branches/3.999-DANGEROUS/t/api/i18n.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/i18n.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/i18n.t Mon Dec 24 00:30:01 2007
@@ -7,26 +7,16 @@
-{
-use_ok ('RT::I18N');
-ok(RT::I18N->Init);
-
-
-}
-
-{
-
-ok(my $chinese = RT::I18N->get_handle('zh_tw'));
+use_ok ('Jifty::I18N');
+ok(my $chinese = Jifty::I18N->get_language_handle('zh_tw'));
ok(UNIVERSAL::can($chinese, 'maketext'));
like($chinese->maketext('__Content-Type') , qr/utf-8/i, "Found the utf-8 charset for traditional chinese in the string ".$chinese->maketext('__Content-Type'));
is($chinese->encoding , 'utf-8', "The encoding is 'utf-8' -".$chinese->encoding);
-
-ok(my $en = RT::I18N->get_handle('en'));
+ok(my $en = Jifty::I18N->get_language_handle('en'));
ok(UNIVERSAL::can($en, 'maketext'));
is($en->encoding , 'utf-8', "The encoding ".$en->encoding." is 'utf-8'");
-}
1;
Modified: rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t Mon Dec 24 00:30:01 2007
@@ -66,7 +66,7 @@
is( $user->id, $uid, "id is correct" );
use RT::Model::Queue;
- my $queue = RT::Model::Queue->new( RT->system_user );
+ my $queue = RT::Model::Queue->new( current_user => RT->system_user );
$queue->load('General');
ok( $queue->id, "queue loaded succesfully" );
Modified: rt/branches/3.999-DANGEROUS/t/shredder/utils.pl
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/utils.pl (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/utils.pl Mon Dec 24 00:30:01 2007
@@ -293,11 +293,11 @@
my $dbh = shift;
my %args = ( CleanDates => 1, @_ );
- my $old_fhkn = $dbh->{'FetchHashKeyname'};
- $dbh->{'FetchHashKeyname'} = 'name_lc';
+ my $old_fhkn = $dbh->{'FetchHashKeyName'};
+ $dbh->{'FetchHashKeyName'} = 'NAME_lc';
my $sth = $dbh->table_info( '', '', '%', 'TABLE' ) || die $DBI::err;
- my @tables = keys %{$sth->fetchall_hashref( 'TABLE_NAME' )};
+ my @tables = keys %{$sth->fetchall_hashref( 'table_name' )};
my $res = {};
foreach my $t( @tables ) {
@@ -307,7 +307,7 @@
die $DBI::err if $DBI::err;
}
- $dbh->{'FetchHashKeyname'} = $old_fhkn;
+ $dbh->{'FetchHashKeyName'} = $old_fhkn;
return $res;
}
Modified: rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t Mon Dec 24 00:30:01 2007
@@ -143,7 +143,7 @@
# owner is special watcher because reference is duplicated in two places,
# owner was an ENUM field now it's WATCHERFIELD, but should support old
# style ENUM searches for backward compatibility
-my $nobody = RT::Nobody();
+my $nobody = RT->nobody();
{
my $tix = RT::Model::TicketCollection->new(current_user => RT->system_user);
$tix->from_sql("Queue = '$queue' AND Owner = '". $nobody->id ."'");
More information about the Rt-commit
mailing list