Skip to content

Commit

Permalink
Avoid changing sp name when changing app owner
Browse files Browse the repository at this point in the history
  • Loading branch information
rmsamitha committed Aug 5, 2024
1 parent 5ee8f03 commit 6fa42e4
Showing 1 changed file with 0 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -924,21 +924,10 @@ public ExtendedApplication updateApplicationOwner(String applicationOwner, Strin
ServiceProvider sp = getServiceProvider(appDTO.getApplicationName(), tenantDomain);
sp.setOwner(User.getUserFromUserName(applicationOwner));

String previousOwner = MultitenantUtils.getTenantAwareUsername(appDTO.getUsername()).replaceAll("@", "-AT-");
updateServiceProvider(sp, tenantDomain, MultitenantUtils.getTenantAwareUsername(appDTO.getUsername()));
appDTO.setUsername(applicationOwner);

String newApplicationName = "";
if (!StringUtils.equals(previousOwner, applicationOwner)) {
String keyType = appDTO.getApplicationName().substring(appDTO.getApplicationName().lastIndexOf("_") + 1);
String appName = StringUtils.substringBetween(appDTO.getApplicationName(),
previousOwner.replace("@", "-AT-").replace("/", "_"), keyType);
newApplicationName = MultitenantUtils.getTenantAwareUsername(applicationOwner.replace("/", "_").
replaceAll("@", "-AT-")) + appName + keyType;
sp.setApplicationName(newApplicationName);
}
updateServiceProvider(sp, tenantDomain, MultitenantUtils.getTenantAwareUsername(applicationOwner));
appDTO.setApplicationName(newApplicationName);

// Update application
try {
Expand Down

0 comments on commit 6fa42e4

Please sign in to comment.