[rt-commit] [svn] r615 - rt/branches/rt-3.1/lib/RT
leira at fsck.com
leira at fsck.com
Wed Mar 24 16:22:31 EST 2004
Author: leira
Date: Wed Mar 24 16:22:30 2004
New Revision: 615
Modified:
rt/branches/rt-3.1/lib/RT/Attachments_Overlay.pm
rt/branches/rt-3.1/lib/RT/Transactions_Overlay.pm
Log:
Add a Next method that checks ACLs, so that we don't need to do it in the UI.
Modified: rt/branches/rt-3.1/lib/RT/Attachments_Overlay.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Attachments_Overlay.pm (original)
+++ rt/branches/rt-3.1/lib/RT/Attachments_Overlay.pm Wed Mar 24 16:22:30 2004
@@ -109,6 +109,34 @@
return($item);
}
# }}}
+
+# {{{ sub Next
+sub Next {
+ my $self = shift;
+
+ my $Attachment = $self->SUPER::Next();
+ if ((defined($Attachment)) and (ref($Attachment))) {
+ if ($Attachment->TransactionObj->__Value('Type') =~ /^Comment/ &&
+ $Attachment->TransactionObj->TicketObj->CurrentUserHasRight('ShowTicketComments')) {
+ return($Attachment);
+ } elsif ($Attachment->TransactionObj->__Value('Type') !~ /^Comment/ &&
+ $Attachment->TransactionObj->TicketObj->CurrentUserHasRight('ShowTicket')) {
+ return($Attachment);
+ }
+
+ #If the user doesn't have the right to show this ticket
+ else {
+ return($self->Next());
+ }
+ }
+
+ #if there never was any ticket
+ else {
+ return(undef);
+ }
+}
+# }}}
+
1;
Modified: rt/branches/rt-3.1/lib/RT/Transactions_Overlay.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Transactions_Overlay.pm (original)
+++ rt/branches/rt-3.1/lib/RT/Transactions_Overlay.pm Wed Mar 24 16:22:30 2004
@@ -62,6 +62,33 @@
}
# }}}
+# {{{ sub Next
+sub Next {
+ my $self = shift;
+
+ my $Transaction = $self->SUPER::Next();
+ if ((defined($Transaction)) and (ref($Transaction))) {
+ if ($Transaction->__Value('Type') =~ /^Comment/ &&
+ $Transaction->TicketObj->CurrentUserHasRight('ShowTicketComments')) {
+ return($Transaction);
+ } elsif ($Transaction->__Value('Type') !~ /^Comment/ &&
+ $Transaction->TicketObj->CurrentUserHasRight('ShowTicket')) {
+ return($Transaction);
+ }
+
+ #If the user doesn't have the right to show this ticket
+ else {
+ return($self->Next());
+ }
+ }
+
+ #if there never was any ticket
+ else {
+ return(undef);
+ }
+}
+# }}}
+
=head2 example methods
Queue RT::Queue or Queue Id
More information about the Rt-commit
mailing list