Commit d067fb0f authored by Alex Vandiver's avatar Alex Vandiver
Browse files

Dependencies

parent f5dd83f8
......@@ -744,6 +744,16 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->PrincipalObj->Object );
$deps->Add( out => $self->Object );
}
RT::Base->_ImportOverlays();
1;
......@@ -862,6 +862,15 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->ClassObj );
$deps->Add( in => $self->Topics );
}
RT::Base->_ImportOverlays();
1;
......
......@@ -1035,6 +1035,14 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->TransactionObj );
}
RT::Base->_ImportOverlays();
1;
......@@ -627,6 +627,14 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->Object );
}
RT::Base->_ImportOverlays();
1;
......@@ -616,6 +616,48 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
my $articles = RT::Articles->new( $self->CurrentUser );
$articles->Limit( FIELD => "Class", VALUE => $self->Id );
$deps->Add( in => $articles );
my $topics = RT::Topics->new( $self->CurrentUser );
$topics->LimitToObject( $self );
$deps->Add( in => $topics );
my $objectclasses = RT::ObjectClasses->new( $self->CurrentUser );
$objectclasses->LimitToClass( $self->Id );
$deps->Add( in => $topics );
# Custom Fields on things _in_ this class (CFs on the class itself
# have already been dealt with)
my $ocfs = RT::ObjectCustomFields->new( $self->CurrentUser );
$ocfs->Limit( FIELD => 'ObjectId',
OPERATOR => '=',
VALUE => $self->id,
ENTRYAGGREGATOR => 'OR' );
$ocfs->Limit( FIELD => 'ObjectId',
OPERATOR => '=',
VALUE => 0,
ENTRYAGGREGATOR => 'OR' );
my $cfs = $ocfs->Join(
ALIAS1 => 'main',
FIELD1 => 'CustomField',
TABLE2 => 'CustomFields',
FIELD2 => 'id',
);
$ocfs->Limit( ALIAS => $cfs,
FIELD => 'LookupType',
OPERATOR => 'STARTSWITH',
VALUE => 'RT::Class-' );
$deps->Add( in => $ocfs );
}
RT::Base->_ImportOverlays();
1;
......
......@@ -1988,6 +1988,22 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->BasedOnObj )
if $self->BasedOnObj->id;
my $applied = RT::ObjectCustomFields->new( $self->CurrentUser );
$applied->LimitToCustomField( $self->id );
$deps->Add( in => $applied );
$deps->Add( in => $self->Values ) if $self->ValuesClass eq "RT::CustomFieldValues";
}
RT::Base->_ImportOverlays();
......
......@@ -329,6 +329,14 @@ sub _CoreAccessible {
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->CustomFieldObj );
}
RT::Base->_ImportOverlays();
......
......@@ -1209,6 +1209,24 @@ sub PrincipalId {
return $self->Id;
}
sub InstanceObj {
my $self = shift;
my $class;
if ( $self->Domain eq 'ACLEquivalence' ) {
$class = "RT::User";
} elsif ($self->Domain eq 'RT::Queue-Role') {
$class = "RT::Queue";
} elsif ($self->Domain eq 'RT::Ticket-Role') {
$class = "RT::Ticket";
}
return unless $class;
my $obj = $class->new( $self->CurrentUser );
$obj->Load( $self->Instance );
return $obj;
}
sub BasicColumns {
(
......@@ -1395,6 +1413,28 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
my $instance = $self->InstanceObj;
$deps->Add( out => $instance ) if $instance;
# Group members records, unless we're a system group
if ($self->Domain ne "SystemInternal") {
my $objs = RT::GroupMembers->new( $self->CurrentUser );
$objs->LimitToMembersOfGroup( $self->PrincipalId );
$deps->Add( in => $objs );
}
# Group member records group belongs to
my $objs = RT::GroupMembers->new( $self->CurrentUser );
$objs->Limit( FIELD => 'MemberId', VALUE => $self->PrincipalId );
$deps->Add( in => $objs );
}
RT::Base->_ImportOverlays();
1;
......@@ -487,6 +487,16 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->GroupObj->Object );
$deps->Add( out => $self->MemberObj->Object );
}
RT::Base->_ImportOverlays();
1;
......@@ -446,6 +446,16 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->BaseObj ) if $self->BaseObj and $self->BaseObj->id;
$deps->Add( out => $self->TargetObj ) if $self->TargetObj and $self->TargetObj->id;
}
RT::Base->_ImportOverlays();
1;
......@@ -216,6 +216,19 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->ClassObj );
my $obj = $self->ObjectType->new( $self->CurrentUser );
$obj->Load( $self->ObjectId );
$deps->Add( out => $obj );
}
RT::Base->_ImportOverlays();
......
......@@ -407,6 +407,20 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->CustomFieldObj );
my $class = $self->CustomFieldObj->RecordClassFromLookupType;
my $obj = $class->new( $self->CurrentUser );
$obj->Load( $self->ObjectId );
$deps->Add( out => $obj );
}
RT::Base->_ImportOverlays();
1;
......@@ -751,6 +751,16 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->CustomFieldObj );
$deps->Add( out => $self->Object );
}
RT::Base->_ImportOverlays();
1;
......@@ -209,6 +209,19 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->TopicObj );
my $obj = $self->ObjectType->new( $self->CurrentUser );
$obj->Load( $self->ObjectId );
$deps->Add( out => $obj );
}
RT::Base->_ImportOverlays();
1;
......@@ -1537,6 +1537,58 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
# Queue role groups( Cc, AdminCc )
my $objs = RT::Groups->new( $self->CurrentUser );
$objs->Limit( FIELD => 'Domain', VALUE => 'RT::Queue-Role' );
$objs->Limit( FIELD => 'Instance', VALUE => $self->Id );
$deps->Add( in => $objs );
# Scrips
$objs = RT::Scrips->new( $self->CurrentUser );
$objs->LimitToQueue( $self->id );
$deps->Add( in => $objs );
# Templates (global ones have already been dealt with)
$objs = RT::Templates->new( $self->CurrentUser );
$objs->Limit( FIELD => 'Queue', VALUE => $self->Id);
$deps->Add( in => $objs );
# Custom Fields on things _in_ this queue (CFs on the queue itself
# have already been dealt with)
$objs = RT::ObjectCustomFields->new( $self->CurrentUser );
$objs->Limit( FIELD => 'ObjectId',
OPERATOR => '=',
VALUE => $self->id,
ENTRYAGGREGATOR => 'OR' );
$objs->Limit( FIELD => 'ObjectId',
OPERATOR => '=',
VALUE => 0,
ENTRYAGGREGATOR => 'OR' );
my $cfs = $objs->Join(
ALIAS1 => 'main',
FIELD1 => 'CustomField',
TABLE2 => 'CustomFields',
FIELD2 => 'id',
);
$objs->Limit( ALIAS => $cfs,
FIELD => 'LookupType',
OPERATOR => 'STARTSWITH',
VALUE => 'RT::Queue-' );
$deps->Add( in => $objs );
# Tickets
$objs = RT::Tickets->new( $self->CurrentUser );
$objs->Limit( FIELD => 'Queue', VALUE => $self->Id );
$objs->{allow_deleted_search} = 1;
$deps->Add( in => $objs );
}
RT::Base->_ImportOverlays();
......
......@@ -994,6 +994,18 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->ScripConditionObj );
$deps->Add( out => $self->ScripActionObj );
$deps->Add( out => $self->QueueObj );
$deps->Add( out => $self->TemplateObj );
}
RT::Base->_ImportOverlays();
1;
......@@ -943,6 +943,15 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->QueueObj );
}
RT::Base->_ImportOverlays();
1;
......@@ -4175,6 +4175,41 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
# Links
my $links = RT::Links->new( $self->CurrentUser );
$links->Limit(
SUBCLAUSE => "either",
FIELD => $_,
VALUE => $self->URI,
ENTRYAGGREGATOR => 'OR'
) for qw/Base Target/;
$deps->Add( in => $links );
# Tickets which were merged in
my $objs = RT::Tickets->new( $self->CurrentUser );
$objs->Limit( FIELD => 'EffectiveId', VALUE => $self->Id );
$objs->Limit( FIELD => 'id', OPERATOR => '!=', VALUE => $self->Id );
$deps->Add( in => $objs );
# Ticket role groups( Owner, Requestors, Cc, AdminCc )
$objs = RT::Groups->new( $self->CurrentUser );
$objs->Limit( FIELD => 'Domain', VALUE => 'RT::Ticket-Role' );
$objs->Limit( FIELD => 'Instance', VALUE => $self->Id );
$deps->Add( in => $objs );
# Queue
$deps->Add( out => $self->QueueObj );
# Owner
$deps->Add( out => $self->OwnerObj );
}
RT::Base->_ImportOverlays();
1;
......@@ -372,5 +372,18 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->ParentObj );
$deps->Add( in => $self->Children );
my $obj = $self->ObjectType->new( $self->CurrentUser );
$obj->Load( $self->ObjectId );
$deps->Add( out => $obj );
}
RT::Base->_ImportOverlays();
1;
......@@ -1608,6 +1608,59 @@ sub _CoreAccessible {
}
};
sub Dependencies {
my $self = shift;
my ($walker, $deps) = @_;
$self->SUPER::Dependencies($walker, $deps);
$deps->Add( out => $self->Object );
$deps->Add( in => $self->Attachments );
my $type = $self->Type;
if ($type eq "CustomField") {
my $cf = RT::CustomField->new( RT->SystemUser );
$cf->Load( $self->Field );
$deps->Add( out => $cf );
} elsif ($type =~ /^(Take|Untake|Force|Steal|Give)$/) {
for my $field (qw/OldValue NewValue/) {
my $user = RT::User->new( RT->SystemUser );
$user->Load( $self->$field );
$deps->Add( out => $user );
}
} elsif ($type eq "DelWatcher") {
my $principal = RT::Principal->new( RT->SystemUser );
$principal->Load( $self->OldValue );
$deps->Add( out => $principal->Object );
} elsif ($type eq "AddWatcher") {
my $principal = RT::Principal->new( RT->SystemUser );
$principal->Load( $self->NewValue );
$deps->Add( out => $principal->Object );
} elsif ($type eq "DeleteLink") {
if ($self->OldValue) {
my $base = RT::URI->new( $self->CurrentUser );
$base->FromURI( $self->OldValue );
$deps->Add( out => $base->Object ) if $base->Resolver and $base->Object;
}
} elsif ($type eq "AddLink") {
if ($self->NewValue) {
my $base = RT::URI->new( $self->CurrentUser );
$base->FromURI( $self->NewValue );
$deps->Add( out => $base->Object ) if $base->Resolver and $base->Object;
}
} elsif ($type eq "Set" and $self->Field eq "Queue") {
for my $field (qw/OldValue NewValue/) {
my $queue = RT::Queue->new( RT->SystemUser );
$queue->Load( $self->$field );
$deps->Add( out => $queue );
}
} elsif ($type =~ /^(Add|Open|Resolve)Reminder$/) {
my $ticket = RT::Ticket->new( RT->SystemUser );
$ticket->Load( $self->NewValue );
$deps->Add( out => $ticket );
}
}
RT::Base->_ImportOverlays();
1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment