|
|
@ -375,6 +375,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
tenantId).getUserStoreManager();
|
|
|
|
tenantId).getUserStoreManager();
|
|
|
|
List<String> currentUserRoles = getRoles(groupId);
|
|
|
|
List<String> currentUserRoles = getRoles(groupId);
|
|
|
|
GroupManagementDAOFactory.beginTransaction();
|
|
|
|
GroupManagementDAOFactory.beginTransaction();
|
|
|
|
|
|
|
|
if (newRoles != null) {
|
|
|
|
for (String role : newRoles) {
|
|
|
|
for (String role : newRoles) {
|
|
|
|
if (!userStoreManager.isExistingRole(role)) {
|
|
|
|
if (!userStoreManager.isExistingRole(role)) {
|
|
|
|
throw new RoleDoesNotExistException("Role '" + role + "' does not exists in the user store.");
|
|
|
|
throw new RoleDoesNotExistException("Role '" + role + "' does not exists in the user store.");
|
|
|
@ -386,6 +387,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
|
|
|
|
groupDAO.addRole(groupId, role, tenantId);
|
|
|
|
groupDAO.addRole(groupId, role, tenantId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
for (String role : currentUserRoles) {
|
|
|
|
for (String role : currentUserRoles) {
|
|
|
|
// Removing old roles from db which are not available in the new roles list.
|
|
|
|
// Removing old roles from db which are not available in the new roles list.
|
|
|
|
groupDAO.removeRole(groupId, role, tenantId);
|
|
|
|
groupDAO.removeRole(groupId, role, tenantId);
|
|
|
@ -469,12 +471,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 +503,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() + "'");
|
|
|
|