This commit is contained in:
@@ -217,16 +217,16 @@ public class AuthService {
|
||||
throw new IllegalStateException("Company not have tariff");
|
||||
}
|
||||
|
||||
Tariff tariff = tariffInfo.getTariff();
|
||||
Long maxUsers = tariff.getMaxUsers();
|
||||
long currentCountUsers = userRepository.countByCompanyId(company.getId());
|
||||
|
||||
if (currentCountUsers >= maxUsers) {
|
||||
throw new NotValidFieldException("Max user is over.", new BaseResponse(20002,
|
||||
MessageCode.USER_LIMIT_IS_OVER.getCode(),
|
||||
MessageCode.USER_LIMIT_IS_OVER.getDescription(), Map.of(
|
||||
"limit", maxUsers, "countUser", currentCountUsers)));
|
||||
}
|
||||
// Tariff tariff = tariffInfo.getTariff();
|
||||
// Long maxUsers = tariff.getMaxUsers();
|
||||
// long currentCountUsers = userRepository.countByCompanyId(company.getId());
|
||||
//
|
||||
// if (currentCountUsers >= maxUsers) {
|
||||
// throw new NotValidFieldException("Max user is over.", new BaseResponse(20002,
|
||||
// MessageCode.USER_LIMIT_IS_OVER.getCode(),
|
||||
// MessageCode.USER_LIMIT_IS_OVER.getDescription(), Map.of(
|
||||
// "limit", maxUsers, "countUser", currentCountUsers)));
|
||||
// }
|
||||
|
||||
user.setCompany(company);
|
||||
user.grantPermission(Permission.DEFAULT_USER_PERMISSIONS);
|
||||
|
||||
Reference in New Issue
Block a user