private bool NotifyDifferentUser(Activation activation) { Guid userId = _identityResolver.GetUserId(); if (activation.TenantId != userId) { AddNotification("Usuário inválido", "O usuário não tem autorização para acessar os dados."); return(true); } return(false); }
public void Register(RegisterCompanyCommand command) { command.Validate(); if (AddNotifications(command)) { return; } Company company = _factory.CreateCompany(command.Name, command.Description, command.Email, command.Cnpj, command.InscricaoEstadual, command.OwnerName, command.OwnerBirthday, command.OwnerCpf, _identityResolver.GetUserId()); if (NotifyCnpjExists(company.Cnpj, company.Id)) { return; } _repository.Register(company); if (Commit()) { Publish(new RegisteredCompanyIntegrationEvent(company.Id, company.Email.Email, company.TenantId)); } }
public void Register(Company company) { company.SetTenantId(_identityResolver.GetUserId()); _dbContext.Add(company); }