Business Card Integration 29/106929/1
authorSudarshan Kumar <sudarshan.kumar@att.com>
Thu, 30 Apr 2020 15:18:38 +0000 (20:48 +0530)
committerSudarshan Kumar <sudarshan.kumar@att.com>
Thu, 30 Apr 2020 15:19:38 +0000 (20:49 +0530)
Business Card Integration

Issue-ID: PORTAL-898
Change-Id: Ifa47ed0aec23d08dc17dc5c84736ae138291fc8f
Signed-off-by: Sudarshan Kumar <sudarshan.kumar@att.com>
ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/controller/FunctionalMenuController.java
ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/FunctionalMenuControllerTest.java
portal-FE-common/src/app/layout/components/header/header.component.html
portal-FE-common/src/app/layout/components/header/header.component.ts

index 65abc28..abbd854 100644 (file)
@@ -575,10 +575,12 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
             String lastNameStr = null;
             String emailStr = null;
             String lastLogin = null;
+            boolean isSystemUser = false;
                        EPUser user = EPUserUtils.getUserSession(request);
                        firstNameStr = user.getFirstName();
                        lastNameStr = user.getLastName();
                        orgUserIdStr = user.getOrgUserId();
+                       isSystemUser = user.isSystemUser();
                        emailStr = user.getEmail();
                        if (emailStr == null || emailStr.equals("")) {
                                EPUser userResult = searchService.searchUserByUserId(orgUserIdStr);
@@ -622,6 +624,7 @@ public class FunctionalMenuController extends EPRestrictedBaseController {
                        map.put("userId",
                                        orgUserIdStr != null ? orgUserIdStr : (orgUserIdSC != null ? orgUserIdSC.getCvalue() : null));
                        map.put("last_login", lastLogin);
+                       map.put("isSystemUser", String.valueOf(isSystemUser));
                        JSONObject j = new JSONObject(map);
                        fnMenuStaticResponse = j.toString();
                        // Be chatty in the log
index bee5d93..80099d5 100644 (file)
@@ -292,7 +292,7 @@ public class FunctionalMenuControllerTest extends MockitoTestSuite {
        @Test
        public void getFunctionalMenuStaticInfoTest(){
                String fnMenuStaticactualResponse = null;
-               String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"email\":\"test\"}";
+               String fnMenuStaticexpectedResponse = "{\"firstName\":\"test\",\"lastName\":\"test\",\"last_login\":\"09/08/2017 03:48:13 -0400 am\",\"userId\":\"guestT\",\"isSystemUser\":\"false\",\"email\":\"test\"}";
                String orgUserIdStr = null;
                
                EPUser user = mockUser.mockEPUser();
index f3b3a5f..97f4a26 100644 (file)
@@ -76,7 +76,7 @@
 <li class="dropdown-item" style="font-weight: lighter">
     {{firstName}}, {{lastName}}
 </li>
-<li class="dropdown-item">
+<li class="dropdown-item" *ngIf=(!isSystemUser)>
     <span class="dropdown-item-name"> {{ 'Email'}}: </span>
     <div>
         <span class="dropdown-item-value">
@@ -85,7 +85,8 @@
     </div>
 </li>
 <li class="dropdown-item">
-    <span class="dropdown-item-name"> {{ 'User Id' }}: </span>
+    <span class="dropdown-item-name" *ngIf=(!isSystemUser)> {{ 'User Id' }}: </span>
+    <span class="dropdown-item-name" *ngIf=(isSystemUser)> {{ 'System Id' }}: </span>
     <div>
         <span class="dropdown-item-value">
             {{loginSnippetUserid}}
index 09dd4c1..429587d 100644 (file)
@@ -59,6 +59,7 @@ export class HeaderComponent implements OnInit {
     api = environment.api;
     brandName: string;
     brandLogoImagePath: string;
+    isSystemUser: boolean = false;
 
     constructor(public router: Router, private userProfileService: UserProfileService, private menusService: MenusService, private cookieService: CookieService) {
 
@@ -90,7 +91,7 @@ export class HeaderComponent implements OnInit {
 
     getUserInformation() {
         this.userProfileService.getFunctionalMenuStaticInfo().toPromise().then((res: any) => {
-            if (res == null || res.firstName == null || res.firstName == '' || res.lastName == null || res.lastName == '') {
+            if (res === null || res.firstName === null || res.firstName === '' || res.lastName === null || res.lastName === '') {
                 // $log.info('HeaderCtrl: failed to get all required data, trying user profile');
                 this.userProfileService.getUserProfile().toPromise().then((profile: any) => {
                     this.firstName = profile.firstName;
@@ -105,6 +106,9 @@ export class HeaderComponent implements OnInit {
                 this.loginSnippetUserid = res.userId;
                 this.lastLogin = Date.parse(res.last_login);
             }
+            if(res != null && res.isSystemUser === 'true'){
+                this.isSystemUser = true;
+            }
             sessionStorage.userId = res.userId;
             this.menusService.getFunctionalMenuForUser().toPromise().then((jsonHeaderMenu: any) => {
                 // $scope.menuItems = unflatten(jsonHeaderMenu);