Enable role management 31/71931/2
authorSonsino, Ofir (os0695) <os0695@intl.att.com>
Tue, 6 Nov 2018 10:14:28 +0000 (12:14 +0200)
committerSonsino, Ofir (os0695) <os0695@intl.att.com>
Tue, 6 Nov 2018 13:21:43 +0000 (15:21 +0200)
Change-Id: Ice485d6081380f52d461d2beee9740626f4ec4b0
Issue-ID: VID-257
Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
epsdk-app-onap/src/main/resources/vid-data.sql
vid-app-common/src/main/java/org/onap/vid/controllers/VidController.java
vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java

index e2af216..9c48f85 100755 (executable)
@@ -625,6 +625,12 @@ REPLACE INTO `fn_restricted_url` VALUES ('serviceModels.htm','menu_servicemodels
 --\r
 INSERT INTO `fn_role` VALUES (1,'System Administrator','Y',1) ON DUPLICATE KEY UPDATE ROLE_NAME='System Administrator', ACTIVE_YN='Y', PRIORITY=1;\r
 INSERT INTO `fn_role` VALUES (16,'Standard User','Y',5) ON DUPLICATE KEY UPDATE ROLE_NAME='Standard User', ACTIVE_YN='Y', PRIORITY=5;\r
+INSERT INTO `fn_role` VALUES (17,'Demonstration___vFWCL','Y',5) ON DUPLICATE KEY UPDATE ROLE_NAME='Demonstration___vFWCL', ACTIVE_YN='Y', PRIORITY=5;\r
+INSERT INTO `fn_role` VALUES (18,'Demonstration___vFW','Y',5) ON DUPLICATE KEY UPDATE ROLE_NAME='Demonstration___vFW', ACTIVE_YN='Y', PRIORITY=5;\r
+INSERT INTO `fn_role` VALUES (19,'Demonstration___vCPE','Y',5) ON DUPLICATE KEY UPDATE ROLE_NAME='Demonstration___vCPE', ACTIVE_YN='Y', PRIORITY=5;\r
+INSERT INTO `fn_role` VALUES (20,'Demonstration___vIMS','Y',5) ON DUPLICATE KEY UPDATE ROLE_NAME='Demonstration___vIMS', ACTIVE_YN='Y', PRIORITY=5;\r
+INSERT INTO `fn_role` VALUES (21,'Demonstration___vLB','Y',5) ON DUPLICATE KEY UPDATE ROLE_NAME='Demonstration___vLB', ACTIVE_YN='Y', PRIORITY=5;\r
+INSERT INTO `fn_role` VALUES (22,'Demonstration___gNB','Y',5) ON DUPLICATE KEY UPDATE ROLE_NAME='Demonstration___gNB', ACTIVE_YN='Y', PRIORITY=5;\r
 \r
 --\r
 -- Dumping data for table `fn_role_composite`\r
@@ -735,3 +741,10 @@ INSERT IGNORE `fn_user_role` VALUES (2,1,NULL,1);
 INSERT IGNORE `fn_user_role` VALUES (3,1,NULL,1);\r
 INSERT IGNORE `fn_user_role` VALUES (4,1,NULL,1);\r
 INSERT IGNORE `fn_user_role` VALUES (5,1,NULL,1);\r
+INSERT IGNORE `fn_user_role` VALUES (1,17,NULL,1);\r
+INSERT IGNORE `fn_user_role` VALUES (1,18,NULL,1);\r
+INSERT IGNORE `fn_user_role` VALUES (1,19,NULL,1);\r
+INSERT IGNORE `fn_user_role` VALUES (1,20,NULL,1);\r
+INSERT IGNORE `fn_user_role` VALUES (1,21,NULL,1);\r
+INSERT IGNORE `fn_user_role` VALUES (1,22,NULL,1);\r
+\r
index 39a1f2b..b9d67b6 100644 (file)
@@ -71,9 +71,7 @@ public class VidController extends RestrictedBaseController {
         SecureServices secureServices = new SecureServices();
         List<Role> roles = roleProvider.getUserRoles(request);
         secureServices.setServices(aaiService.getServicesByDistributionStatus());
-        //Disable roles until AAF integration finishes
-        //secureServices.setReadOnly(roleProvider.userPermissionIsReadOnly(roles));
-        secureServices.setReadOnly(false);
+               secureServices.setReadOnly(roleProvider.userPermissionIsReadOnly(roles));
         return secureServices;
     }
 
index 90b9a82..5c1ee9e 100644 (file)
@@ -69,10 +69,10 @@ public class RoleProvider {
         LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Entering to get user role for user " + UserUtils.getUserId(request));
 
         List<Role> roleList = new ArrayList<>();
-        //Disable roles until AAF integration finishes
-        /*HashMap roles = UserUtils.getRoles(request);
+        
+        Map roles = UserUtils.getRoles(request);
         for (Object role : roles.keySet()) {
-            org.openecomp.portalsdk.core.domain.Role sdkRol = (org.openecomp.portalsdk.core.domain.Role) roles.get(role);
+            org.onap.portalsdk.core.domain.Role sdkRol = (org.onap.portalsdk.core.domain.Role) roles.get(role);
 
             LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "Role " + sdkRol.getName() + " is being proccessed");
             try {
@@ -85,11 +85,11 @@ public class RoleProvider {
                 roleList.add(createRoleFromStringArr(roleParts, logPrefix));
                 String msg = String.format(logPrefix + " User %s got permissions %s", UserUtils.getUserId(request), Arrays.toString(roleParts));
                 LOG.debug(EELFLoggerDelegate.debugLogger, msg);
-            } catch (RoleParsingException e) {
+            } catch (Exception e) {
                 LOG.error(logPrefix + " Failed to parse permission");
 
             }
-        }*/
+        }
 
         return roleList;
     }