Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Disable same user to create multiple service instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Rathna Natarajan committed Jul 3, 2019
1 parent 9d49c8a commit 5ccf175
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ public boolean createOrgAndUser(String orgName, String email, String serviceInst
return false;
}

// Check whether the user is already associated with some other organization
if( apiUser.getOrganizationId() != null){

This comment has been minimized.

Copy link
@remisbaima

remisbaima Aug 22, 2019

This line 140 will throw NullPointerException because line 134 "axwayUserClient.getUser(email)" will return null for new users.

throw new AxwayException("A user with the supplied login name already exists");
}

orgId = axwayOrganzationClient.createOrganization(orgName, email, serviceInstanceId);
String userId = axwayUserClient.createUser(orgId, email);
axwayUserClient.resetPassword(userId);
Expand Down Expand Up @@ -167,7 +172,7 @@ public boolean deleteOrgAppAndUser(String email, String serviceInstanceId) throw
String apiId = apiOrganizationAccess.getApiId();
FrondendAPI frondendAPI = axwayAPIClient.getAPI(apiId);
if (frondendAPI.getState().equals(PUBLISHED)) {
logger.info("Publised APIs are avaialble under the organization");
logger.info("Published APIs are available under the organization");
throw new AxwayException(
"Can't delete Organization as it has published API, Please unpublish the API from API Manager");
}
Expand Down

0 comments on commit 5ccf175

Please sign in to comment.