Remove GONE API response where unnecessary - 3 MgmtSoftwareModuleRestApi Methods (related to #2880) (#2888)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -485,7 +485,7 @@ public class AccessContext {
|
||||
|
||||
private AuthenticationDelegate(final String tenant, final String username, final Authentication delegate) {
|
||||
this.delegate = delegate;
|
||||
principal = new TenantAwareUser(username, username, delegate != null ? delegate.getAuthorities() : Collections.emptyList(), tenant);
|
||||
principal = new TenantAwareUser(username, username, delegate == null ? Collections.emptyList() : delegate.getAuthorities(), tenant);
|
||||
tenantAwareAuthenticationDetails = new TenantAwareAuthenticationDetails(tenant, false);
|
||||
}
|
||||
|
||||
@@ -507,12 +507,12 @@ public class AccessContext {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return delegate != null ? delegate.toString() : null;
|
||||
return delegate == null ? null : delegate.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return delegate != null ? delegate.getName() : null;
|
||||
return delegate == null ? null : delegate.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -522,7 +522,7 @@ public class AccessContext {
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return delegate != null ? delegate.getCredentials() : null;
|
||||
return delegate == null ? null : delegate.getCredentials();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -537,15 +537,14 @@ public class AccessContext {
|
||||
|
||||
@Override
|
||||
public boolean isAuthenticated() {
|
||||
return delegate == null || delegate.isAuthenticated();
|
||||
return delegate != null && delegate.isAuthenticated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthenticated(final boolean isAuthenticated) {
|
||||
if (delegate == null) {
|
||||
return;
|
||||
if (delegate != null) {
|
||||
delegate.setAuthenticated(isAuthenticated);
|
||||
}
|
||||
delegate.setAuthenticated(isAuthenticated);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,8 +85,6 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Software Module not found",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Upload / store to storage or encryption failed",
|
||||
@@ -113,10 +111,6 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
description = "Handles the GET request of retrieving all metadata of artifacts assigned to a " +
|
||||
"software module. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtArtifact>> getArtifacts(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@@ -133,10 +127,6 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
@Operation(summary = "Return single Artifact metadata",
|
||||
description = "Handles the GET request of retrieving a single Artifact metadata request. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseBody
|
||||
|
||||
Reference in New Issue
Block a user