|
|
|
@ -367,6 +367,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
|
@Override
|
|
|
|
|
public void manageGroupSharing(int groupId, List<String> newRoles)
|
|
|
|
|
throws GroupManagementException, RoleDoesNotExistException {
|
|
|
|
|
if (newRoles != null) {
|
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
|
UserStoreManager userStoreManager;
|
|
|
|
|
try {
|
|
|
|
@ -401,6 +402,9 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
|
} finally {
|
|
|
|
|
GroupManagementDAOFactory.closeConnection();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new GroupManagementException("No roles provided to complete the operation.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -469,12 +473,12 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
|
try {
|
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
|
GroupManagementDAOFactory.beginTransaction();
|
|
|
|
|
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers){
|
|
|
|
|
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) {
|
|
|
|
|
device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier);
|
|
|
|
|
if (device == null) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -501,7 +505,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
|
try {
|
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
|
GroupManagementDAOFactory.beginTransaction();
|
|
|
|
|
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers){
|
|
|
|
|
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) {
|
|
|
|
|
device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier);
|
|
|
|
|
if (device == null) {
|
|
|
|
|
throw new DeviceNotFoundException("Device not found for id '" + deviceIdentifier.getId() + "'");
|
|
|
|
|