Fix grouping issues

pull/186/head
Rajitha Kumara 1 year ago
parent 3b4f159bf6
commit f2f37215da

@ -660,8 +660,12 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
private DeviceGroup findGroupFromTree(List<DeviceGroup> tree, int groupId) { private DeviceGroup findGroupFromTree(List<DeviceGroup> tree, int groupId) {
for (DeviceGroup node: tree) { for (DeviceGroup node: tree) {
if (node.getGroupId() == groupId) return node; if (node.getGroupId() == groupId) return node;
if (node.getChildrenGroups() != null) if (node.getChildrenGroups() != null) {
return findGroupFromTree(node.getChildrenGroups(), groupId); DeviceGroup tempNode = findGroupFromTree(node.getChildrenGroups(), groupId);
if (tempNode != null) {
return tempNode;
}
}
} }
return null; return null;
} }
@ -669,7 +673,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
@Override @Override
public DeviceGroup getUserOwnGroup(int groupId, boolean requireGroupProps, int depth) throws GroupManagementException { public DeviceGroup getUserOwnGroup(int groupId, boolean requireGroupProps, int depth) throws GroupManagementException {
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
String username = ctx.getUsername(); String username = ctx.getUsername() + "@" + ctx.getTenantDomain(true);
int tenantId = ctx.getTenantId(); int tenantId = ctx.getTenantId();
List<Integer> userOwnGroupIds = this.getGroupIds(username); List<Integer> userOwnGroupIds = this.getGroupIds(username);
if (userOwnGroupIds == null) { if (userOwnGroupIds == null) {

Loading…
Cancel
Save