projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rt 4.0.23
[freeside.git]
/
rt
/
lib
/
RT
/
Groups.pm
diff --git
a/rt/lib/RT/Groups.pm
b/rt/lib/RT/Groups.pm
index
46f1c23
..
576c99d
100755
(executable)
--- a/
rt/lib/RT/Groups.pm
+++ b/
rt/lib/RT/Groups.pm
@@
-2,7
+2,7
@@
#
# COPYRIGHT:
#
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-201
2
Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-201
5
Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@
-234,10
+234,21
@@
sub WithMember {
ALIAS2 => $members, FIELD2 => 'GroupId');
$self->Limit(ALIAS => $members, FIELD => 'MemberId', OPERATOR => '=', VALUE => $args{'PrincipalId'});
ALIAS2 => $members, FIELD2 => 'GroupId');
$self->Limit(ALIAS => $members, FIELD => 'MemberId', OPERATOR => '=', VALUE => $args{'PrincipalId'});
+ $self->Limit(ALIAS => $members, FIELD => 'Disabled', VALUE => 0)
+ if $args{'Recursively'};
return $members;
}
return $members;
}
+sub WithCurrentUser {
+ my $self = shift;
+ $self->{with_current_user} = 1;
+ return $self->WithMember(
+ PrincipalId => $self->CurrentUser->PrincipalId,
+ Recursively => 1,
+ );
+}
+
sub WithoutMember {
my $self = shift;
my %args = (
sub WithoutMember {
my $self = shift;
my %args = (
@@
-261,6
+272,12
@@
sub WithoutMember {
VALUE => $args{'PrincipalId'},
);
$self->Limit(
VALUE => $args{'PrincipalId'},
);
$self->Limit(
+ LEFTJOIN => $members_alias,
+ ALIAS => $members_alias,
+ FIELD => 'Disabled',
+ VALUE => 0
+ ) if $args{'Recursively'};
+ $self->Limit(
ALIAS => $members_alias,
FIELD => 'MemberId',
OPERATOR => 'IS',
ALIAS => $members_alias,
FIELD => 'MemberId',
OPERATOR => 'IS',
@@
-384,7
+401,7
@@
sub ForWhichCurrentUserHasRight {
=head2 LimitToEnabled
=head2 LimitToEnabled
-Only find items that haven
\
't been disabled
+Only find items that haven't been disabled
=cut
=cut
@@
-419,22
+436,16
@@
sub LimitToDeleted {
-sub
Next
{
+sub
AddRecord
{
my $self = shift;
my $self = shift;
+ my ($record) = @_;
- # Don't show groups which the user isn't allowed to see.
+ # If we've explicitly limited to groups the user is a member of (for
+ # dashboard or savedsearch privacy objects), skip the ACL.
+ return unless $self->{with_current_user}
+ or $record->CurrentUserHasRight('SeeGroup');
- my $Group = $self->SUPER::Next();
- if ((defined($Group)) and (ref($Group))) {
- unless ($Group->CurrentUserHasRight('SeeGroup')) {
- return $self->Next();
- }
-
- return $Group;
- }
- else {
- return undef;
- }
+ return $self->SUPER::AddRecord( $record );
}
}
@@
-442,7
+453,7
@@
sub Next {
sub _DoSearch {
my $self = shift;
sub _DoSearch {
my $self = shift;
- #unless we really want to find disabled rows, make sure we
\
're only finding enabled ones.
+ #unless we really want to find disabled rows, make sure we're only finding enabled ones.
unless($self->{'find_disabled_rows'}) {
$self->LimitToEnabled();
}
unless($self->{'find_disabled_rows'}) {
$self->LimitToEnabled();
}