diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index f163859572c..e419bb3751b 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -732,16 +732,15 @@ public class APIPublisherServiceImpl implements APIPublisherService { } private void updatePermissions(String role, List permissions) throws UserStoreException { + if (role == null || permissions == null) return; AuthorizationManager authorizationManager = APIPublisherDataHolder.getInstance().getUserRealm() .getAuthorizationManager(); if (log.isDebugEnabled()) { log.debug("Updating the role '" + role + "'"); } - if (permissions != null && !permissions.isEmpty()) { - authorizationManager.clearRoleAuthorization(role); - for (String permission : permissions) { - authorizationManager.authorizeRole(role, permission, CarbonConstants.UI_PERMISSION_ACTION); - } + authorizationManager.clearRoleAuthorization(role); + for (String permission : permissions) { + authorizationManager.authorizeRole(role, permission, CarbonConstants.UI_PERMISSION_ACTION); } }