[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.4-528-g40f8a7de3d
Jim Brandt
jbrandt at bestpractical.com
Thu Jun 10 10:23:54 EDT 2021
The branch, 4.4-trunk has been updated
via 40f8a7de3d6c6534b97e4cb43659b02d519f15d9 (commit)
via 0c7a60e26880c248c8ea5ae49d3949ca7018e9e6 (commit)
via 0d8c8b5306edf657edc9c17ff3e0a7c079985f14 (commit)
via f420227f0d1099056f64cdd9c64823cf104fc39b (commit)
from 759a60cf8cfa6e6c9278b38488294616ab4e6b76 (commit)
Summary of changes:
docs/query_builder.pod | 16 +++++++++++++++
lib/RT/SearchBuilder/Role/Roles.pm | 42 ++++++++++++++++++++++++++++----------
t/ticket/search_by_watcher_group.t | 17 +++++++++++++--
3 files changed, 62 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 0c7a60e26880c248c8ea5ae49d3949ca7018e9e6
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Jun 10 10:05:06 2021 -0400
Document custom role group search
diff --git a/docs/query_builder.pod b/docs/query_builder.pod
index 90f9f65822..6a40047eab 100644
--- a/docs/query_builder.pod
+++ b/docs/query_builder.pod
@@ -162,6 +162,22 @@ this search:
the results will contain that ticket.
+You can also search for group names on roles. For core roles, you can
+select from the dropdown with group names containing "Owner Group", etc.
+Following the example above, if you wanted to find tickets with
+the Helpdesk group assigned to the AdminCc role, you can use this search:
+
+ AdminCCGroup = 'Helpdesk'
+
+You can also search for groups on custom roles using the Name value.
+A search for a group on a custom role looks like:
+
+ CustomRole.{Department}.Name = 'Helpdesk'
+
+Note that if you also have a user with the name 'Helpdesk', the custom
+role search will return all matches, so you will see tickets with both
+username 'Helpdesk' and the group 'Helpdesk' assigned.
+
=head2 Shallow Searches
In some cases you may want to see tickets only when the user you are
commit 40f8a7de3d6c6534b97e4cb43659b02d519f15d9
Merge: 759a60cf8c 0c7a60e268
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Thu Jun 10 10:05:25 2021 -0400
Merge branch '4.4/search-watcher-by-group-name' into 4.4-trunk
diff --cc lib/RT/SearchBuilder/Role/Roles.pm
index 6050d648d4,3506d61165..42595ded5a
--- a/lib/RT/SearchBuilder/Role/Roles.pm
+++ b/lib/RT/SearchBuilder/Role/Roles.pm
@@@ -393,18 -412,19 +412,19 @@@ sub RoleLimit
# positive condition case
$group_members ||= $self->_GroupMembersJoin(
- GroupsAlias => $groups, New => 1, Left => 0
+ GroupsAlias => $groups, New => 1,
);
if ($args{FIELD} eq "id") {
- my @ids;
- if ( $is_shallow ) {
- @ids = $args{VALUE};
- }
- else {
- my $groups = RT::Groups->new( RT->SystemUser );
- $groups->LimitToUserDefinedGroups;
- $groups->WithMember( PrincipalId => $args{VALUE}, Recursively => 1 );
- @ids = ( $args{VALUE}, map { $_->id } @{ $groups->ItemsArrayRef } );
+ my @ids = ref $args{VALUE} eq 'ARRAY' ? @{ $args{VALUE} } : $args{VALUE};
+ if ( !$is_shallow ) {
+ my @group_ids;
+ for my $id (@ids) {
+ my $groups = RT::Groups->new( RT->SystemUser );
+ $groups->LimitToUserDefinedGroups;
+ $groups->WithMember( PrincipalId => $id, Recursively => 1 );
+ push @group_ids, map { $_->id } @{ $groups->ItemsArrayRef };
+ }
+ push @ids, @group_ids;
}
# Save a left join to Users, if possible
-----------------------------------------------------------------------
More information about the rt-commit
mailing list