Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Minor bug fixes

Rich Turner9faec0b8755f
diff --git a/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.java b/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.java
index a42ef22fe..80662e15a 100644
--- a/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.java
+++ b/manager/src/main/java/org/openremote/manager/asset/AssetResourceImpl.java
@@ -613,14 +613,17 @@ public class AssetResourceImpl extends ManagerWebResource implements AssetResour
@Override
public void updatePublicAssetLocation(RequestParams requestParams, String assetId, GeoJSONPoint location) {
try {
- Asset[] result = queryPublicAssets(requestParams, new AssetQuery().id(assetId));
+ Asset asset = assetStorageService.find(assetId, true);
- if (result.length == 0) {
+ if (asset == null) {
throw new WebApplicationException(NOT_FOUND);
}
- Asset asset = result[0];
//TODO do we need a PUBLIC_WRITE metaitem?
+ if (!asset.isAccessPublicRead()) {
+ throw new WebApplicationException(FORBIDDEN);
+ }
+
updateAssetLocation(asset, location);
} catch (IllegalStateException ex) {
throw new WebApplicationException(ex, BAD_REQUEST);
diff --git a/manager/src/main/java/org/openremote/manager/asset/console/ConsoleResourceImpl.java b/manager/src/main/java/org/openremote/manager/asset/console/ConsoleResourceImpl.java
index 63b9984d1..54f8050ab 100644
--- a/manager/src/main/java/org/openremote/manager/asset/console/ConsoleResourceImpl.java
+++ b/manager/src/main/java/org/openremote/manager/asset/console/ConsoleResourceImpl.java
@@ -90,6 +90,7 @@ public class ConsoleResourceImpl extends ManagerWebResource implements ConsoleRe
consoleAsset.setRealmId(getRequestTenant().getId());
consoleAsset.setParentId(getConsoleParentAssetId(getRequestRealm()));
consoleAsset.setId(consoleRegistration.getId());
+ consoleAsset.setAccessPublicRead(true);
}
ConsoleConfiguration.setConsoleName(consoleAsset, consoleRegistration.getName());