Permalink
Browse files

Updated console registration handling

  • Loading branch information...
richturner committed Oct 25, 2018
1 parent f31634f commit 61e219d895c904ceea026cf1d7ede4c945383392
@@ -83,10 +83,6 @@ public ConsoleRegistration register(RequestParams requestParams, ConsoleRegistra
!isAuthenticated(),
true);
if (!isAuthenticated()) {
consoleAsset.setAccessPublicRead(true);
}
consoleAsset.setRealmId(getRequestTenant().getId());
consoleAsset.setParentId(getConsoleParentAssetId(getRequestRealm()));
consoleAsset.setId(consoleRegistration.getId());
@@ -96,27 +92,6 @@ public ConsoleRegistration register(RequestParams requestParams, ConsoleRegistra
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());
@@ -41,9 +41,9 @@
* 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")

0 comments on commit 61e219d

Please sign in to comment.