Skip to content

armgit / core

Public Imported from GitHub
0

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

Updated console registration handling

Rich Turner61e219d895c9
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 261a12cfa..bb496364b 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
@@ -83,10 +83,6 @@ public class ConsoleResourceImpl extends ManagerWebResource implements ConsoleRe
!isAuthenticated(),
true);
- if (!isAuthenticated()) {
- consoleAsset.setAccessPublicRead(true);
- }
-
consoleAsset.setRealmId(getRequestTenant().getId());
consoleAsset.setParentId(getConsoleParentAssetId(getRequestRealm()));
consoleAsset.setId(consoleRegistration.getId());
@@ -96,27 +92,6 @@ public class ConsoleResourceImpl extends ManagerWebResource implements ConsoleRe
throw new BadRequestException(Response.status(Response.Status.BAD_REQUEST).entity(new ValidationFailure[] {new ValidationFailure(Asset.AssetTypeFailureReason.ASSET_TYPE_MISMATCH)}).build());
}
- // Check authenticated user is already linked to this console; if anonymous request then check console isn't linked to any users
- if (isAuthenticated()) {
- // Make asset private
- consoleAsset.setAccessPublicRead(false);
-
- // RT: Disabled below to allow multiple users to share a console (to support a shared device)
-// List<UserAsset> consoleUserAssets = assetStorageService.findUserAssets(getAuthenticatedTenant().getId(),
-// null,
-// consoleRegistration.getId());
-// if (consoleUserAssets.isEmpty()) {
-// throw new WebApplicationException(FORBIDDEN);
-// }
- } else {
- List<UserAsset> consoleUserAssets = assetStorageService.findUserAssets(getRequestTenant().getId(),
- null,
- consoleRegistration.getId());
- if (!consoleUserAssets.isEmpty()) {
- throw new WebApplicationException(FORBIDDEN);
- }
- }
-
ConsoleConfiguration.setConsoleName(consoleAsset, consoleRegistration.getName());
ConsoleConfiguration.setConsolePlatform(consoleAsset, consoleRegistration.getPlatform());
ConsoleConfiguration.setConsoleVersion(consoleAsset, consoleRegistration.getVersion());
diff --git a/model/src/main/java/org/openremote/model/console/ConsoleResource.java b/model/src/main/java/org/openremote/model/console/ConsoleResource.java
index a671ef4e2..a2f9f43ce 100644
--- a/model/src/main/java/org/openremote/model/console/ConsoleResource.java
+++ b/model/src/main/java/org/openremote/model/console/ConsoleResource.java
@@ -41,9 +41,9 @@ public interface ConsoleResource {
* Behind the scenes the console registration is converted into an asset and the {@link ConsoleRegistration} data is
* stored in the appropriate {@link Asset} {@link Attribute}s (see {@link ConsoleConfiguration} for more details).
* <p>
- * This is a public endpoint and allows the registration of anonymous consoles; if there is an authenticated user
- * then the console asset will be linked to that user. If multiple users login on the same console then it will be
- * associated with each user (i.e. a 1-many relationship).
+ * This is a public endpoint and allows the registration of consoles anonymously; if there is an authenticated user
+ * registering the console then the console asset will be linked to that user. If multiple users login on the same
+ * console then it will be associated with each user (i.e. a 1-many relationship).
*/
@POST
@Path("register")