public bool ResolveUserTransport() { if (_Entity == null) return false; if( _Entity.UserTransport == null ) return false; _UserTransport = new UserTransport(_Entity.UserTransport); return true; }
public UserTransport UpdateUserTransport(string userName, string transportName, string originalAddress, string address) { HTTPBasicCheckAttribute.AdditionalCheck(userName, HTTPCheckRoles.sysAdmin | HTTPCheckRoles.clinAdmin); UserTransportEntity ute = new CriticalResultsEntityManager().UpdateUserTransport(userName, transportName, originalAddress, address); UserTransport ut = new UserTransport(ute); ut.ResolveTransport(); ut.ResolveLevels(); return ut; }
public UserTransport[] GetUserTransports(string userName) { HTTPBasicCheckAttribute.AdditionalCheck(userName, HTTPCheckRoles.sysAdmin | HTTPCheckRoles.clinAdmin); UserTransportEntity[] tes = new CriticalResultsEntityManager().GetUserTransports(userName); List<UserTransport> transports = new List<UserTransport>(); foreach (UserTransportEntity te in tes) { UserTransport transport = new UserTransport(te); transport.ResolveLevels(); transport.ResolveTransport(); transports.Add(transport); } return transports.ToArray(); }
public User CreateUser(ActiveDirectoryUser adUser) { ActiveDirectoryUser[] adUsers = _Service.SearchActiveDirectory(adUser.cn); if (adUsers.Length > 1) { throw new UserCreationException("Multiple user accounts found in Active Directory for " + adUser.cn + ". Cannot continue."); } else if (adUsers.Length == 0) { throw new UserCreationException("No user account found in Active Directory for " + adUser.cn + ". Cannot continue."); } ResultsService manager = new ResultsService(); Level[] levels = manager.GetLevels(); Transport[] transports = manager.GetTransports(); Transport smtp = null; foreach (Transport transport in transports) { if (transport.Name == Properties.Settings.Default.SmtpTransportName) smtp = transport; } User user = new User(); user.UserName = adUser.mail; user.MiddleName = ""; user.LastName = adUser.sn ?? ""; user.FirstName = adUser.givenName ?? ""; user.Enabled = true; List<UserTransport> userTransports = new List<UserTransport>(); if (smtp != null) { UserTransport userMail = new UserTransport(); userMail.Address = adUser.mail ?? ""; userMail.Levels = levels; userMail.Transport = smtp; userTransports.Add(userMail); } user.Transports = userTransports.ToArray(); Extension.DefaultExtension.ExtendUserFromExternalDirectory(user, transports, levels, adUser.mail, adUser.proxyAddresses); user = manager.CreateANCRUser(user); manager.AssignUserToRole(user.UserName, "Receiver"); //manager.AccountConfirmation(user.UserName); //manager.CreatePassword(user.UserName); Setting[] settings = manager.GetSettings_NonWeb("System"); string defaultAccountDomain = ""; foreach (Setting setting in settings) { if (setting.EntryKey == "DefaultAccountDomain") defaultAccountDomain = setting.Value; } manager.UserEntry(user.UserName, "AuthExt", "Windows", defaultAccountDomain + "\\" + adUser.cn, ""); return user; }
public bool ResolveUserTransports() { if (_Entity.UserTransports != null) { _UserTransports = new List<UserTransport>(); foreach (UserTransportEntity e in _Entity.UserTransports) { UserTransport t = new UserTransport(e); _UserTransports.Add(t); } } else { return false; } return true; }
public bool ResolveTransports() { if (_Entity == null) return false; if (_Entity.UserTransports == null) return false; _UserTransports = new List<UserTransport>(); foreach (UserTransportEntity e in _Entity.UserTransports) { UserTransport t = new UserTransport(e); t.ResolveTransport(); _UserTransports.Add(t); } return true; }