Skip to content

Commit

Permalink
fix: put block when pull user info
Browse files Browse the repository at this point in the history
  • Loading branch information
dedywahyudi committed Jan 23, 2023
1 parent 6c8614b commit 5f46e8d
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,19 @@ public static void gatherUserRoles(HttpServletRequest request) throws BaseExcept
return;
}

// Obtain an instance of the User Retrieval object
UserRetrieval usrMgr = ActionsHelper.createUserRetrieval(request);
// Get External User object for the currently logged in user
ExternalUser extUser = usrMgr.retrieveUser(getLoggedInUserId(request));
// Place handle of the user into session as attribute
request.getSession().setAttribute("userHandle", extUser.getHandle());
request.getSession().setAttribute("userFirstName", extUser.getFirstName());
request.getSession().setAttribute("userLastName", extUser.getLastName());
request.getSession().setAttribute("userEmail", extUser.getEmail());
// If this function is called the first time after the user has logged in,
// obtain and store in the session the handle of the user
if (request.getSession().getAttribute("userHandle") == null) {
// Obtain an instance of the User Retrieval object
UserRetrieval usrMgr = ActionsHelper.createUserRetrieval(request);
// Get External User object for the currently logged in user
ExternalUser extUser = usrMgr.retrieveUser(getLoggedInUserId(request));
// Place handle of the user into session as attribute
request.getSession().setAttribute("userHandle", extUser.getHandle());
request.getSession().setAttribute("userFirstName", extUser.getFirstName());
request.getSession().setAttribute("userLastName", extUser.getLastName());
request.getSession().setAttribute("userEmail", extUser.getEmail());
}

// Perform search for resources
Resource[] resources = ActionsHelper.searchUserResources(getLoggedInUserId(request), null);
Expand Down

0 comments on commit 5f46e8d

Please sign in to comment.