@Test public void multiLevelBadHierarchyPermissionTesting() { List<String> adminPermissions = Arrays.asList("PARTYMGR", "EXAMPLE", "ACCTG_PREF"); assertFalse(SecurityUtil.checkMultiLevelAdminPermissionValidity( adminPermissions, "SPECIFIC_MULTI_LEVEL_EXAMPLE_VIEW")); assertFalse(SecurityUtil.checkMultiLevelAdminPermissionValidity(adminPermissions, "HOTDEP_PARTYMGR_ADMIN")); }
static boolean checkMultiLevelAdminPermissionValidity(List<String> permissionIds, String permission) { while (permission.contains("_")) { permission = permission.substring(0, permission.lastIndexOf("_")); if (permissionIds.contains(permission)) return true; } return false; }
SecurityUtil { static boolean checkMultiLevelAdminPermissionValidity(List<String> permissionIds, String permission) { while (permission.contains("_")) { permission = permission.substring(0, permission.lastIndexOf("_")); if (permissionIds.contains(permission)) return true; } return false; } }
SecurityUtil { static boolean checkMultiLevelAdminPermissionValidity(List<String> permissionIds, String permission) { while (permission.contains("_")) { permission = permission.substring(0, permission.lastIndexOf("_")); if (permissionIds.contains(permission)) return true; } return false; }  }
SecurityUtil { static boolean checkMultiLevelAdminPermissionValidity(List<String> permissionIds, String permission) { while (permission.contains("_")) { permission = permission.substring(0, permission.lastIndexOf("_")); if (permissionIds.contains(permission)) return true; } return false; }  static boolean hasUserLoginAdminPermission(Delegator delegator, String userLoginId); static List<String> hasUserLoginMorePermissionThan(Delegator delegator, String userLoginId, String toUserLoginId); static String generateJwtToAuthenticateUserLogin(Delegator delegator, String userLoginId); static boolean authenticateUserLoginByJWT(Delegator delegator, String userLoginId, String jwtToken); }
SecurityUtil { static boolean checkMultiLevelAdminPermissionValidity(List<String> permissionIds, String permission) { while (permission.contains("_")) { permission = permission.substring(0, permission.lastIndexOf("_")); if (permissionIds.contains(permission)) return true; } return false; }  static boolean hasUserLoginAdminPermission(Delegator delegator, String userLoginId); static List<String> hasUserLoginMorePermissionThan(Delegator delegator, String userLoginId, String toUserLoginId); static String generateJwtToAuthenticateUserLogin(Delegator delegator, String userLoginId); static boolean authenticateUserLoginByJWT(Delegator delegator, String userLoginId, String jwtToken);  }