Merge branch 'RED-10521' into 'main'
RED-10521: Remove the simple get-tenants endpoint See merge request fforesight/tenant-user-management-service!142
This commit is contained in:
commit
a169fb585c
@ -17,7 +17,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
|||||||
import com.knecon.fforesight.tenantcommons.model.TenantResponse;
|
import com.knecon.fforesight.tenantcommons.model.TenantResponse;
|
||||||
import com.knecon.fforesight.tenantcommons.model.UpdateDetailsRequest;
|
import com.knecon.fforesight.tenantcommons.model.UpdateDetailsRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.SimpleTenantResponse;
|
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
||||||
|
|
||||||
@ -43,8 +42,7 @@ public interface TenantsResource {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
||||||
@Operation(summary = "Deletes given tenant", description = "None")
|
@Operation(summary = "Deletes given tenant", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK"), @ApiResponse(responseCode = "403", description = "Forbidden access, you dont have rights to delete tenants"), @ApiResponse(responseCode = "405", description = "Operation is not allowed."),
|
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "OK"), @ApiResponse(responseCode = "403", description = "Forbidden access, you dont have rights to delete tenants"), @ApiResponse(responseCode = "405", description = "Operation is not allowed."), @ApiResponse(responseCode = "409", description = "Conflict while deleting tenant.")})
|
||||||
@ApiResponse(responseCode = "409", description = "Conflict while deleting tenant.")})
|
|
||||||
@DeleteMapping(value = TENANTS_TENANT_ID_PATH)
|
@DeleteMapping(value = TENANTS_TENANT_ID_PATH)
|
||||||
void deleteTenant(@PathVariable("tenantId") String tenantId);
|
void deleteTenant(@PathVariable("tenantId") String tenantId);
|
||||||
|
|
||||||
@ -73,12 +71,6 @@ public interface TenantsResource {
|
|||||||
void updateDetails(@PathVariable("tenantId") String tenantId, @RequestBody UpdateDetailsRequest request);
|
void updateDetails(@PathVariable("tenantId") String tenantId, @RequestBody UpdateDetailsRequest request);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = TENANTS_PATH + "/simple", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Gets all existing tenants in a simplified format", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<SimpleTenantResponse> getSimpleTenants();
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/deploymentKey" + TENANT_ID_PATH_PARAM, produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = "/deploymentKey" + TENANT_ID_PATH_PARAM, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Returns the deployment key for a tenant", description = "None")
|
@Operation(summary = "Returns the deployment key for a tenant", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import com.knecon.fforesight.tenantcommons.TenantApplicationType;
|
|||||||
import com.knecon.fforesight.tenantcommons.model.TenantResponse;
|
import com.knecon.fforesight.tenantcommons.model.TenantResponse;
|
||||||
import com.knecon.fforesight.tenantcommons.model.UpdateDetailsRequest;
|
import com.knecon.fforesight.tenantcommons.model.UpdateDetailsRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.SimpleTenantResponse;
|
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
||||||
|
|
||||||
@ -61,12 +60,6 @@ public interface InternalTenantsResource {
|
|||||||
TenantResponse updateTenant(@PathVariable("tenantId") String tenantId, @RequestBody UpdateTenantRequest tenantRequest);
|
TenantResponse updateTenant(@PathVariable("tenantId") String tenantId, @RequestBody UpdateTenantRequest tenantRequest);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/tenants/simple", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
@Operation(summary = "Gets all existing tenant in a simplified format", description = "None")
|
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
|
||||||
List<SimpleTenantResponse> getSimpleTenants();
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping(value = "/deploymentKey" + TENANT_ID_PATH_PARAM, produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = "/deploymentKey" + TENANT_ID_PATH_PARAM, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@Operation(summary = "Returns the deployment key for a tenant", description = "None")
|
@Operation(summary = "Returns the deployment key for a tenant", description = "None")
|
||||||
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "OK")})
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import com.knecon.fforesight.tenantcommons.model.UpdateDetailsRequest;
|
|||||||
import com.knecon.fforesight.tenantusermanagement.api.external.PublicResource;
|
import com.knecon.fforesight.tenantusermanagement.api.external.PublicResource;
|
||||||
import com.knecon.fforesight.tenantusermanagement.api.external.TenantsResource;
|
import com.knecon.fforesight.tenantusermanagement.api.external.TenantsResource;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.SimpleTenantResponse;
|
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.service.DeploymentKeyService;
|
import com.knecon.fforesight.tenantusermanagement.service.DeploymentKeyService;
|
||||||
@ -77,12 +76,6 @@ public class TenantsController implements TenantsResource, PublicResource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<SimpleTenantResponse> getSimpleTenants() {
|
|
||||||
|
|
||||||
return tenantManagementService.getTenants().stream().map(t -> new SimpleTenantResponse(t.getTenantId(), t.getDisplayName(), t.getGuid())).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('" + UPDATE_TENANT + "')")
|
@PreAuthorize("hasAuthority('" + UPDATE_TENANT + "')")
|
||||||
public TenantResponse updateTenant(String tenantId, @RequestBody UpdateTenantRequest tenantRequest) {
|
public TenantResponse updateTenant(String tenantId, @RequestBody UpdateTenantRequest tenantRequest) {
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,6 @@ import com.knecon.fforesight.tenantusermanagement.api.internal.InternalResource;
|
|||||||
import com.knecon.fforesight.tenantusermanagement.api.internal.InternalTenantsResource;
|
import com.knecon.fforesight.tenantusermanagement.api.internal.InternalTenantsResource;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.CreateTenantRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
import com.knecon.fforesight.tenantusermanagement.model.DeploymentKeyResponse;
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.SimpleTenantResponse;
|
|
||||||
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
import com.knecon.fforesight.tenantusermanagement.model.UpdateTenantRequest;
|
||||||
import com.knecon.fforesight.tenantusermanagement.service.DeploymentKeyService;
|
import com.knecon.fforesight.tenantusermanagement.service.DeploymentKeyService;
|
||||||
import com.knecon.fforesight.tenantusermanagement.service.TenantManagementService;
|
import com.knecon.fforesight.tenantusermanagement.service.TenantManagementService;
|
||||||
@ -68,12 +67,6 @@ public class InternalTenantsController implements InternalTenantsResource, Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<SimpleTenantResponse> getSimpleTenants() {
|
|
||||||
|
|
||||||
return tenantManagementService.getTenants().stream().map(t -> new SimpleTenantResponse(t.getTenantId(), t.getDisplayName(), t.getGuid())).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DeploymentKeyResponse getDeploymentKey(@PathVariable(TENANT_ID_PARAM) String tenantId) {
|
public DeploymentKeyResponse getDeploymentKey(@PathVariable(TENANT_ID_PARAM) String tenantId) {
|
||||||
|
|
||||||
return new DeploymentKeyResponse(deploymentKeyService.getDeploymentKey(tenantId));
|
return new DeploymentKeyResponse(deploymentKeyService.getDeploymentKey(tenantId));
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
package com.knecon.fforesight.tenantusermanagement.model;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Builder
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Schema(description = "Object containing a simplified version of the tenant data.")
|
|
||||||
public class SimpleTenantResponse {
|
|
||||||
|
|
||||||
@Schema(description = "Parameter containing the ID of the tenant.")
|
|
||||||
private String tenantId;
|
|
||||||
@Schema(description = "Parameter containing the display name of the tenant.")
|
|
||||||
private String displayName;
|
|
||||||
@Schema(description = "Parameter containing the global unique ID of the tenant.")
|
|
||||||
private String guid;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -101,7 +101,7 @@ spring:
|
|||||||
password: ${REDIS_PASSWORD:}
|
password: ${REDIS_PASSWORD:}
|
||||||
fforesight:
|
fforesight:
|
||||||
keycloak:
|
keycloak:
|
||||||
ignored-endpoints: [ '/actuator/health', '/actuator/health/**', '/tenant-user-management', '/tenant-user-management/', '/internal/**','/tenant-user-management/docs/**','/tenant-user-management/docs','/tenant-user-management/tenants/simple' ]
|
ignored-endpoints: [ '/actuator/health', '/actuator/health/**', '/tenant-user-management', '/tenant-user-management/', '/internal/**','/tenant-user-management/docs/**','/tenant-user-management/docs' ]
|
||||||
enabled: true
|
enabled: true
|
||||||
springdoc:
|
springdoc:
|
||||||
base-path: '/tenant-user-management'
|
base-path: '/tenant-user-management'
|
||||||
|
|||||||
@ -17,8 +17,8 @@ public class StartupTest extends AbstractTenantUserManagementIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testStartup() {
|
public void testStartup() {
|
||||||
|
|
||||||
var simpleTenants = internalTenantsClient.getSimpleTenants();
|
var tenants = internalTenantsClient.getTenants();
|
||||||
assertThat(simpleTenants).isNotEmpty();
|
assertThat(tenants).isNotEmpty();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,7 +90,7 @@ spring:
|
|||||||
|
|
||||||
fforesight:
|
fforesight:
|
||||||
keycloak:
|
keycloak:
|
||||||
ignored-endpoints: [ '/actuator/health', '/tenant-user-management','/internal/**','/tenant-user-management/docs/**','/tenant-user-management/docs','/tenant-user-management/tenants/simple' ]
|
ignored-endpoints: [ '/actuator/health', '/tenant-user-management','/internal/**','/tenant-user-management/docs/**','/tenant-user-management/docs' ]
|
||||||
enabled: true
|
enabled: true
|
||||||
springdoc:
|
springdoc:
|
||||||
base-path: '/tenant-user-management'
|
base-path: '/tenant-user-management'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user