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");
|
||||
}
|
||||
try {
|
||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
GroupManagementDAOFactory.openConnection();
|
||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
return groupDAO.getGroupCount(tenantId, null);
|
||||
} catch (GroupManagementDAOException | SQLException e) {
|
||||
} catch (GroupManagementDAOException e) {
|
||||
String msg = "Error occurred while retrieving all groups in tenant";
|
||||
log.error(msg, e);
|
||||
throw new GroupManagementException(msg, e);
|
||||
} catch (Exception e) {
|
||||
String msg = "Error occurred";
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while opening a connection to the data source.";
|
||||
log.error(msg, e);
|
||||
throw new GroupManagementException(msg, e);
|
||||
} finally {
|
||||
@ -1000,16 +1000,15 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
||||
UserStoreManager userStoreManager;
|
||||
int count;
|
||||
try {
|
||||
GroupManagementDAOFactory.openConnection();
|
||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||
userStoreManager = DeviceManagementDataHolder.getInstance().getRealmService().getTenantUserRealm(tenantId)
|
||||
.getUserStoreManager();
|
||||
if (isAdminUser(username, userStoreManager)) {
|
||||
GroupManagementDAOFactory.openConnection();
|
||||
count = groupDAO.getGroupCount(tenantId, null);
|
||||
return count;
|
||||
} else {
|
||||
String[] roleList = userStoreManager.getRoleListOfUser(username);
|
||||
GroupManagementDAOFactory.openConnection();
|
||||
count = groupDAO.getOwnGroupsCount(username, tenantId, parentPath);
|
||||
count += groupDAO.getGroupsCount(roleList, tenantId, parentPath);
|
||||
return count;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user