use of com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO in project ArachneCentralAPI by OHDSI.
the class HasArachnePermissionsToPermissionDTOConverter method convert.
@Override
public PermissionsDTO convert(HasArachnePermissions hasArachnePermissions) {
PermissionsDTO permissionsDTO = new PermissionsDTO();
Set<ArachnePermission> permissions = hasArachnePermissions.getPermissions();
if (permissions != null) {
Arrays.stream(ArachnePermission.values()).filter(arachnePermission -> Stream.of(arachnePermission.getApplicableClass()).anyMatch(clazz -> clazz.isAssignableFrom(hasArachnePermissions.getClass()))).forEach(ap -> permissionsDTO.put(ap, permissions.contains(ap)));
}
return permissionsDTO;
}
Aggregations