From 7cc8e85aac1ac0e5ae12a17cd4fe2cf3e1918944 Mon Sep 17 00:00:00 2001 From: pasant9 Date: Wed, 8 Jan 2025 13:37:13 +0530 Subject: [PATCH] Clear cache after internal role update Fix: https://github.com/wso2/api-manager/issues/3502 --- .../listeners/KeyManagerUserOperationListener.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/src/main/java/org/wso2/carbon/apimgt/tokenmgt/listeners/KeyManagerUserOperationListener.java b/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/src/main/java/org/wso2/carbon/apimgt/tokenmgt/listeners/KeyManagerUserOperationListener.java index 033208a79812..05bdbdbc8f23 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/src/main/java/org/wso2/carbon/apimgt/tokenmgt/listeners/KeyManagerUserOperationListener.java +++ b/components/apimgt/org.wso2.carbon.apimgt.tokenmgt/src/main/java/org/wso2/carbon/apimgt/tokenmgt/listeners/KeyManagerUserOperationListener.java @@ -176,6 +176,18 @@ public boolean doPreUpdateRoleListOfUser(String username, String[] deletedRoles, return true; } + @Override + public boolean doPreUpdateInternalRoleListOfUser(String userName, String[] deletedRoles, + String[] newRoles, + UserStoreManager userStoreManager) { + + if (!isEnable()) { + return true; + } + APIUtil.clearRoleCache(getUserName(userName, userStoreManager)); + return true; + } + @Override public boolean doPreUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) {