Search in sources :

Example 1 with SysSystemEntityService

use of eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService in project CzechIdMng by bcvsolutions.

the class SysSystemEntityController method getConnectorObject.

@ResponseBody
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_READ + "')")
@RequestMapping(value = "/{backendId}/connector-object", method = RequestMethod.GET)
@ApiOperation(value = "Connector object for the system entity", nickname = "getConnectorObject", response = IcConnectorObject.class, tags = { SysSystemEntityController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = AccGroupPermission.SYSTEM_READ, description = "") }) })
public ResponseEntity<IcConnectorObject> getConnectorObject(@ApiParam(value = "System entity's uuid identifier.", required = true) @PathVariable @NotNull String backendId) {
    SysSystemEntityDto systemEntity = this.getDto(backendId);
    if (systemEntity == null) {
        throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", backendId));
    }
    IcConnectorObject connectorObject = ((SysSystemEntityService) getService()).getConnectorObject(systemEntity, IdmBasePermission.READ);
    if (connectorObject == null) {
        return new ResponseEntity<IcConnectorObject>(HttpStatus.NO_CONTENT);
    }
    return new ResponseEntity<IcConnectorObject>(connectorObject, HttpStatus.OK);
}
Also used : SysSystemEntityService(eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService) ResponseEntity(org.springframework.http.ResponseEntity) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) SysSystemEntityDto(eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)1 SysSystemEntityService (eu.bcvsolutions.idm.acc.service.api.SysSystemEntityService)1 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)1 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ResponseEntity (org.springframework.http.ResponseEntity)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1