[Rt-commit] r14111 - in rt/branches/3.999-DANGEROUS: lib/RT
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Tue Jul 15 05:32:19 EDT 2008
Author: sunnavy
Date: Tue Jul 15 05:32:17 2008
New Revision: 14111
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
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/SharedSetting.pm
Log:
r14477 at sunnavys-mb: sunnavy | 2008-07-15 15:47:59 +0800
my name chages will go on and on
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 Jul 15 05:32:17 2008
@@ -95,7 +95,7 @@
$params->{'search_type'} = $args->{'type'} || 'Ticket';
- return $object->AddAttribute(
+ return $object->add_attribute(
'name' => 'saved_search',
'description' => $args->{'name'},
'content' => $params,
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 Jul 15 05:32:17 2008
@@ -103,9 +103,9 @@
if ($object) {
$self->{'objects'} = [];
- my @search_atts = $object->attributes->named('SavedSearch');
+ my @search_atts = $object->attributes->named('saved_search');
foreach my $att (@search_atts) {
- my $search = RT::SavedSearch->new;
+ my $search = RT::SavedSearch->new( current_user => $self->current_user );
$search->load( $privacy, $att->id );
next if $type && $search->type ne $type;
push( @{ $self->{'objects'} }, $search );
@@ -156,7 +156,7 @@
my $self = shift;
my $privacy = shift;
- return RT::SavedSearch->new->_get_object($privacy);
+ return RT::SavedSearch->new( current_user => $self->current_user )->_get_object($privacy);
}
### Internal methods
Modified: rt/branches/3.999-DANGEROUS/lib/RT/SharedSetting.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/SharedSetting.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/SharedSetting.pm Tue Jul 15 05:32:17 2008
@@ -48,7 +48,7 @@
=head1 NAME
-RT::SharedSetting - an API for settings that belong to an RT::User or RT::Group
+RT::SharedSetting - an API for settings that belong to an RT::Model::User or RT::Model::Group
=head1 SYNOPSIS
@@ -56,7 +56,7 @@
=head1 DESCRIPTION
-A RT::SharedSetting is an object that can belong to an L<RT::User> or an <RT::Group>.
+A RT::SharedSetting is an object that can belong to an L<RT::Model::User> or an <RT::Model::Group>.
It consists of an ID, a name, and some arbitrary data.
=cut
@@ -114,12 +114,12 @@
$self->post_load();
return ( 0, $self->loc("Permission denied") )
- unless $self->current_userCanSee;
+ unless $self->current_user_can_see;
return (
1,
$self->loc(
- "Loaded [_1] [_2]", $self->object_name, $self->Name
+ "Loaded %1 %2", $self->object_name, $self->name
)
);
}
@@ -198,7 +198,7 @@
my $self = shift;
my %args = (
- 'privacy' => 'RT::User-' . $self->current_user->user_object->id,
+ 'privacy' => 'RT::Model::User-' . $self->current_user->user_object->id,
'name' => "new " . $self->object_name,
@_,
);
@@ -218,7 +218,7 @@
$self->{'attribute'} = $object->attributes->with_id($att_id);
$self->{'id'} = $att_id;
$self->{'privacy'} = $privacy;
- return ( 1, $self->loc( "Saved [_1] [_2]", $self->object_name, $name ) );
+ return ( 1, $self->loc( "Saved %1 %2", $self->object_name, $name ) );
}
else {
Jifty->log->error( $self->object_name . " save failure: $att_msg" );
@@ -298,10 +298,10 @@
my ( $status, $msg ) = $self->{'attribute'}->delete;
if ($status) {
- return ( 1, $self->loc( "Deleted [_1]", $self->object_name ) );
+ return ( 1, $self->loc( "Deleted %1", $self->object_name ) );
}
else {
- return ( 0, $self->loc( "Delete failed: [_1]", $msg ) );
+ return ( 0, $self->loc( "Delete failed: %1", $msg ) );
}
}
@@ -333,7 +333,7 @@
=head2 privacy
Returns the principal object to whom this shared setting belongs, in a string
-"<class>-<id>", e.g. "RT::Group-16".
+"<class>-<id>", e.g. "RT::Model::Group-16".
=cut
@@ -378,8 +378,8 @@
return 0 if $to =~ /^RT::System/;
# If the setting is group-wide...
- if ( $privacy =~ /^RT::Group-(\d+)$/ ) {
- my $setting_group = RT::Group->new( $self->current_user );
+ if ( $privacy =~ /^RT::Model::Group-(\d+)$/ ) {
+ my $setting_group = RT::Model::Group->new( $self->current_user );
$setting_group->load($1);
if ( $to =~ /-(\d+)$/ ) {
@@ -428,18 +428,19 @@
# Do not allow the loading of a user object other than the current
# user, or of a group object of which the current user is not a member.
- if ( $obj_type eq 'RT::User'
+ if ( $obj_type eq 'RT::Model::User'
&& $object->id != $self->current_user->user_object->id )
{
Jifty->log->debug("Permission denied for user other than self");
return undef;
}
- if ( $obj_type eq 'RT::Group'
- && !$object->HasMemberRecursively( $self->current_user->principal_obj ) )
+ if ( $obj_type eq 'RT::Model::Group'
+ && !$object->has_member_recursively(
+ $self->current_user->principal_object ) )
{
Jifty->log->debug( "Permission denied, "
- . $self->current_user->Name
+ . $self->current_user->name
. " is not a member of group" );
return undef;
}
@@ -449,7 +450,7 @@
sub _load_privacy_object {
my ( $self, $obj_type, $obj_id ) = @_;
- if ( $obj_type eq 'RT::User' ) {
+ if ( $obj_type eq 'RT::Model::User' ) {
if ( $obj_id == $self->current_user->id ) {
return $self->current_user->user_object;
}
@@ -461,9 +462,9 @@
return undef;
}
}
- elsif ( $obj_type eq 'RT::Group' ) {
- my $group = RT::Group->new( $self->current_user );
- $group->Load($obj_id);
+ elsif ( $obj_type eq 'RT::Model::Group' ) {
+ my $group = RT::Model::Group->new( current_user => $self->current_user );
+ $group->load($obj_id);
return $group;
}
elsif ( $obj_type eq 'RT::System' ) {
@@ -484,16 +485,16 @@
if ( ref($obj_type) ) {
my $Object = $obj_type;
return
- $Object->isa('RT::User') ? 'RT::User-' . $Object->id
- : $Object->isa('RT::Group') ? 'RT::Group-' . $Object->id
+ $Object->isa('RT::Model::User') ? 'RT::Model::User-' . $Object->id
+ : $Object->isa('RT::Model::Group') ? 'RT::Model::Group-' . $Object->id
: $Object->isa('RT::System') ? 'RT::System-' . $Object->id
: undef;
}
return undef unless ($obj_type); # undef workaround
return
- $obj_type eq 'RT::User' ? "$obj_type-$obj_id"
- : $obj_type eq 'RT::Group' ? "$obj_type-$obj_id"
+ $obj_type eq 'RT::Model::User' ? "$obj_type-$obj_id"
+ : $obj_type eq 'RT::Model::Group' ? "$obj_type-$obj_id"
: $obj_type eq 'RT::System' ? "$obj_type-$obj_id"
: undef;
}
More information about the Rt-commit
mailing list