From 52c0e55b07a7f17e670b3e5f9748a9da3bb8554e Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Mon, 28 Jun 2021 14:06:23 +0530 Subject: [PATCH] adding user roles --- .../carbon/device/mgt/core/internal/TenantCreateObserver.java | 2 +- .../device/mgt/core/internal/UserRoleCreateObserver.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/TenantCreateObserver.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/TenantCreateObserver.java index ffc3724a81..79a5309296 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/TenantCreateObserver.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/TenantCreateObserver.java @@ -49,7 +49,7 @@ public class TenantCreateObserver extends AbstractAxis2ConfigurationContextObser DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId) .getUserStoreManager(); String tenantAdminName = userRealm.getRealmConfiguration().getAdminUserName(); - userStoreManager.addRole(User.DEFAULT_DEVICE_USER, null, User.PERMISSIONS_FOR_DEVICE_USER); + userStoreManager.addRole(User.DEFAULT_DEVICE_USER, new String[]{tenantAdminName}, User.PERMISSIONS_FOR_DEVICE_USER); userStoreManager.addRole(User.DEFAULT_DEVICE_ADMIN, new String[]{tenantAdminName}, User.PERMISSIONS_FOR_DEVICE_ADMIN); if (log.isDebugEnabled()) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/UserRoleCreateObserver.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/UserRoleCreateObserver.java index 779dd69191..ce16866524 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/UserRoleCreateObserver.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/UserRoleCreateObserver.java @@ -46,7 +46,8 @@ public class UserRoleCreateObserver implements ServerStartupObserver { new String[]{tenantAdminName}, DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_ADMIN); userStoreManager.addRole( - DeviceManagementConstants.User.DEFAULT_DEVICE_USER, null, + DeviceManagementConstants.User.DEFAULT_DEVICE_USER, + new String[]{tenantAdminName}, DeviceManagementConstants.User.PERMISSIONS_FOR_DEVICE_USER); if (log.isDebugEnabled()) {