lahirujayathilake commented on code in PR #417:
URL: https://github.com/apache/airavata-custos/pull/417#discussion_r1960671182


##########
core/src/main/java/org/apache/custos/core/mapper/user/UserProfileMapper.java:
##########
@@ -20,9 +20,7 @@
 package org.apache.custos.core.mapper.user;
 
 import org.apache.custos.core.constants.Constants;
-import org.apache.custos.core.model.user.UserAttribute;
-import org.apache.custos.core.model.user.UserProfile;
-import org.apache.custos.core.model.user.UserRole;
+import org.apache.custos.core.model.user.*;

Review Comment:
   better to have singe line of imports instead the `*`



##########
core/src/main/java/org/apache/custos/core/mapper/user/UserProfileMapper.java:
##########
@@ -47,6 +45,8 @@ public class UserProfileMapper {
     public static UserProfile 
createUserProfileEntityFromUserProfile(org.apache.custos.core.user.profile.api.UserProfile
 userProfile) {
 
         UserProfile entity = new UserProfile();
+        System.out.println("BEFORE:" + userProfile);
+

Review Comment:
   remove `println`s (including the rest)



##########
core/src/main/java/org/apache/custos/core/mapper/user/UserProfileMapper.java:
##########
@@ -181,6 +183,22 @@ public static 
org.apache.custos.core.user.profile.api.UserProfile createUserProf
             builder.setType(UserTypes.valueOf(profileEntity.getType()));
         }
 
+        if (profileEntity.getUserGroupMemberships() != null && 
!profileEntity.getUserGroupMemberships().isEmpty()) {
+            List<String> clientRoles = new ArrayList<>();
+            List<String> realmRoles = new ArrayList<>();
+            for (UserGroupMembership userGroupMembership: 
profileEntity.getUserGroupMemberships()) {
+                for (GroupRole gr: 
userGroupMembership.getGroup().getGroupRole()) {
+                    if (gr.getType().equals("client")) {
+                        clientRoles.add(gr.getValue());
+                    } else if (gr.getType().equals("realm")) {

Review Comment:
   do the `.equals(..)` switching the constant and variable and make the 
`client` and `realm` be constants in the class 



##########
services/src/main/java/org/apache/custos/service/credential/store/CredentialStoreService.java:
##########
@@ -424,11 +424,11 @@ public GetAllCredentialsResponse 
getAllCredentialsFromToken(TokenRequest request
             String validatingPath = BASE_PATH + entity.getOwnerId() + "/" + 
Type.CUSTOS.name();
             VaultResponseSupport<Credential> validationResponse = 
vaultTemplate.read(validatingPath, Credential.class);
 
-            if (validationResponse == null || validationResponse.getData() == 
null || 
!validationResponse.getData().getSecret().equals(credential.getSecret())) {
-                String msg = "Invalid secret for Id: " + credential.getId();
-                LOGGER.error(msg);
-                throw new AuthenticationException(msg);
-            }
+//            if (validationResponse == null || validationResponse.getData() 
== null || 
!validationResponse.getData().getSecret().equals(credential.getSecret())) {
+//                String msg = "Invalid secret for Id: " + credential.getId();
+//                LOGGER.error(msg);
+//                throw new AuthenticationException(msg);
+//            }

Review Comment:
   remove the commented lines if not required



##########
custos-portal/src/components/Users/UserSettings.tsx:
##########
@@ -25,42 +27,90 @@ import { FaArrowLeft } from "react-icons/fa6";
 import { LeftRightLayout } from "../LeftRightLayout";
 import { FiTrash2 } from "react-icons/fi";
 import { StackedBorderBox } from "../StackedBorderBox";
+import { BACKEND_URL, CLIENT_ID } from "../../lib/constants";
+import { useApi } from "../../hooks/useApi";
+import { isEmpty } from "../../lib/util";
+import { useEffect, useState } from "react";
+import { useAuth } from "react-oidc-context";
 
-const DUMMY_ROLES: any = [
-  {
-    application: "Grafana",
-    role: "grafana:viewer",
-    description: "Grafana Viewer",
-  },
-  {
-    application: "Grafana",
-    role: "grafana:editor",
-    description: "Grafana Editor",
-  },
-  {
-    application: "Grafana",
-    role: "grafana:admin",
-    description: "Grafana Admin",
-  },
-];
-
-const DUMMY_ACTIVITY: any = [
-  {
-    action: "User Created",
-    timestamp: "2021-10-01",
-  },
-  {
-    action: "User Disabled",
-    timestamp: "2021-10-01",
-  },
-  {
-    action: "User Enabled",
-    timestamp: "2021-10-01",
-  },
-];
+// const DUMMY_ROLES: any = [
+//   {
+//     application: "Grafana",
+//     role: "grafana:viewer",
+//     description: "Grafana Viewer",
+//   },
+//   {
+//     application: "Grafana",
+//     role: "grafana:editor",
+//     description: "Grafana Editor",
+//   },
+//   {
+//     application: "Grafana",
+//     role: "grafana:admin",
+//     description: "Grafana Admin",
+//   },
+// ];
+
+// const DUMMY_ACTIVITY: any = [
+//   {
+//     action: "User Created",
+//     timestamp: "2021-10-01",
+//   },
+//   {
+//     action: "User Disabled",
+//     timestamp: "2021-10-01",
+//   },
+//   {
+//     action: "User Enabled",
+//     timestamp: "2021-10-01",
+//   },
+// ];

Review Comment:
   can we remove these?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to