Skip to content

Commit

Permalink
Update document for saved search and dashboard changes
Browse files Browse the repository at this point in the history
@ObjectContents is intentionally not documented because users are not
supposed to use it directly.
  • Loading branch information
sunnavy committed Nov 12, 2024
1 parent 57d46b8 commit 8ac6bfc
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 23 deletions.
32 changes: 32 additions & 0 deletions docs/UPGRADING-6.0
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,38 @@ something similar.

=item *

Saved searches, dashboards, and dashboard subscriptions have been refactored
to use their own tables(instead of "Attributes"). Previously they can be
simply deleted, now you can disable them instead.

Related rights have also been tweaked:

=over

=item *

SeeSavedSearch/SeeDashboard and AdminSavedSearch/AdminDashboard are to see
and manage *global* saved searches and dashboards.

=item *

SeeGroupSavedSearch/SeeGroupDashboard and
AdminGroupSavedSearch/AdminGroupDashboard are to see and manage *group*
saved searches and dashboards.

=item *

SeeOwnSavedSearch/SeeOwnDashboard and AdminOwnSavedSearch/AdminOwnDashboard
are to see and manage user's *own* saved searches and dashboards.

=back

Since default saved searches(C<My Tickets>, C<Unowned Tickets>, and
C<Bookmarked tickets>) now are plain system saved searches, we grant all
privileged users C<SeeSavedSearch> so they can see these searches as before.

=item *

The following dependent libraries are updated to the new versions listed
below in RT 6:

Expand Down
14 changes: 7 additions & 7 deletions docs/dashboards.pod
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,16 @@ Privileged, or to groups you define.

Since dashboards rely on saved searches, you need to grant "Allow loading of
saved searches" (LoadSavedSearch) for users to see the searches. You may want
to also grant "Allow creation of saved searches" (CreateSavedSearch) to allow
users to create their own and "View saved searches" (ShowSavedSearches)
to also grant "Create, update and delete personal saved searches"
(AdminOwnSavedSearch) to allow users to create their own and "View personal
saved searches" (SeeOwnSavedSearch).

For dashboards themselves, there are See, Create, Modify, and Delete rights for
For dashboards themselves, there are See and Admin rights for
each of personal, group, and system dashboards. This allows you to select the
right combination of rights for users and groups on your system. For
subscriptions, there is a "Subscribe to dashboards" (SubscribeDashboard) right.

If you just want to allow users to create dashboards so they can customize
their homepage, grant "ModifySelf", "SeeOwnDashboard", "ModifyOwnDashboard" and
"DeleteOwnDashboard". All users can select the current default System dashboard
and set it as their homepage. To allow users to see other System dashboards,
grant "SeeDashboard".
their homepage, grant "ModifySelf", "SeeOwnDashboard", and "AdminOwnDashboard".
All users can select the current default System dashboard and set it as their
homepage.
133 changes: 125 additions & 8 deletions docs/initialdata.pod
Original file line number Diff line number Diff line change
Expand Up @@ -467,18 +467,18 @@ documentation of L<RT::ScripCondition/Create> for the fields you can use.
Creates a new L<RT::Template> for each hashref. Refer to the documentation of
L<RT::Template/Create> for the fields you can use.

=head2 C<@Attributes>

An array of L<RT::Attribute>s to create. You likely don't need to mess with
this. If you do, know that the key C<Object> is expected to be an
L<RT::Record> object or a subroutine reference that returns an object on which
to call C<AddAttribute>. If you don't provide C<Object> or it's undefined,
C<< RT->System >> will be used.
=head2 C<@SavedSearches>

Create a new L<RT::SavedSearch> for each hashref.

C<Object> is expected to be an L<RT::Record> object or a subroutine reference
that returns an object the saved search is created for.

Here is an example of using a subroutine reference as a value for Object:

@Attributes = ({
Name => 'SavedSearch',
@SavedSearches = ({
Name => 'New Tickets in SomeQueue',
Description => 'New Tickets in SomeQueue',
Object => sub {
my $GroupName = 'SomeQueue Group';
Expand All @@ -499,6 +499,123 @@ Here is an example of using a subroutine reference as a value for Object:
},
});

Alternatively, you can specify C<ObjectType> and C<ObjectId>:

@SavedSearches = ({
Name => 'New Tickets in SomeQueue',
Description => 'New Tickets in SomeQueue',
ObjectType => 'RT::Group',
ObjectId => 'SomeQueue Group',
Content => {
Format => <<' END_OF_FORMAT',
....
END_OF_FORMAT
Query => "Status = 'new' AND Queue = 'SomeQueue'",
OrderBy => 'id',
Order => 'DESC'
},
});

If both C<Object> and C<ObjectType>/C<ObjectId> are not set, C<< RT->System >>
will be used.


=head2 C<@Dashboards>

Create a new L<RT::Dashboard> for each hashref.

@Dashboards = ({
Name => 'Tickets pending inspection',
Description => 'Tickets pending inspection',
Object => sub {
my $GroupName = 'SomeQueue Group';
my $group = RT::Group->new( RT->SystemUser );

my( $ret, $msg ) = $group->LoadUserDefinedGroup( $GroupName );
die $msg unless $ret;

return $group;
},
Content => {
Elements => [
{
Layout => 'col-md-12',
Elements => [
[
{
portlet_type => 'search',
id => 1,
description => "Ticket: My Tickets",
},
{
portlet_type => 'search',
id => 2,
description => "Ticket: Unowned Tickets",
},
],
],
}
],
},
});

=head2 C<@DashboardSubscriptions>

Create a new L<RT::DashboardSubscription> for each hashref.

@DashboardSubscriptions = (
{
UserId => 14,
DashboardId => {
ObjectType => 'RT::User',
ObjectId => 14,
Name => 'My Dashboard',
},
Content => {
'Context' => 'subscriber',
'Counter' => 0,
'Dom' => '1',
'Dow' => 'Monday',
'Fow' => '1',
'Frequency' => 'daily',
'Friday' => '1',
'Hour' => '06:00',
'Language' => '',
'Monday' => '1',
'Recipients' => {
'Groups' => [],
'Users' => ['14']
},
'Rows' => '20',
'Saturday' => undef,
'Sunday' => undef,
'SuppressIfEmpty' => undef,
'Thursday' => '1',
'Tuesday' => '1',
'Wednesday' => '1'
},
},
);

=head2 C<@Attributes>

Create a new L<RT::Attribute> for each hashref. You likely don't need to mess
with this.

Here is an example to customize a user's default dashboard:

@Attributes = ({
Name => 'Pref-DefaultDashboard',
Description => '',
ObjectType => 'RT::User',
ObjectId => 'alice',
Content => {
ObjectType => 'RT::System',
ObjectId => 1,
Name => 'Another Homepage',
},
});

=head2 C<@Initial>

See C<@Final> below.
Expand Down
15 changes: 7 additions & 8 deletions docs/query_builder.pod
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ quickly reload these in the Query Builder, you can also use saved searches
when building dashboards (see L<Dashboard and Reports|docs/dashboards_reporting.pod>).

There are several rights that manage access to saved searches, so some users may
not see this section initially. The global rights "ShowSavedSearches", "CreateSavedSearch",
"LoadSavedSearch", and "EditSavedSearches" can be granted to allow users to
interact with saved searches (Admin > Global > Group Rights).
not see this section initially. The global rights "SeeSavedSearch"
and "LoadSavedSearch" can be granted to allow users to interact with saved searches
(Admin > Global > Group Rights).

Saved searches have a Privacy setting, which controls which other users can load
the saved search. The privacy setting controls only the saved search itself and
Expand All @@ -445,16 +445,15 @@ search, if they don't have rights to some tickets in that search, they won't
see those tickets.

"My saved searches" are just for you (the logged in user) and they can't be
seen by other users. You need to grant the ModifySelf right in addition to the
saved search rights above to allow users to save these.
seen by other users. You need to grant the SeeOwnSavedSearch and
AdminOwnSavedSearch rights to allow users to save these.

"RT System's saved searches" are system-wide searches and can only be created
and updated by users with the SuperUser right. They can be used for dashboards,
but only SuperUsers can view and load them on the Query Builder page.
and updated by users with the AdminSavedSearch right.

Saved searches can also be scoped to groups. To set up rights for group-level
saved searches, find the group (Admin > Groups), then click on the Group Rights
option in the submenu. You can grant "ShowSavedSearches" and "EditSavedSearch"
option in the submenu. You can grant "SeeGroupSavedSearch" and "AdminGroupSavedSearch"
to group members, including members of the same group you are viewing. Once
added, members of that group can then load or save searches with the Privacy
set to the group. You must be in a group for it to appear in the Privacy menu,
Expand Down

0 comments on commit 8ac6bfc

Please sign in to comment.