File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed
src/java/main/com/cronos/onlinereview/actions/project Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -1463,17 +1463,34 @@ private Set<Long> getParentGroups(long groupId) throws BaseException {
1463
1463
1464
1464
JsonNode result = objectMapper .readTree (entity .getContent ());
1465
1465
1466
- JsonNode groups = result .path ("result" ).path ("content" );
1467
- Set <Long > groupIds = new HashSet <Long >();
1468
- for (JsonNode group : groups ) {
1469
- groupIds .add (group .path ("id" ).asLong ());
1470
- }
1466
+ JsonNode groupNode = result .path ("result" ).path ("content" );
1467
+ Set <Long > groupIds = parseGroup (groupNode );
1471
1468
1472
1469
return groupIds ;
1473
1470
} catch (Exception exp ) {
1474
1471
throw new BaseException (exp .getMessage (), exp );
1475
1472
}
1476
1473
}
1474
+
1475
+ /**
1476
+ * Parse the group from the JSON node
1477
+ * @param groupNode the JSON node
1478
+ * @return the group
1479
+ */
1480
+ private Set <Long > parseGroup (JsonNode groupNode ) {
1481
+ Set <Long > parentGroupIds = new HashSet <>();
1482
+ Long parentGroupId = groupNode .path ("id" ).asLong ();
1483
+ if (parentGroupId != 0 ) {
1484
+ // exclude null node
1485
+ parentGroupIds .add (groupNode .path ("id" ).asLong ());
1486
+ }
1487
+
1488
+ if (groupNode .has ("parentGroup" )) {
1489
+ parentGroupIds .addAll (parseGroup (groupNode .path ("parentGroup" )));
1490
+ }
1491
+
1492
+ return parentGroupIds ;
1493
+ }
1477
1494
1478
1495
/**
1479
1496
* Check group permission
You can’t perform that action at this time.
0 commit comments