mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
resolve comments
This commit is contained in:
parent
7a7974eb36
commit
7b1907cd90
@ -860,15 +860,15 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
log.debug("Get groups count");
|
log.debug("Get groups count");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
||||||
GroupManagementDAOFactory.openConnection();
|
GroupManagementDAOFactory.openConnection();
|
||||||
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
return groupDAO.getGroupCount(tenantId, null);
|
return groupDAO.getGroupCount(tenantId, null);
|
||||||
} catch (GroupManagementDAOException | SQLException e) {
|
} catch (GroupManagementDAOException e) {
|
||||||
String msg = "Error occurred while retrieving all groups in tenant";
|
String msg = "Error occurred while retrieving all groups in tenant";
|
||||||
log.error(msg, e);
|
log.error(msg, e);
|
||||||
throw new GroupManagementException(msg, e);
|
throw new GroupManagementException(msg, e);
|
||||||
} catch (Exception e) {
|
} catch (SQLException e) {
|
||||||
String msg = "Error occurred";
|
String msg = "Error occurred while opening a connection to the data source.";
|
||||||
log.error(msg, e);
|
log.error(msg, e);
|
||||||
throw new GroupManagementException(msg, e);
|
throw new GroupManagementException(msg, e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -1000,16 +1000,15 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
UserStoreManager userStoreManager;
|
UserStoreManager userStoreManager;
|
||||||
int count;
|
int count;
|
||||||
try {
|
try {
|
||||||
|
GroupManagementDAOFactory.openConnection();
|
||||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId)
|
userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId)
|
||||||
.getUserStoreManager();
|
.getUserStoreManager();
|
||||||
if (isAdminUser(username, userStoreManager)) {
|
if (isAdminUser(username, userStoreManager)) {
|
||||||
GroupManagementDAOFactory.openConnection();
|
|
||||||
count = groupDAO.getGroupCount(tenantId, null);
|
count = groupDAO.getGroupCount(tenantId, null);
|
||||||
return count;
|
return count;
|
||||||
}else {
|
} else {
|
||||||
String[] roleList = userStoreManager.getRoleListOfUser(username);
|
String[] roleList = userStoreManager.getRoleListOfUser(username);
|
||||||
GroupManagementDAOFactory.openConnection();
|
|
||||||
count = groupDAO.getOwnGroupsCount(username, tenantId, parentPath);
|
count = groupDAO.getOwnGroupsCount(username, tenantId, parentPath);
|
||||||
count += groupDAO.getGroupsCount(roleList, tenantId, parentPath);
|
count += groupDAO.getGroupsCount(roleList, tenantId, parentPath);
|
||||||
return count;
|
return count;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user