ExLibrisGroup/primo-explore-devenv

How to override displayed username

Closed this issue · 3 comments

I have an interesting problem in reverse engineering. Our library has public patrons, and they sign up via JIT User Creation. This means we have many non-Roman usernames, and due to federation from some federated login services already supported by our SAML, which federated Google, etc., we sometimes do not get a first name and last name.

What we'd like to do is to display the email (or first portion of the email) as the username, I can see that prmUserAreaExpandable component gets the username for display from the UserSessionManagerService which gets the display name from the JWT.

I think I can override the method getUserNameForDisplay on the service above by injecting $provide into one of our factories, and then using $provide.decorate to override the method. What I am concerned about is where to get the email. I've looked at the something like personalInfoService where it is used under My Account > Personal Details, however it looks pretty complicated and wonder whether I could get some support on this.

I'm not going to give any example because names are private, but Ex Libris personal could create an account using a google account which uses a Hebrew name at https://catalog.nlm.nih.gov/ and see the issue I am working on.

Here is what I tried. I'm not quite sure why it didn't work:

var app = angular.module(
  'viewCustom', ['angularLoad', 'googleAnalytics', 'customActions']
).config(function($provide) {
  $provide.decorator('userSessionManagerService', ['getUserNameForDisplay', function() {
    return "MrPotato";
  }])
});

I've solved this.

Hi @danizen, could you share where you located the email address? I have been searching for it as well. Thanks!