Search in sources :

Example 1 with AccAccountService

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

the class AccAccountController method getConnectorObject.

@ResponseBody
@PreAuthorize("hasAuthority('" + AccGroupPermission.SYSTEM_READ + "')")
@RequestMapping(value = "/{backendId}/connector-object", method = RequestMethod.GET)
@ApiOperation(value = "Connector object for the account. Contains only attributes for witch have a schema attribute definitons.", 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 = "Account's uuid identifier.", required = true) @PathVariable @NotNull String backendId) {
    AccAccountDto account = this.getDto(backendId);
    if (account == null) {
        throw new ResultCodeException(CoreResultCode.NOT_FOUND, ImmutableMap.of("entity", backendId));
    }
    IcConnectorObject connectorObject = ((AccAccountService) getService()).getConnectorObject(account, IdmBasePermission.READ);
    if (connectorObject == null) {
        return new ResponseEntity<IcConnectorObject>(HttpStatus.NO_CONTENT);
    }
    return new ResponseEntity<IcConnectorObject>(connectorObject, HttpStatus.OK);
}
Also used : AccAccountService(eu.bcvsolutions.idm.acc.service.api.AccAccountService) ResponseEntity(org.springframework.http.ResponseEntity) IcConnectorObject(eu.bcvsolutions.idm.ic.api.IcConnectorObject) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) AccAccountDto(eu.bcvsolutions.idm.acc.dto.AccAccountDto) 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

AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)1 AccAccountService (eu.bcvsolutions.idm.acc.service.api.AccAccountService)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