mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request #747 from sinthuja/master
Fixing some issues reported for product-iots.
This commit is contained in:
commit
8830d627e9
@ -173,7 +173,10 @@ public class GroupManagementServiceImpl implements GroupManagementService {
|
|||||||
.manageGroupSharing(groupId, userRoles);
|
.manageGroupSharing(groupId, userRoles);
|
||||||
return Response.status(Response.Status.OK).build();
|
return Response.status(Response.Status.OK).build();
|
||||||
} catch (GroupManagementException e) {
|
} catch (GroupManagementException e) {
|
||||||
String msg = "Error occurred while managing group share.";
|
String msg = "Error occurred while managing group share. ";
|
||||||
|
if (e.getErrorMessage() != null){
|
||||||
|
msg += e.getErrorMessage();
|
||||||
|
}
|
||||||
log.error(msg, e);
|
log.error(msg, e);
|
||||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||||
} catch (RoleDoesNotExistException e) {
|
} catch (RoleDoesNotExistException e) {
|
||||||
|
|||||||
@ -367,6 +367,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
@Override
|
@Override
|
||||||
public void manageGroupSharing(int groupId, List<String> newRoles)
|
public void manageGroupSharing(int groupId, List<String> newRoles)
|
||||||
throws GroupManagementException, RoleDoesNotExistException {
|
throws GroupManagementException, RoleDoesNotExistException {
|
||||||
|
if (newRoles != null) {
|
||||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
UserStoreManager userStoreManager;
|
UserStoreManager userStoreManager;
|
||||||
try {
|
try {
|
||||||
@ -401,6 +402,9 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
} finally {
|
} finally {
|
||||||
GroupManagementDAOFactory.closeConnection();
|
GroupManagementDAOFactory.closeConnection();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new GroupManagementException("No roles provided to complete the operation.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -469,12 +473,12 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
try {
|
try {
|
||||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
GroupManagementDAOFactory.beginTransaction();
|
GroupManagementDAOFactory.beginTransaction();
|
||||||
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers){
|
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) {
|
||||||
device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier);
|
device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
throw new DeviceNotFoundException("Device not found for id '" + deviceIdentifier.getId() + "'");
|
throw new DeviceNotFoundException("Device not found for id '" + deviceIdentifier.getId() + "'");
|
||||||
}
|
}
|
||||||
if (!this.groupDAO.isDeviceMappedToGroup(groupId, device.getId(), tenantId)){
|
if (!this.groupDAO.isDeviceMappedToGroup(groupId, device.getId(), tenantId)) {
|
||||||
this.groupDAO.addDevice(groupId, device.getId(), tenantId);
|
this.groupDAO.addDevice(groupId, device.getId(), tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -501,7 +505,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|||||||
try {
|
try {
|
||||||
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
GroupManagementDAOFactory.beginTransaction();
|
GroupManagementDAOFactory.beginTransaction();
|
||||||
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers){
|
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) {
|
||||||
device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier);
|
device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
throw new DeviceNotFoundException("Device not found for id '" + deviceIdentifier.getId() + "'");
|
throw new DeviceNotFoundException("Device not found for id '" + deviceIdentifier.getId() + "'");
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"appContext": "/devicemgt/",
|
"appContext": "/devicemgt/",
|
||||||
"isCloud": false,
|
"isCloud": false,
|
||||||
"httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%",
|
"httpsURL": "https://%iot.gateway.host%:%iot.gateway.https.port%",
|
||||||
"httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port",
|
"httpURL": "http://%iot.gateway.host%:%iot.gateway.http.port%",
|
||||||
"wssURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
|
"wssURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
|
||||||
"portalURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
|
"portalURL": "https://%iot.analytics.host%:%iot.analytics.https.port%",
|
||||||
"dashboardServerURL": "%https.ip%",
|
"dashboardServerURL": "%https.ip%",
|
||||||
|
|||||||
@ -381,7 +381,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-5 col-md-6 col-centered">
|
<div class="col-lg-5 col-md-6 col-centered">
|
||||||
<h3>Unexpected error occurred!</h3>
|
<h3 id="unexp-error-msg">Unexpected error occurred!</h3>
|
||||||
|
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<a href="#" id="group-unexpected-error-link" class="btn-operations">
|
<a href="#" id="group-unexpected-error-link" class="btn-operations">
|
||||||
|
|||||||
@ -112,7 +112,7 @@ function toTitleCase(str) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function htmlspecialchars(text){
|
function htmlspecialchars(text) {
|
||||||
return jQuery('<div/>').text(text).html();
|
return jQuery('<div/>').text(text).html();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,6 +633,9 @@ function displayErrors(jqXHR) {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$(modalPopupContent).html($('#group-unexpected-error-content').html());
|
$(modalPopupContent).html($('#group-unexpected-error-content').html());
|
||||||
|
if (jqXHR.responseText) {
|
||||||
|
$('#unexp-error-msg').html(jqXHR.responseText.replace(new RegExp("\"", 'g'), ""));
|
||||||
|
}
|
||||||
$("a#group-unexpected-error-link").click(function () {
|
$("a#group-unexpected-error-link").click(function () {
|
||||||
hidePopup();
|
hidePopup();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user