Skip to content

Commit

Permalink
Handle role permission update when authorized api is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaminduR committed Feb 21, 2024
1 parent 6b7ac10 commit 86c0d26
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ public void deleteAuthorizedAPI(String appId, String apiId, String tenantDomain)
listener.preDeleteAuthorizedAPI(appId, apiId, tenantDomain);
}
authorizedAPIDAO.deleteAuthorizedAPI(appId, apiId, IdentityTenantUtil.getTenantId(tenantDomain));
try {
List<String> apiScopes = ApplicationManagementServiceComponentHolder.getInstance().getAPIResourceManager()
.getAPIResourceById(apiId, tenantDomain).getScopes().stream().map(Scope::getName)
.collect(Collectors.toList());
updateRolesWithRemovedScopes(appId, apiScopes, tenantDomain);
} catch (APIResourceMgtException e) {
throw buildServerException("Error while retrieving API resource.", e);
}
for (AuthorizedAPIManagementListener listener : listeners) {
listener.postDeleteAuthorizedAPI(appId, apiId, tenantDomain);
}
Expand Down

0 comments on commit 86c0d26

Please sign in to comment.