Skip to content

Commit 755bdd4

Browse files
authored
Fixes issue with permission grant during entity creation (#1597)
* version 2.7.8 * fixes issue with permissions on create action
1 parent b920ed0 commit 755bdd4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/java/org/ohdsi/webapi/shiro/filters/ProcessResponseContentFilterImpl.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.ohdsi.webapi.pathway.PathwayService;
1717
import org.ohdsi.webapi.service.IRAnalysisService;
1818
import org.ohdsi.webapi.shiro.PermissionManager;
19+
import org.ohdsi.webapi.shiro.exception.NullJsonNodeException;
1920
import org.ohdsi.webapi.shiro.exception.PermissionAlreadyExistsException;
2021
import org.slf4j.Logger;
2122
import org.slf4j.LoggerFactory;
@@ -82,10 +83,14 @@ public void doProcessResponseContent(String content) throws Exception {
8283

8384
private Optional<EntityName> getParentEntity(String content) throws IOException {
8485

85-
String entityType = parseJsonField(content, "entityName");
86-
return parentEntities.stream()
87-
.filter(e -> e.toString().equalsIgnoreCase(entityType))
88-
.findFirst();
86+
try {
87+
String entityType = parseJsonField(content, "entityName");
88+
return parentEntities.stream()
89+
.filter(e -> e.toString().equalsIgnoreCase(entityType))
90+
.findFirst();
91+
} catch(NullJsonNodeException e){
92+
return Optional.empty();
93+
}
8994
}
9095

9196
private void addPermissionsToNestedEntities(String content, EntityName parentEntityName) throws IOException {

0 commit comments

Comments
 (0)