public async Task Import(string id, [FromBody] ImportOrganizationUsersRequestModel model) { var orgIdGuid = new Guid(id); if (!_currentContext.OrganizationAdmin(orgIdGuid)) { throw new NotFoundException(); } var userId = _userService.GetProperUserId(User); await _organizationService.ImportAsync( orgIdGuid, userId.Value, model.Groups.Select(g => g.ToImportedGroup(orgIdGuid)), model.Users.Where(u => !u.Deleted).Select(u => u.ToImportedOrganizationUser()), model.Users.Where(u => u.Deleted).Select(u => u.ExternalId)); }
public async Task Import(string id, [FromBody] ImportOrganizationUsersRequestModel model) { if (!_globalSettings.SelfHosted && (model.Groups.Count() > 200 || model.Users.Count() > 1000)) { throw new BadRequestException("You cannot import this much data at once."); } var orgIdGuid = new Guid(id); if (!_currentContext.OrganizationAdmin(orgIdGuid)) { throw new NotFoundException(); } var userId = _userService.GetProperUserId(User); await _organizationService.ImportAsync( orgIdGuid, userId.Value, model.Groups.Select(g => g.ToImportedGroup(orgIdGuid)), model.Users.Where(u => !u.Deleted).Select(u => u.ToImportedOrganizationUser()), model.Users.Where(u => u.Deleted).Select(u => u.ExternalId)); }