Fix group retrieving issues

pull/186/head
Rajitha Kumara 1 year ago
parent e7f12be117
commit 2b8e4b7c63

@ -1353,7 +1353,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO {
+ "FROM DM_DEVICE d, " + "FROM DM_DEVICE d, "
+ "(SELECT dgm.DEVICE_ID " + "(SELECT dgm.DEVICE_ID "
+ "FROM DM_DEVICE_GROUP_MAP dgm " + "FROM DM_DEVICE_GROUP_MAP dgm "
+ "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? AND TENANT_ID = ? )) dgm1 " + "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? AND TENANT_ID = ?)) dgm1 "
+ "WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t " + "WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t "
+ "WHERE gd.DEVICE_TYPE_ID = t.ID) d1 " + "WHERE gd.DEVICE_TYPE_ID = t.ID) d1 "
+ "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?"; + "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ?";

@ -673,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() + "@" + ctx.getTenantDomain(true); String username = ctx.getUsername();
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