[Bps-public-commit] rt-extension-resetpassword branch, master, updated. 1.11-3-gef1ac7a

? sunnavy sunnavy at bestpractical.com
Wed Apr 28 14:39:49 EDT 2021


The branch, master has been updated
       via  ef1ac7a69af980eac0f6978ef2c6a5e0398c64a1 (commit)
       via  179f57ce9be0de9216a089ae9f4375a03e125f75 (commit)
       via  ea554f11cdacea8a5957af9978236096c873fa93 (commit)
      from  d161837c3acdefa70bf36c4d7bc2239b0c2ba00a (commit)

Summary of changes:
 Changes                                            |  4 ++
 MANIFEST                                           |  3 +
 META.yml                                           |  2 +-
 README                                             | 27 ++++++---
 .../Admin/Users/index.html/InUsersAdminForm        |  6 ++
 .../Users/index.html/ModifyCollectionListArgs      |  6 ++
 lib/RT/Extension/ResetPassword.pm                  | 27 ++++++---
 patches/4-user-admin-callbacks.patch               | 69 ++++++++++++++++++++++
 patches/4.4.4-user-admin-callbacks.patch           | 69 ++++++++++++++++++++++
 patches/user-admin-callbacks.patch                 | 38 ++++++++++++
 10 files changed, 234 insertions(+), 17 deletions(-)
 create mode 100644 html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/ModifyCollectionListArgs
 create mode 100644 patches/4-user-admin-callbacks.patch
 create mode 100644 patches/4.4.4-user-admin-callbacks.patch

- Log -----------------------------------------------------------------
commit ea554f11cdacea8a5957af9978236096c873fa93
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 29 01:42:15 2021 +0800

    Support password set search for RT 4

diff --git a/README b/README
index 876143a..418f408 100644
--- a/README
+++ b/README
@@ -23,11 +23,22 @@ INSTALLATION
         May need root permissions
 
     Install Patches
-        For RT 5.0.0 and 5.0.1 only, apply this patch to enable searches for
-        users with a password set. See below for details.
+        This is to enable searches for users with a password set.
+
+        For RT 5 prior to 5.0.2, apply this:
 
             patch -p1 -d /opt/rt5 < patches/user-admin-callbacks.patch
 
+        For RT 4.4.4, apply this:
+
+            patch -p1 -d /opt/rt4 < patches/4.4.4-user-admin-callbacks.patch
+
+        For RT 4 prior to 4.4.4, apply this:
+
+            patch -p1 -d /opt/rt4 < patches/4-user-admin-callbacks.patch
+
+        See below for details.
+
     make initdb
         Only run this the first time you install this module.
 
@@ -114,12 +125,12 @@ CONFIGURATION
         currently has a password set. The "Delete password" option allows
         you to clear passwords if a user should no longer have access.
 
-        For RT 5 only, this extension also adds a checkbox to the user admin
-        page that allows you to filter users, displaying only those who have
-        a password set. If you disable the $AllowUsersWithoutPassword
-        option, this checkbox allows you to see all users who have an
-        existing password and would therefore be able to reset their
-        password.
+        For RT 4.4 and 5, this extension also adds a checkbox to the user
+        admin page that allows you to filter users, displaying only those
+        who have a password set. If you disable the
+        $AllowUsersWithoutPassword option, this checkbox allows you to see
+        all users who have an existing password and would therefore be able
+        to reset their password.
 
     $CreateNewUserAsPrivileged
         Set this config value to true if users creating a new account should
diff --git a/html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/InUsersAdminForm b/html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/InUsersAdminForm
index aef3798..45a4fb4 100644
--- a/html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/InUsersAdminForm
+++ b/html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/InUsersAdminForm
@@ -1,3 +1,4 @@
+% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') >= 0 ) {
   <div class="form-row">
     <div class="col-12">
       <div class="custom-control custom-checkbox">
@@ -6,3 +7,8 @@
       </div>
     </div>
   </div>
+% } else {
+  <br>
+  <input type="checkbox" class="checkbox" id="FindUsersWithPassword" name="FindUsersWithPassword" value="1" <% $ARGS{FindUsersWithPassword} ? 'checked="checked"': '' %> />
+  <label for="FindUsersWithPassword"><&|/l&>List users with a password set.</&></label>
+% }
diff --git a/lib/RT/Extension/ResetPassword.pm b/lib/RT/Extension/ResetPassword.pm
index c7a56c5..bc811a7 100644
--- a/lib/RT/Extension/ResetPassword.pm
+++ b/lib/RT/Extension/ResetPassword.pm
@@ -118,11 +118,22 @@ May need root permissions
 
 =item Install Patches
 
-For RT 5.0.0 and 5.0.1 only, apply this patch to enable searches for users
-with a password set. See below for details.
+This is to enable searches for users with a password set.
+
+For RT 5 prior to 5.0.2, apply this:
 
     patch -p1 -d /opt/rt5 < patches/user-admin-callbacks.patch
 
+For RT 4.4.4, apply this:
+
+    patch -p1 -d /opt/rt4 < patches/4.4.4-user-admin-callbacks.patch
+
+For RT 4 prior to 4.4.4, apply this:
+
+    patch -p1 -d /opt/rt4 < patches/4-user-admin-callbacks.patch
+
+See below for details.
+
 =item C<make initdb>
 
 Only run this the first time you install this module.
@@ -218,11 +229,11 @@ section on the user admin page which shows whether the user currently
 has a password set. The "Delete password" option allows you to clear
 passwords if a user should no longer have access.
 
-For RT 5 only, this extension also adds a checkbox to the user admin
-page that allows you to filter users, displaying only those who have
-a password set. If you disable the C<$AllowUsersWithoutPassword> option,
-this checkbox allows you to see all users who have an existing password
-and would therefore be able to reset their password.
+For RT 4.4 and 5, this extension also adds a checkbox to the user admin page
+that allows you to filter users, displaying only those who have a password
+set. If you disable the C<$AllowUsersWithoutPassword> option, this checkbox
+allows you to see all users who have an existing password and would
+therefore be able to reset their password.
 
 =item C<$CreateNewUserAsPrivileged>
 
diff --git a/patches/4-user-admin-callbacks.patch b/patches/4-user-admin-callbacks.patch
new file mode 100644
index 0000000..eb3ed61
--- /dev/null
+++ b/patches/4-user-admin-callbacks.patch
@@ -0,0 +1,31 @@
+commit 6eef10d5861d11543ec2af521328217dea8b628d
+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 c254df74df..d73105c961 100644
+--- a/share/html/Admin/Users/index.html
++++ b/share/html/Admin/Users/index.html
+@@ -77,6 +77,8 @@ jQuery(function(){
+ <&|/l&>Find all users whose</&> <& /Elements/SelectUsers, %ARGS, Fields => \@fields &><br />
+ <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!</&>" /></div> 
+ </form>
+@@ -104,6 +106,8 @@ my $caption;
+ my $users = RT::Users->new( $session{'CurrentUser'} );
+ $users->FindAllRows if $FindDisabledUsers;
+ 
++$m->callback( UsersObj => $users, ARGSRef => \%ARGS, CallbackName => 'Initial' );
++
+ if ( defined($UserString) && length $UserString ) {
+     $caption = loc("Users matching search criteria");
+     if ( $UserField =~ /^CustomField-(\d+)/ ) {
diff --git a/patches/4.4.4-user-admin-callbacks.patch b/patches/4.4.4-user-admin-callbacks.patch
new file mode 100644
index 0000000..ea0e941
--- /dev/null
+++ b/patches/4.4.4-user-admin-callbacks.patch
@@ -0,0 +1,31 @@
+commit 6eef10d5861d11543ec2af521328217dea8b628d
+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 25835324ed..9e40115700 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>
+@@ -122,6 +124,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 179f57ce9be0de9216a089ae9f4375a03e125f75
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sat Apr 24 03:31:32 2021 +0800

    Pass FindUsersWithPassword argument to paging URL
    
    Thus its value won't be lost when user navigates different pages.

diff --git a/html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/ModifyCollectionListArgs b/html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/ModifyCollectionListArgs
new file mode 100644
index 0000000..1da6579
--- /dev/null
+++ b/html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/ModifyCollectionListArgs
@@ -0,0 +1,6 @@
+<%INIT>
+push @{$CollectionListArgs->{PassArguments}}, 'FindUsersWithPassword';
+</%INIT>
+<%ARGS>
+$CollectionListArgs
+</%ARGS>
diff --git a/patches/4-user-admin-callbacks.patch b/patches/4-user-admin-callbacks.patch
index eb3ed61..e0d40ea 100644
--- a/patches/4-user-admin-callbacks.patch
+++ b/patches/4-user-admin-callbacks.patch
@@ -29,3 +29,41 @@ index c254df74df..d73105c961 100644
  if ( defined($UserString) && length $UserString ) {
      $caption = loc("Users matching search criteria");
      if ( $UserField =~ /^CustomField-(\d+)/ ) {
+
+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 c254df74df..b45b384dfe 100644
+--- a/share/html/Admin/Users/index.html
++++ b/share/html/Admin/Users/index.html
+@@ -86,7 +86,8 @@ jQuery(function(){
+ % } else {
+ <p><&|/l&>Select a user</&>:</p>
+ 
+-<& /Elements/CollectionList,
++<%perl>
++my %collection_list_args = (
+     OrderBy => 'Name',
+     Order => 'ASC',
+     Rows  => $Rows,
+@@ -95,7 +96,11 @@ jQuery(function(){
+     Collection => $users,
+     AllowSorting => 1,
+     PassArguments => [qw(Format Rows Page Order OrderBy UserString UserOp UserField IdLike EmailLike FindDisabledUsers)],
+-&>
++);
++</%perl>
++
++% $m->callback( %ARGS, UsersObj => $users, CallbackName => 'ModifyCollectionListArgs', CollectionListArgs => \%collection_list_args );
++<& /Elements/CollectionList, %collection_list_args &>
+ 
+ % }
+ 
diff --git a/patches/4.4.4-user-admin-callbacks.patch b/patches/4.4.4-user-admin-callbacks.patch
index ea0e941..7ebb3c5 100644
--- a/patches/4.4.4-user-admin-callbacks.patch
+++ b/patches/4.4.4-user-admin-callbacks.patch
@@ -29,3 +29,41 @@ index 25835324ed..9e40115700 100644
  $caption = loc("Users matching search criteria");
  my @users_queries = ();
  push @users_queries, { field => $UserField, op => $UserOp, string => $UserString } if length $UserString;
+
+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 &>
+ 
+ % }
+ 
diff --git a/patches/user-admin-callbacks.patch b/patches/user-admin-callbacks.patch
index 0ad771e..63d2cad 100644
--- a/patches/user-admin-callbacks.patch
+++ b/patches/user-admin-callbacks.patch
@@ -29,3 +29,41 @@ index 4bcfc2e95..e819b3393 100644
  $caption = loc("Users matching search criteria");
  my @users_queries = ();
  push @users_queries, { field => $UserField, op => $UserOp, string => $UserString } if length $UserString;
+
+commit 73d82646143a5b72ac09902c93a0cbb330fd0e8b
+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 a686e34422..c919f31b22 100644
+--- a/share/html/Admin/Users/index.html
++++ b/share/html/Admin/Users/index.html
+@@ -160,7 +160,8 @@ jQuery(function(){
+ % } else {
+ <p><&|/l&>Select a user</&>:</p>
+ 
+-<& /Elements/CollectionList,
++<%perl>
++my %collection_list_args = (
+     OrderBy => 'Name',
+     Order => 'ASC',
+     Rows  => $Rows,
+@@ -169,7 +170,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 ef1ac7a69af980eac0f6978ef2c6a5e0398c64a1
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Apr 29 02:34:19 2021 +0800

    Prep 1.12 release

diff --git a/Changes b/Changes
index 7607204..03ccf53 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 Revision history for Perl module RT::Extension::ResetPassword
 
+1.12 2021-04-28
+ - Pass FindUsersWithPassword argument to paging URL
+ - Support password set search for RT 4
+
 1.11 2021-04-22
  - Add an option to show all users with a password set
 
diff --git a/MANIFEST b/MANIFEST
index 71bf8c2..cba8da8 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2,6 +2,7 @@ Changes
 etc/initialdata
 html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/Initial
 html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/InUsersAdminForm
+html/Callbacks/RT-Extension-ResetPassword/Admin/Users/index.html/ModifyCollectionListArgs
 html/Callbacks/RT-Extension-ResetPassword/Admin/Users/Modify.html/BeforeCreate
 html/Callbacks/RT-Extension-ResetPassword/Admin/Users/Modify.html/BeforeUpdate
 html/Callbacks/RT-Extension-ResetPassword/Elements/Login/Default
@@ -25,6 +26,8 @@ lib/RT/Extension/ResetPassword.pm
 Makefile.PL
 MANIFEST			This list of files
 META.yml
+patches/4-user-admin-callbacks.patch
+patches/4.4.4-user-admin-callbacks.patch
 patches/user-admin-callbacks.patch
 README
 static/css/resetpassword.css
diff --git a/META.yml b/META.yml
index 50f7555..52471e5 100644
--- a/META.yml
+++ b/META.yml
@@ -24,6 +24,6 @@ requires:
   perl: 5.8.3
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: '1.11'
+version: '1.12'
 x_module_install_rtx_version: '0.42'
 x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/ResetPassword.pm b/lib/RT/Extension/ResetPassword.pm
index bc811a7..fc9b9bc 100644
--- a/lib/RT/Extension/ResetPassword.pm
+++ b/lib/RT/Extension/ResetPassword.pm
@@ -5,7 +5,7 @@ use warnings;
 
 use Digest::SHA qw(sha256_hex);
 
-our $VERSION = '1.11';
+our $VERSION = '1.12';
 
 RT->AddStyleSheets("resetpassword.css");
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list