Commit 4eccf7f9165bf03b5905981c0a2bea60ed823b78

Authored by YevhenBondarenko
1 parent ba1b000a

fix validateCreate from UserServiceImpl

@@ -372,14 +372,16 @@ public class UserServiceImpl extends AbstractEntityService implements UserServic @@ -372,14 +372,16 @@ public class UserServiceImpl extends AbstractEntityService implements UserServic
372 private DataValidator<User> userValidator = 372 private DataValidator<User> userValidator =
373 new DataValidator<User>() { 373 new DataValidator<User>() {
374 @Override 374 @Override
375 - protected void validateCreate(TenantId tenantId, User data) {  
376 - DefaultTenantProfileConfiguration profileConfiguration =  
377 - (DefaultTenantProfileConfiguration)tenantProfileCache.get(tenantId).getProfileData().getConfiguration();  
378 - long maxUsers = profileConfiguration.getMaxUsers();  
379 - if (maxUsers > 0) {  
380 - long currentUsersCount = userDao.countUsersByTenantId(tenantId);  
381 - if (currentUsersCount >= maxUsers) {  
382 - throw new DataValidationException("Can't create users more then " + maxUsers); 375 + protected void validateCreate(TenantId tenantId, User user) {
  376 + if (!user.getTenantId().getId().equals(ModelConstants.NULL_UUID)) {
  377 + DefaultTenantProfileConfiguration profileConfiguration =
  378 + (DefaultTenantProfileConfiguration) tenantProfileCache.get(tenantId).getProfileData().getConfiguration();
  379 + long maxUsers = profileConfiguration.getMaxUsers();
  380 + if (maxUsers > 0) {
  381 + long currentUsersCount = userDao.countUsersByTenantId(tenantId);
  382 + if (currentUsersCount >= maxUsers) {
  383 + throw new DataValidationException("Can't create users more then " + maxUsers);
  384 + }
383 } 385 }
384 } 386 }
385 } 387 }