[Rt-commit] r15685 - in rt/branches/3.999-DANGEROUS: lib/RT lib/RT/Model share/html/Admin/Elements share/html/Admin/Groups share/html/Ticket/Elements t/api t/delegation
ruz at bestpractical.com
ruz at bestpractical.com
Mon Sep 1 19:53:49 EDT 2008
Author: ruz
Date: Mon Sep 1 19:53:48 2008
New Revision: 15685
Modified:
rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.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/Attachment.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/CachedGroupMemberCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupMemberCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Principal.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Transaction.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/UserCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyGroup.pm
rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/SelectRights
rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/GroupRights.html
rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/UserRights.html
rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/ShowTransaction
rt/branches/3.999-DANGEROUS/t/api/ace.t
rt/branches/3.999-DANGEROUS/t/api/group.t
rt/branches/3.999-DANGEROUS/t/api/groups.t
rt/branches/3.999-DANGEROUS/t/api/user.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/delegation/revocation.t
Log:
* replace principal_type of principal with just type
* make some deprecation lighter as there are a lot of misuse still
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.pm Mon Sep 1 19:53:48 2008
@@ -112,7 +112,7 @@
my $ace = RT::Model::ACE->new( current_user => RT->system_user );
my ( $val, $msg ) = $ace->_bootstrap_create(
principal_id => acl_equiv_group_id( RT->system_user->id ),
- principal_type => 'Group',
+ type => 'Group',
right_name => 'SuperUser',
object_type => 'RT::System',
object_id => 1,
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 Mon Sep 1 19:53:48 2008
@@ -76,7 +76,7 @@
use Jifty::DBI::Schema;
use Jifty::DBI::Record schema {
column
- principal_type => max_length is 25,
+ type => max_length is 25,
type is 'varchar(25)', default is '';
column principal_id => references RT::Model::Principal;
column right_name => max_length is 25, type is 'varchar(25)', default is '';
@@ -120,7 +120,7 @@
Load an ACE by specifying a paramhash with the following fields:
principal_id => undef,
- principal_type => undef,
+ type => undef,
right_name => undef,
And either:
@@ -138,7 +138,7 @@
my $self = shift;
my %args = (
principal_id => undef,
- principal_type => undef,
+ type => undef,
right_name => undef,
object => undef,
object_id => undef,
@@ -147,7 +147,7 @@
);
my $princ_obj;
- ( $princ_obj, $args{'principal_type'} ) = $self->canonicalize_principal( $args{'principal_id'}, $args{'principal_type'} );
+ ( $princ_obj, $args{'type'} ) = $self->canonicalize_principal( $args{'principal_id'}, $args{'type'} );
unless ( $princ_obj->id ) {
return ( 0, _( 'Principal %1 not found.', $args{'principal_id'} ) );
@@ -160,7 +160,7 @@
$self->load_by_cols(
principal_id => $princ_obj->id,
- principal_type => $args{'principal_type'},
+ type => $args{'type'},
right_name => $args{'right_name'},
object_type => $object_type,
object_id => $object_id
@@ -183,7 +183,7 @@
PARAMS is a parameter hash with the following elements:
principal_id => The id of an RT::Model::Principal object
- principal_type => "User" "Group" or any Role type
+ type => "User" "Group" or any Role type
right_name => the name of a right. in any case
delegated_by => The Principal->id of the user delegating the right
delegated_from => The id of the ACE which this new ACE is delegated from
@@ -211,7 +211,7 @@
my $self = shift;
my %args = (
principal_id => undef,
- principal_type => undef,
+ type => undef,
right_name => undef,
object => undef,
@_
@@ -235,7 +235,7 @@
# {{{ Validate the principal
my $princ_obj;
- ( $princ_obj, $args{'principal_type'} ) = $self->canonicalize_principal( $args{'principal_id'}, $args{'principal_type'} );
+ ( $princ_obj, $args{'type'} ) = $self->canonicalize_principal( $args{'principal_id'}, $args{'type'} );
unless ( $princ_obj->id ) {
return ( 0, _( 'Principal %1 not found.', $args{'principal_id'} ) );
@@ -297,7 +297,7 @@
# Make sure the right doesn't already exist.
$self->load_by_cols(
principal_id => $princ_obj->id,
- principal_type => $args{'principal_type'},
+ type => $args{'type'},
right_name => $args{'right_name'},
object_type => $args{'object_type'},
object_id => $args{'object_id'},
@@ -310,7 +310,7 @@
my $id = $self->SUPER::create(
principal_id => $princ_obj->id,
- principal_type => $args{'principal_type'},
+ type => $args{'type'},
right_name => $args{'right_name'},
object_type => ref( $args{'object'} ),
object_id => $args{'object'}->id,
@@ -354,7 +354,7 @@
return ( 0, _("Right not loaded.") );
}
my $princ_obj;
- ( $princ_obj, $args{'principal_type'} ) = $self->canonicalize_principal( $args{'principal_id'}, $args{'principal_type'} );
+ ( $princ_obj, $args{'type'} ) = $self->canonicalize_principal( $args{'principal_id'}, $args{'type'} );
unless ( $princ_obj->id ) {
return ( 0, _( 'Principal %1 not found.', $args{'principal_id'} ) );
@@ -397,7 +397,7 @@
# Make sure the right doesn't already exist.
$delegated_ace->load_by_cols(
principal_id => $princ_obj->id,
- principal_type => 'Group',
+ type => 'Group',
right_name => $self->__value('right_name'),
object_type => $self->__value('object_type'),
object_id => $self->__value('object_id'),
@@ -409,7 +409,7 @@
}
my $id = $delegated_ace->SUPER::create(
principal_id => $princ_obj->id,
- principal_type => 'Group', # do we want to hardcode this?
+ type => 'Group', # do we want to hardcode this?
right_name => $self->__value('right_name'),
object_type => $self->__value('object_type'),
object_id => $self->__value('object_id'),
@@ -541,7 +541,7 @@
$user->load( $args{'UserId'} );
delete $args{'UserId'};
$args{'principal_id'} = $user->principal_id;
- $args{'principal_type'} = 'User';
+ $args{'type'} = 'User';
}
my $id = $self->SUPER::create(%args);
@@ -658,12 +658,12 @@
-=head2 _canonicalize_principal (principal_id, principal_type)
+=head2 _canonicalize_principal (principal_id, type)
Takes a principal id and an optional principal type.
If the principal is a user, resolves it to the proper acl equivalence group.
-Returns a tuple of (RT::Model::Principal, principal_type) for the principal we really want to work with
+Returns a tuple of (RT::Model::Principal, type) for the principal we really want to work with
=cut
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 Mon Sep 1 19:53:48 2008
@@ -148,7 +148,7 @@
=head2 limit_to_principal { type => undef, id => undef, include_group_membership => undef }
-Limit the ACL to the principal with principal_id id and principal_type Type
+Limit the ACL to the principal with principal_id id and type Type
Id is not optional.
Type is.
@@ -184,7 +184,7 @@
} else {
if ( defined $args{'type'} ) {
$self->limit(
- column => 'principal_type',
+ column => 'type',
operator => '=',
value => $args{'type'},
entry_aggregator => 'OR'
@@ -197,7 +197,7 @@
# to just be the same table. or _maybe_ that we want an object db.
my $princ = RT::Model::Principal->new( current_user => RT->system_user );
$princ->load( $args{'id'} );
- if ( $princ->principal_type eq 'User' ) {
+ if ( $princ->type eq 'User' ) {
my $group = RT::Model::Group->new( current_user => RT->system_user );
$group->load_acl_equivalence_group($princ);
$args{'id'} = $group->principal_id;
@@ -336,7 +336,7 @@
. $entry->__value('object_id') . "-"
. $entry->__value('right_name') . "-"
. $entry->__value('principal_id') . "-"
- . $entry->__value('principal_type');
+ . $entry->__value('type');
$self->{'as_hash'}->{"$hashkey"} = 1;
@@ -356,14 +356,14 @@
right_applies_to => undef,
right_name => undef,
principal_id => undef,
- principal_type => undef,
+ type => undef,
@_
);
#if we haven't done the search yet, do it now.
$self->_do_search();
- if ( $self->{'as_hash'}->{ $args{'right_scope'} . "-" . $args{'right_applies_to'} . "-" . $args{'right_name'} . "-" . $args{'principal_id'} . "-" . $args{'principal_type'} } == 1 ) {
+ if ( $self->{'as_hash'}->{ $args{'right_scope'} . "-" . $args{'right_applies_to'} . "-" . $args{'right_name'} . "-" . $args{'principal_id'} . "-" . $args{'type'} } == 1 ) {
return (1);
} else {
return (undef);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm Mon Sep 1 19:53:48 2008
@@ -78,7 +78,8 @@
use base 'RT::Record';
use Jifty::DBI::Schema;
use Jifty::DBI::Record schema {
- column transaction_id => references RT::Model::Transaction;
+ column transaction_id => references RT::Model::Transaction,
+ is mandatory;
column
message_id => max_length is 200,
type is 'varchar(200)', default is '';
@@ -438,8 +439,14 @@
my %data = ();
my $current_user_address = lc $self->current_user->user_object->email;
- my $correspond = lc $self->transaction_obj->ticket_obj->queue_obj->correspond_address;
- my $comment = lc $self->transaction_obj->ticket_obj->queue_obj->comment_address;
+
+ my $object = $self->transaction->object;
+ my ($correspond, $comment) = ('', '');
+ if ( $object->can('queue') ) {
+ $correspond = lc $object->queue->correspond_address;
+ $comment = lc $object->queue->comment_address;
+ }
+
foreach my $hdr (qw(From To Cc Bcc RT-Send-Cc RT-Send-Bcc)) {
my @Addresses;
my $line = $self->get_header($hdr);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CachedGroupMemberCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CachedGroupMemberCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CachedGroupMemberCollection.pm Mon Sep 1 19:53:48 2008
@@ -91,7 +91,7 @@
$self->limit(
alias => $principals,
- column => 'principal_type',
+ column => 'type',
value => 'User',
entry_aggregator => 'OR',
);
@@ -120,7 +120,7 @@
$self->limit(
alias => $principals,
- column => 'principal_type',
+ column => 'type',
value => 'Group',
entry_aggregator => 'OR',
);
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 Mon Sep 1 19:53:48 2008
@@ -403,7 +403,7 @@
# When creating this group, set up a principal id for it.
my $principal = RT::Model::Principal->new;
my ( $principal_id, $msg ) = $principal->create(
- principal_type => 'Group',
+ type => 'Group',
);
$self->SUPER::create(
@@ -1292,7 +1292,7 @@
$self->{'principal_object'} = RT::Model::Principal->new;
$self->{'principal_object'}->load_by_cols(
id => $self->id,
- principal_type => 'Group'
+ type => 'Group'
);
}
return $self->{'principal_object'};
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupCollection.pm Mon Sep 1 19:53:48 2008
@@ -104,7 +104,7 @@
# searches in some DBs.
$self->limit(
alias => $self->{'princalias'},
- column => 'principal_type',
+ column => 'type',
value => 'Group',
);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupMemberCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupMemberCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/GroupMemberCollection.pm Mon Sep 1 19:53:48 2008
@@ -91,7 +91,7 @@
$self->limit(
alias => $principals,
- column => 'principal_type',
+ column => 'type',
value => 'User',
entry_aggregator => 'OR',
);
@@ -120,7 +120,7 @@
$self->limit(
alias => $principals,
- column => 'principal_type',
+ column => 'type',
value => 'Group',
entry_aggregator => 'OR',
);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Principal.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Principal.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Principal.pm Mon Sep 1 19:53:48 2008
@@ -60,8 +60,14 @@
use Jifty::DBI::Schema;
use Jifty::DBI::Record schema {
- column principal_type => type is 'text';
- column disabled => type is 'integer', default is '0';
+ column type =>
+ type is 'varchar(10)',
+ max_length is 10,
+ is mandatory;
+ column disabled =>
+ type is 'integer',
+ is mandatory,
+ default is 0;
};
sub table {'Principals'}
@@ -80,7 +86,7 @@
sub is_group {
my $self = shift;
- if ( lc( $self->principal_type || '' ) eq 'group' ) {
+ if ( lc( $self->type || '' ) eq 'group' ) {
return 1;
}
return undef;
@@ -97,7 +103,7 @@
sub is_user {
my $self = shift;
- if ( $self->principal_type eq 'User' ) {
+ if ( $self->type eq 'User' ) {
return (1);
} else {
return undef;
@@ -114,24 +120,12 @@
sub object {
my $self = shift;
-
- unless ( $self->{'object'} ) {
- if ( $self->is_user ) {
- $self->{'object'} = RT::Model::User->new;
- } elsif ( $self->is_group ) {
- $self->{'object'} = RT::Model::Group->new;
- } else {
- return (undef);
- }
- $self->{'object'}->load( $self->id() );
- }
- return ( $self->{'object'} );
-
+ my $model = 'RT::Model::'. $self->__value('type');
+ my $obj = $model->new;
+ $obj->load( $self->id );
+ return $obj;
}
-
-
-
=head2 grant_right { right => RIGHTNAME, object => undef }
A helper function which calls RT::Model::ACE->create
@@ -162,13 +156,11 @@
# If it's a user, we really want to grant the right to their
# user equivalence group
- return (
- $ace->create(
- right_name => $args{'right'},
- object => $args{'object'},
- principal_type => $type,
- principal_id => $self->id
- )
+ return $ace->create(
+ right_name => $args{'right'},
+ object => $args{'object'},
+ type => $type,
+ principal_id => $self->id,
);
}
@@ -209,7 +201,7 @@
$ace->load_by_values(
right_name => $args{'right'},
object => $args{'object'},
- principal_type => $type,
+ type => $type,
principal_id => $self->id
);
@@ -396,7 +388,7 @@
"(ACL.right_name = 'SuperUser' OR ACL.right_name = '$right') "
# Never find disabled groups.
- . "AND Principals.id = ACL.principal_id " . "AND Principals.principal_type = 'Group' " . "AND Principals.disabled = 0 "
+ . "AND Principals.id = ACL.principal_id " . "AND Principals.type = 'Group' " . "AND Principals.disabled = 0 "
# See if the principal is a member of the group recursively or _is the rightholder_
# never find recursively disabled group members
@@ -447,13 +439,13 @@
. "AND ( Principals.disabled = 0 OR Principals.disabled IS NULL) " . "AND (CachedGroupMembers.disabled = 0 OR CachedGroupMembers.disabled IS NULL )"
# We always grant rights to Groups
- . "AND Principals.id = Groups.id " . "AND Principals.principal_type = 'Group' "
+ . "AND Principals.id = Groups.id " . "AND Principals.type = 'Group' "
# See if the principal is a member of the group recursively or _is the rightholder_
# never find recursively disabled group members
# also, check to see if the right is being granted _directly_ to this principal,
# as is the case when we want to look up group rights
- . "AND Principals.id = CachedGroupMembers.group_id " . "AND CachedGroupMembers.member_id = " . $self->id . " " . "AND ACL.principal_type = Groups.type ";
+ . "AND Principals.id = CachedGroupMembers.group_id " . "AND CachedGroupMembers.member_id = " . $self->id . " " . "AND ACL.type = Groups.type ";
my (@object_clauses);
foreach my $obj ( @{ $args{'equiv_objects'} } ) {
@@ -526,7 +518,7 @@
if ( $self->is_group && $self->object->domain =~ /Role$/ ) {
$type = $self->object->type;
} else {
- $type = $self->principal_type;
+ $type = $self->type;
}
return ($type);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Transaction.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Transaction.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Transaction.pm Mon Sep 1 19:53:48 2008
@@ -733,7 +733,7 @@
return _("No transaction type specified");
}
- my $obj_type = $self->friendlyobject_type;
+ my $obj_type = $self->friendly_object_type;
if ( $type eq 'Create' ) {
return ( _( "%1 Created", $obj_type ) );
@@ -1001,7 +1001,6 @@
}
-
=head2 _value
Takes the name of a table column.
@@ -1093,13 +1092,24 @@
sub ticket {
+ # XXX: too early for deprecation, a lot of usage
+ #require Carp; Carp::confess("use object method instead and check type");
my $self = shift;
+ unless ( $self->object_type eq 'RT::Model::Ticket' ) {
+ require Carp; Carp::confess("ticket method is called on txn that belongs not to ticket");
+ }
return $self->object_id;
+
}
sub ticket_obj {
+ # XXX: too early for deprecation, a lot of usage
+ #require Carp; Carp::confess("use object method instead and check type");
my $self = shift;
- return $self->object;
+ unless ( $self->object_type eq 'RT::Model::Ticket' ) {
+ require Carp; Carp::confess("ticket_obj method is called on txn that belongs not to ticket");
+ }
+ return $self->object_id;
}
sub old_value {
@@ -1135,7 +1145,7 @@
return $object;
}
-sub friendlyobject_type {
+sub friendly_object_type {
my $self = shift;
my $type = $self->object_type or return undef;
$type =~ s/^RT::Model:://;
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 Sep 1 19:53:48 2008
@@ -222,7 +222,7 @@
# When creating this user, set up a principal id for it.
my $principal = RT::Model::Principal->new;
my $principal_id = $principal->create(
- principal_type => 'User',
+ type => 'User',
disabled => $args{'disabled'},
);
@@ -431,7 +431,7 @@
# When creating this user, set up a principal id for it.
my $principal = RT::Model::Principal->new( current_user => RT::CurrentUser->new( _bootstrap => 1 ) );
my ( $principal_id, $pmsg ) = $principal->create(
- principal_type => 'User',
+ type => 'User',
disabled => '0'
);
@@ -838,8 +838,8 @@
unless ( $obj->id ) {
Jifty->log->fatal( 'No principal for user #' . $self->id );
return undef;
- } elsif ( $obj->principal_type ne 'User' ) {
- Jifty->log->fatal( 'User #' . $self->id . ' has principal of ' . $obj->principal_type . ' type' );
+ } elsif ( $obj->type ne 'User' ) {
+ Jifty->log->fatal( 'User #' . $self->id . ' has principal of ' . $obj->type . ' type' );
return undef;
}
return $obj;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/UserCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/UserCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/UserCollection.pm Mon Sep 1 19:53:48 2008
@@ -92,7 +92,7 @@
);
$self->limit(
alias => $self->principals_alias,
- column => 'principal_type',
+ column => 'type',
value => 'User',
);
@@ -430,7 +430,7 @@
$self->limit(
alias => $acl,
- column => 'principal_type',
+ column => 'type',
value => "$groups.Type",
quote_value => 0,
);
@@ -504,7 +504,7 @@
# Find only members of groups that have the right.
$self->limit(
alias => $acl,
- column => 'principal_type',
+ column => 'type',
value => 'Group',
);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyGroup.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyGroup.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyGroup.pm Mon Sep 1 19:53:48 2008
@@ -114,13 +114,13 @@
Jifty->log->info("Principal #$instance is disabled => skip");
return;
}
- if ( !$obj->principal_type ) {
+ if ( !$obj->type ) {
Jifty->log->crit("Principal #$instance has empty type");
}
- elsif ( lc $obj->principal_type eq 'user' ) {
+ elsif ( lc $obj->type eq 'user' ) {
$self->__handle_user_argument( $obj->object );
}
- elsif ( lc $obj->principal_type eq 'group' ) {
+ elsif ( lc $obj->type eq 'group' ) {
$self->__handle_group_argument( $obj->object );
}
else {
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/SelectRights
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/SelectRights (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Elements/SelectRights Mon Sep 1 19:53:48 2008
@@ -85,7 +85,7 @@
# to just be the same table. or _maybe_ that we want an object db.
my $princ = RT::Model::Principal->new(current_user => RT->system_user);
$princ->load($principal_id);
- if ($princ->principal_type eq 'User') {
+ if ($princ->type eq 'User') {
my $group = RT::Model::Group->new(current_user => RT->system_user);
$group->load_acl_equivalence_group($princ);
$principal_id = $group->principal_id;
@@ -112,7 +112,7 @@
</%INIT>
<%ARGS>
-$principal_type => undef
+$type => undef
$principal_id => undef
$object =>undef
</%ARGS>
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/GroupRights.html
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/GroupRights.html (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/GroupRights.html Mon Sep 1 19:53:48 2008
@@ -68,7 +68,7 @@
</td>
<td>
<& /Admin/Elements/SelectRights, principal_id => $Group->principal_id,
- principal_type => 'Group',
+ type => 'Group',
object => $GroupObj &>
</td>
</tr>
@@ -85,7 +85,7 @@
</td>
<td>
<& /Admin/Elements/SelectRights, principal_id => $Group->principal_id,
- principal_type => 'Group',
+ type => 'Group',
object => $GroupObj &>
</td>
</tr>
Modified: rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/UserRights.html
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/UserRights.html (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Admin/Groups/UserRights.html Mon Sep 1 19:53:48 2008
@@ -63,7 +63,7 @@
<td valign="top"><& /Elements/ShowUser, user => $user_object &></td>
<td><& /Admin/Elements/SelectRights,
principal_id => $Member->member_obj->id,
- principal_type => 'User',
+ type => 'User',
object => $GroupObj,
&></td>
</tr>
Modified: rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/ShowTransaction
==============================================================================
--- rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/ShowTransaction (original)
+++ rt/branches/3.999-DANGEROUS/share/html/Ticket/Elements/ShowTransaction Mon Sep 1 19:53:48 2008
@@ -147,8 +147,8 @@
}
my $TicketString = '';
-if ( $ticket->id != $transaction->ticket ) {
- $TicketString = "Ticket " . $transaction->ticket . ": ";
+if ( $ticket->id != $transaction->object_id ) {
+ $TicketString = "Ticket " . $transaction->object_id . ": ";
}
my $time_taken = '';
@@ -166,7 +166,7 @@
$titlebar_commands .=
"[<a target=\"_blank\" href=\"$email_record_path?id="
- . $transaction->ticket
+ . $transaction->object_id
. "&Transaction="
. $transaction->id
. "&Attachment="
@@ -180,12 +180,12 @@
else {
if ( $attachments->[0] && $show_title_bar_commands ) {
- my $ticket = $transaction->ticket_obj;
+ my $ticket = $transaction->object;
my $can_modify = $ticket->current_user_has_right('ModifyTicket');
if ( $can_modify || $ticket->current_user_has_right('ReplyToTicket') ) {
$titlebar_commands .=
"[<a href=\"".$update_path
- . "?id=" . $transaction->ticket
+ . "?id=" . $transaction->object_id
. "&QuoteTransaction=" . $transaction->id
. "&action=respond\">"
. _('Reply')
@@ -194,7 +194,7 @@
if ( $can_modify || $ticket->current_user_has_right('CommentOnTicket') ) {
$titlebar_commands .=
"[<a href=\"".$update_path."?id="
- . $transaction->ticket
+ . $transaction->object_id
. "&QuoteTransaction="
. $transaction->id
. "&action=comment\">"
@@ -203,7 +203,7 @@
if ( $ticket->current_user_has_right('ForwardMessage') ) {
$titlebar_commands .=
"[<a href=\"". $forward_path
- . "?id=". $transaction->ticket
+ . "?id=". $transaction->object_id
. "&QuoteTransaction=". $transaction->id
. "\">". _('Forward') . "</a>]";
}
Modified: rt/branches/3.999-DANGEROUS/t/api/ace.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/ace.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/ace.t Mon Sep 1 19:53:48 2008
@@ -59,7 +59,7 @@
my $user_b_equiv_group = RT::Model::Group->new(current_user => $user_b);
$user_b_equiv_group->load_acl_equivalence_group($user_b->principal_object);
ok ($user_b_equiv_group->id, "Loaded the user B acl equivalence group");
-$own_ticket_ace->load_by_values( principal_type => 'Group', principal_id => $user_a_equiv_group->principal_id, object=>$q, right_name => 'OwnTicket');
+$own_ticket_ace->load_by_values( type => 'Group', principal_id => $user_a_equiv_group->principal_id, object=>$q, right_name => 'OwnTicket');
ok ($own_ticket_ace->id, "Found the ACE we want to test with for now");
@@ -78,7 +78,7 @@
ok( $val ,"user a tries and succeeds to delegate the right 'ownticket' in queue 'DelegationTest' to personal group 'delegates' - $msg");
ok( $user_b->has_right(right => 'OwnTicket', object => $q) ,"user b has the right to own tickets in queue 'DelegationTest'");
my $delegated_ace = RT::Model::ACE->new(current_user => $user_a);
-$delegated_ace->load_by_values ( object => $q, right_name => 'OwnTicket', principal_type => 'Group',
+$delegated_ace->load_by_values ( object => $q, right_name => 'OwnTicket', type => 'Group',
principal_id => $a_delegates->principal_id, DelegatedBy => $user_a->principal_id, DelegatedFrom => $own_ticket_ace->id);
ok ($delegated_ace->id, "Found the delegated ACE");
@@ -154,7 +154,7 @@
ok( $user_a->has_right(right => 'OwnTicket', object => $q) ,"make sure that user a can own tickets in queue 'DelegationTest'");
my $group_ace= RT::Model::ACE->new(current_user => $user_a);
-$group_ace->load_by_values( principal_type => 'Group', principal_id => $del1->principal_id, object => $q, right_name => 'OwnTicket');
+$group_ace->load_by_values( type => 'Group', principal_id => $del1->principal_id, object => $q, right_name => 'OwnTicket');
ok ($group_ace->id, "Found the ACE we want to test with for now");
@@ -185,7 +185,7 @@
ok($val, "grant the right 'own tickets' in queue 'DelegationTest' to group del2 - $msg");
my $del2_right = RT::Model::ACE->new(current_user => $user_a);
-$del2_right->load_by_values( principal_id => $del2->principal_id, principal_type => 'Group', object => $q, right_name => 'OwnTicket');
+$del2_right->load_by_values( principal_id => $del2->principal_id, type => 'Group', object => $q, right_name => 'OwnTicket');
ok ($del2_right->id, "Found the right");
($val, $msg) = $del2_right->delegate(principal_id => $a_delegates->principal_id);
@@ -205,7 +205,7 @@
$group_ace= RT::Model::ACE->new(current_user => $user_a);
-$group_ace->load_by_values( principal_type => 'Group', principal_id => $del1->principal_id, object=>$q, right_name => 'OwnTicket');
+$group_ace->load_by_values( type => 'Group', principal_id => $del1->principal_id, object=>$q, right_name => 'OwnTicket');
ok ($group_ace->id, "Found the ACE we want to test with for now");
Modified: rt/branches/3.999-DANGEROUS/t/api/group.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/group.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/group.t Mon Sep 1 19:53:48 2008
@@ -92,7 +92,7 @@
ok(my $u = RT::Model::Group->new(current_user => RT->system_user));
ok($u->load(4), "Loaded the first user");
-is($u->principal_object->principal_type , 'Group' , "Principal 4 is a group");
+is($u->principal_object->type , 'Group' , "Principal 4 is a group");
}
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 Sep 1 19:53:48 2008
@@ -89,7 +89,7 @@
*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);
+($id, $msg) = $ace->RT::Record::create( principal_id => $RTxGroup->id, type => 'Group', right_name => 'RTxGroupRight', object_type => 'RTx::System', object_id => 1);
ok ($id, "ACL for RTxSysObj Created");
my $RTxObj = {};
@@ -111,7 +111,7 @@
use RT::Model::ACE;
$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::Record', object_id => 5 );
+($id, $msg) = $ace->RT::Record::create( principal_id => $RTxGroup->id, type => 'Group', right_name => 'RTxGroupRight', object_type => 'RTx::System::Record', object_id => 5 );
ok ($id, "ACL for RTxObj Created");
my $RTxObj2 = {};
Modified: rt/branches/3.999-DANGEROUS/t/api/user.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/user.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/user.t Mon Sep 1 19:53:48 2008
@@ -87,7 +87,7 @@
ok(my $u = RT::Model::User->new(current_user => RT->system_user));
ok($u->load(1), "Loaded the first user");
-is($u->principal_object->principal_type, 'User' , "Principal 1 is a user, not a group");
+is($u->principal_object->type, 'User' , "Principal 1 is a user, not a group");
}
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 Mon Sep 1 19:53:48 2008
@@ -27,7 +27,7 @@
*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 => $group->id, principal_type => 'Group', right_name => 'RTxUserright', object_type => 'RTx::System', object_id => 1 );
+($id, $msg) = $ace->RT::Record::create( principal_id => $group->id, type => 'Group', right_name => 'RTxUserright', object_type => 'RTx::System', object_id => 1 );
ok ($id, "ACL for RTxSysObj Created");
my $RTxObj = {};
@@ -48,7 +48,7 @@
is($users->count, 1, "RTxUserright found for RTxObj using equiv_objects");
$ace = RT::Model::ACE->new(current_user => RT->system_user);
-($id, $msg) = $ace->RT::Record::create( principal_id => $group->id, principal_type => 'Group', right_name => 'RTxUserright', object_type => 'RTx::System::Record', object_id => 5 );
+($id, $msg) = $ace->RT::Record::create( principal_id => $group->id, type => 'Group', right_name => 'RTxUserright', object_type => 'RTx::System::Record', object_id => 5 );
ok ($id, "ACL for RTxObj Created");
my $RTxObj2 = {};
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 Mon Sep 1 19:53:48 2008
@@ -112,7 +112,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'ShowConfigTab',
object => RT->system,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g2->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -200,7 +200,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'AdminGroup',
object => $pg1,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g2->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -284,7 +284,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'AdminGroup',
object => $pg1,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g2->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -386,7 +386,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'ShowConfigTab',
object => RT->system,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g2->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -443,7 +443,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'DelegateRights',
object => RT->system,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g1->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -460,7 +460,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'ShowConfigTab',
object => RT->system,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g2->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -496,7 +496,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'DelegateRights',
object => RT->system,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g1->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -507,7 +507,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'ShowConfigTab',
object => RT->system,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g2->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -534,7 +534,7 @@
= RT::Model::ACECollection->new( current_user => RT->system_user );
foreach (@principals) {
$acl->limit_to_principal(
- type => $$_->principal_object->principal_type,
+ type => $$_->principal_object->type,
id => $$_->principal_object->id
);
}
Modified: rt/branches/3.999-DANGEROUS/t/delegation/revocation.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/delegation/revocation.t (original)
+++ rt/branches/3.999-DANGEROUS/t/delegation/revocation.t Mon Sep 1 19:53:48 2008
@@ -56,7 +56,7 @@
( $ret, $msg ) = $ace->load_by_values(
right_name => 'ShowConfigTab',
object => RT->system,
- principal_type => 'Group',
+ type => 'Group',
principal_id => $g1->principal_id
);
ok( $ret, "Look up ACE to be delegated: $msg" );
@@ -112,7 +112,7 @@
# Revoke all rights granted to our cast
my $acl = RT::Model::ACECollection->new(current_user => RT->system_user);
foreach (@principals) {
- $acl->limit_to_principal(type => $$_->principal_object->principal_type,
+ $acl->limit_to_principal(type => $$_->principal_object->type,
id => $$_->principal_object->id);
}
while (my $ace = $acl->next()) {
More information about the Rt-commit
mailing list