[Rt-commit] rt branch, 4.4-trunk, updated. rt-4.4.4-395-gc3563e76c6
? sunnavy
sunnavy at bestpractical.com
Wed Apr 28 14:19:58 EDT 2021
The branch, 4.4-trunk has been updated
via c3563e76c6e23a6de9a168d7d756002839f8d273 (commit)
via 7f044a8fc5d276b8c6c50e8dce3252251f6b1864 (commit)
via fda000abd117d24aecca112e9b550bedafb38eba (commit)
from a887a67d2334896ed1d07553d9207d5a2a785e8c (commit)
Summary of changes:
etc/RT_Config.pm.in | 2 +-
share/html/Admin/Users/index.html | 41 +++++++++++++++++++++++++++++++---
share/html/Elements/RT__User/ColumnMap | 4 ++++
3 files changed, 43 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit fda000abd117d24aecca112e9b550bedafb38eba
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Apr 24 02:53:52 2021 +0800
Add ModifyCollectionListArgs callback to user admin index page
The initial reason is: customization code that adds extra search
parameters can use this callback to pass them to paging URLs
accordingly.
diff --git a/share/html/Admin/Users/index.html b/share/html/Admin/Users/index.html
index 25835324ed..44147e16f3 100644
--- a/share/html/Admin/Users/index.html
+++ b/share/html/Admin/Users/index.html
@@ -104,7 +104,8 @@ jQuery(function(){
% } else {
<p><&|/l&>Select a user</&>:</p>
-<& /Elements/CollectionList,
+<%perl>
+my %collection_list_args = (
OrderBy => 'Name',
Order => 'ASC',
Rows => $Rows,
@@ -113,7 +114,11 @@ jQuery(function(){
Collection => $users,
AllowSorting => 1,
PassArguments => [qw(Format Rows Page Order OrderBy UserString UserOp UserField UserString2 UserOp2 UserField2 UserString3 UserOp3 UserField3 IdLike EmailLike FindDisabledUsers)],
-&>
+);
+</%perl>
+
+% $m->callback( %ARGS, UsersObj => $users, CallbackName => 'ModifyCollectionListArgs', CollectionListArgs => \%collection_list_args );
+<& /Elements/CollectionList, %collection_list_args &>
% }
commit 7f044a8fc5d276b8c6c50e8dce3252251f6b1864
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Apr 12 17:16:10 2021 -0400
Add callbacks to user admin index page
These allow a developer to add a custom component to the
form and then act on it in the init section.
diff --git a/share/html/Admin/Users/index.html b/share/html/Admin/Users/index.html
index 44147e16f3..326afb75d6 100644
--- a/share/html/Admin/Users/index.html
+++ b/share/html/Admin/Users/index.html
@@ -95,6 +95,8 @@ jQuery(function(){
</table>
<input type="checkbox" class="checkbox" id="FindDisabledUsers" name="FindDisabledUsers" value="1" <% $FindDisabledUsers? 'checked="checked"': '' %> />
<label for="FindDisabledUsers"><&|/l&>Include disabled users in search.</&></label>
+% $m->callback( %ARGS, UsersObj => $users, CallbackName => 'InUsersAdminForm' );
+
<br />
<div align="right"><input type="submit" class="button" value="<&|/l&>Go!</&>" name="Go" /></div>
</form>
@@ -127,6 +129,8 @@ my $caption;
my $users = RT::Users->new( $session{'CurrentUser'} );
$users->FindAllRows if $FindDisabledUsers;
+$m->callback( UsersObj => $users, ARGSRef => \%ARGS, CallbackName => 'Initial' );
+
$caption = loc("Users matching search criteria");
my @users_queries = ();
push @users_queries, { field => $UserField, op => $UserOp, string => $UserString } if length $UserString;
commit c3563e76c6e23a6de9a168d7d756002839f8d273
Author: Jim Brandt <jbrandt at bestpractical.com>
Date: Mon Apr 12 17:09:49 2021 -0400
Provide a way to select privileged and unprivileged users in admin
It's a common confusion that the user admin page, by default,
shows only privileged users. When you search, you can get
unprivileged users in results, which can also be a bit
confusing.
Add a dropdown to allow the admin to explicitly select the
set of users they want to see. It defaults to privileged, which
was the previous behavior.
Also add the system group to search results so it is clear which
system group each user is in.
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 85b04929df..cf7647571f 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -4030,7 +4030,7 @@ Set(%AdminSearchResultFormat,
Users =>
q{'<a href="__WebPath__/Admin/Users/Modify.html?id=__id__">__id__</a>/TITLE:#'}
.q{,'<a href="__WebPath__/Admin/Users/Modify.html?id=__id__">__Name__</a>/TITLE:Name'}
- .q{,__RealName__, __EmailAddress__,__Disabled__},
+ .q{,__RealName__, __EmailAddress__,__SystemGroup__,__Disabled__},
CustomFields =>
q{'<a href="__WebPath__/Admin/CustomFields/Modify.html?id=__id__">__id__</a>/TITLE:#'}
diff --git a/share/html/Admin/Users/index.html b/share/html/Admin/Users/index.html
index 326afb75d6..5aa84be490 100644
--- a/share/html/Admin/Users/index.html
+++ b/share/html/Admin/Users/index.html
@@ -75,6 +75,22 @@ jQuery(function(){
<input type="hidden" name="<% $field %>" value="<% $ARGS{ $field } %>" />
% }
<table>
+ <tr>
+ <td>
+ <&|/l&>Include</&>
+ <select name="IncludeSystemGroups">
+% my $group_selected;
+% for my $group_value ( qw(Privileged Unprivileged All) ) {
+% $group_selected = '';
+% if ( $group_value eq $IncludeSystemGroups ) {
+% $group_selected = 'selected="selected"';
+% }
+ <option value="<% $group_value %>" <% $group_selected |n %>><% loc($group_value) %></option>
+% }
+ </select>
+ </div>
+ </tr>
+
<tr><td><&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS, Fields => \@fields &></td></tr>
<tr><td><&|/l&>And all users whose</&> <& /Elements/SelectUsers, %ARGS, Fields => \@fields,
SelectFieldName => 'UserField2',
@@ -168,10 +184,19 @@ if ( scalar @users_queries ) {
RT::Interface::Web::Redirect(RT->Config->Get('WebURL')."Admin/Users/Modify.html?id=".$users->First->id)
if $users->Count == 1;
}
-else {
+
+if ( $IncludeSystemGroups eq 'Privileged' ) {
$caption = loc("Privileged users");
$users->LimitToPrivileged;
}
+elsif ( $IncludeSystemGroups eq 'Unprivileged' ) {
+ $caption = loc("Unprivileged users");
+ $users->LimitToUnprivileged;
+}
+else {
+ # Must be all
+ $caption = loc("All users");
+}
$Format ||= RT->Config->Get('AdminSearchResultFormat')->{'Users'};
my $Rows = RT->Config->Get('AdminSearchResultRows')->{'Users'} || 50;
@@ -216,4 +241,5 @@ $IdLike => undef
$EmailLike => undef
$FindDisabledUsers => 0
+$IncludeSystemGroups => 'Privileged'
</%ARGS>
diff --git a/share/html/Elements/RT__User/ColumnMap b/share/html/Elements/RT__User/ColumnMap
index b4c0aefbf8..694beb8da6 100644
--- a/share/html/Elements/RT__User/ColumnMap
+++ b/share/html/Elements/RT__User/ColumnMap
@@ -151,6 +151,10 @@ my $COLUMN_MAP = {
attribute => 'Timezone',
value => sub { return $_[0]->Timezone },
},
+ SystemGroup => {
+ title => 'System Group', # loc
+ value => sub { return $_[0]->Privileged ? $_[0]->loc('Privileged'): $_[0]->loc('Unprivileged') },
+ },
};
</%ONCE>
-----------------------------------------------------------------------
More information about the rt-commit
mailing list