diff --git a/service/src/main/java/org/sunbird/actor/user/UserOwnershipTransferActor.java b/service/src/main/java/org/sunbird/actor/user/UserOwnershipTransferActor.java index 93facffd2..686abebda 100644 --- a/service/src/main/java/org/sunbird/actor/user/UserOwnershipTransferActor.java +++ b/service/src/main/java/org/sunbird/actor/user/UserOwnershipTransferActor.java @@ -34,6 +34,7 @@ public void onReceive(Request request) throws Throwable { } private void handleOwnershipTransfer(Request request) { + validateOrganizationId(request.getRequest()); validateUserDetails(request.getRequest(), request.getRequestContext()); String userId = (String) ((Map) request.getRequest().get(JsonKey.ACTION_BY)) .get(JsonKey.USER_ID); @@ -48,6 +49,13 @@ private void handleOwnershipTransfer(Request request) { sender().tell(response, self()); } + private void validateOrganizationId(Map requestData) { + if (!requestData.containsKey(JsonKey.ORGANISATION_ID) || + StringUtils.isBlank((String) requestData.get(JsonKey.ORGANISATION_ID))) { + throwInvalidRequestDataException("Organization ID is mandatory in the request."); + } + } + private void validateUserDetails(Map data, RequestContext requestContext) { validateAndProceed(data, JsonKey.ACTION_BY, requestContext); validateAndProceed(data, JsonKey.FROM_USER, requestContext);