public ContactsInviteServiceResponse CreateUsers(SspUserManagementServiceRequest request) { var response = new ContactsInviteServiceResponse(); try { UserConnection.DBSecurityEngine.CheckCanManageSspUsers(); var sspUserManagementHelper = new SspUserManagementServiceHelper(UserConnection); sspUserManagementHelper.CheckCanAddRoles(request.UserRoles, request.AccountId); IEnumerable <ISspUserInvitation> result = sspUserManagementHelper.CreateUsersByEmails(request); response.ContactInvites = MapContactsInvites(result); } catch (Exception ex) { response.Exception = ex; } return(response); }
/// <summary> /// Creates portal users by emails. /// </summary> /// <param name="request">Service request.</param> /// <returns>Information about users created by email.</returns> public List <ISspUserInvitation> CreateUsersByEmails(SspUserManagementServiceRequest request) { var emails = request.Emails.Split(' ', ',', ';'); var sspUserCreator = SspUserCreator ?? new SspUserCreator(UserConnection, request.AccountId); foreach (var email in emails) { if (email.Trim() != "") { sspUserCreator.AddInvite(new SspUserInvite { Email = email, UserRoles = request.UserRoles }); } } return(sspUserCreator.CreateUsersByEmails()); }