LP1956619 Holdings editor sanity check for VIEW_USER perm user/berick/lp1956619-holdings-edit-perm-failures
authorBill Erickson <berickxx@gmail.com>
Mon, 11 Jul 2022 14:58:40 +0000 (10:58 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 11 Jul 2022 15:00:38 +0000 (11:00 -0400)
When the staff accessing holdings in the holdings editor do not have the
VIEW_USER permission at a level sufficient to display the creator/editor
of a set of items, display the ID of the user instead of attempting and
failing to display the username, which causes a page rendering error.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts

index 51621ae..60aea22 100644 (file)
@@ -217,7 +217,9 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
 
             case 'editor':
             case 'creator':
-                return value.usrname();
+                // VIEW_USER permission may be too narrow.  If so,
+                // just display the user ID instead of the username.
+                return typeof value === 'object' ? value.usrname() : value;
 
             case 'circ_lib':
                 return this.org.get(value).shortname();