LP#1689608: Batch user editing
authorMike Rylander <mrylander@gmail.com>
Thu, 2 Feb 2017 20:29:46 +0000 (15:29 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 28 Aug 2017 14:35:28 +0000 (10:35 -0400)
commitb3e2b84ec99c8c6fafdc6e2e2051679725c10734
tree9e9beaa5a7fd4278823433a87555ef6298e9d591
parentc3abc07f7c0a14ec3dc7e1b3006d9af0969bb6a7
LP#1689608: Batch user editing

Summary
-------

Currently, editing and deleting of users must be performed on a user-by-user
basis. There are workflows that would benefit from the ability to act on a
set of users, where the changes to all users in the set are the same.

This commit provides a new interface analogous to the Copy Bucket interface
to record the selection and grouping of a set of users into a User Bucket.
The addition of users to a User Bucket is possible from the Patron Search
interface by the use of a new grid Action, and directly on the User Bucket
interface by user barcode. It is also possible to add users by uploading
a text file that contains a list of user barcodes.

From this interface it is possible to perform a set of specific batch update
operations against users generally.

Editing users
-------------

In order to facilitate the update of user data fields, specifically:

 * Active flag
 * Primary Permission Group (group application permissions consulted)
 * Juvenile flag
 * Home Library (UPDATE_USER checked against both old and new value)
 * Privilege Expiration Date
 * Barred flag (BAR_PATRON permission consulted)
 * Internet Access Level

This commit contains a new set of business logic allowing staff to supply new
values for these fields. Creation and immediate processing of a change set
will be made available through a grid Menu item. If the staff user does not
have the UPDATE_USER permission, this option will be disabled.

Each change set requires a name. Buckets may have multiple change sets. All
users in the Bucket at the time of processing will be updated when the change
set is processed, and change sets are processed immediately upon successful
creation. The interface will deliver progress information regarding the
processing stage and percent of completion.

While processing the users, the original value for each field edited will be
recorded for potential future rollback. Users can examine the success and
failure of applied change sets.

The user will be able to rollback the entire change set, but not parts thereof.
The rollback will affect only those users that were successfully updated by the
original change set and may be different from the current set of users in the
Bucket. Users can manually discard change sets, removing them from the
interface but preventing future rollback.

As a batch process, rather than a direct edit, this mechanism explicitly skips
processing of Action/Trigger event definitions for user update.

Deleting users
--------------

In order to facilitate the batch deletion of users, this commit creates a new
set of business logic allowing staff to set the Deleted flag on users.
Creation and immediate processing of a batch delete is made available through
a grid Menu item. If the staff user does not have both the UPDATE_USER and
DELETE_USER permission, this option is disabled. Because of the potential for
damage and the additional required permission, this field change is
specifically segregated from the general Editing functionally described above.

Each delete set requires a name. Buckets may have multiple delete sets. All
users in the Bucket at the time of processing will be marked as deleted when
the delete set is processed. The interface will deliver progress information
regarding the processing stage and percent of completion.

While processing the users, the original value for the "deleted" field will be
recorded for potential future rollback. Users will be able to examine the
success and failure of applied delete sets in the same interface used for the
above described change sets.

As a batch process, rather than a direct edit, this mechanism explicitly skips
processing of Action/Trigger event definitions for user deletion.

This mechanism does not use the Purge User functionality, but instead simply
marks the users as deleted. Future enhancement could add such functionality.

Editing Statistical Category Entries
------------------------------------

In order to facilitate the batch editing, addition, and removal of
Statistical Category Entries for users, this commit creates a new set of
business logic allowing staff to either remove or add & update Entries for
Statistical Categories to which the staff member has access. Processing of
Statistical Category Entry modifications will are available through a grid
Menu item.

All users in the bucket will have their Statistical Category Entries
modified. Unlike user data field updates, modification of Statistical
Category Entries is permanent and cannot be rolled back. No named change
sets are required. The interface will deliver progress information regarding
the processing stage and percent of completion.

As a batch process, rather than a direct edit, this mechanism explicitly skips
processing of Action/Trigger event definitions for user update.

New service requirement
-----------------------

This new functionality makes use of the QStore service, which was previously
unused in production.  If this service has been removed from the configuration
of a live Evergreen instances, it will need to be added back in order for
batch user editing to succeed.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Scott Thomas <scott.thomas@sparkpa.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Conflicts:
Open-ILS/src/templates/staff/circ/patron/index.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
28 files changed:
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Container.pm
Open-ILS/src/sql/Pg/008.schema.query.sql
Open-ILS/src/sql/Pg/070.schema.container.sql
Open-ILS/src/sql/Pg/090.schema.action.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.patron_batch_update.sql [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/index.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_bucket_create.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_bucket_delete.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_bucket_edit.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_bucket_info.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_bucket_selector.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_changesets.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_delete_all.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_grid_menu.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_load_shared.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_pending.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_rollback.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_update_all.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_update_statcats.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/bucket/t_view.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/patron/index.tt2
Open-ILS/src/templates/staff/circ/patron/t_search_results.tt2
Open-ILS/src/templates/staff/navbar.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/bucket/app.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/services/user-bucket.js [new file with mode: 0644]