// internal ss.User GetSuplexUser(bool resolve) //{ // return this.GetSuplexUser( resolve, true ); //} internal ss.User GetSuplexUser(string userName, bool resolve = false, bool resolveRls = true) { ss.User user = new ss.User() { Name = userName, CreateUnresolvedName = true }; if (resolve) { user.DataAccessor = _da; //this is just for the option of avoiding the AD lookup if (resolveRls) { ExternalGroupInfo egi = new ExternalGroupInfo(LdapRoot, true, GlobalExternalGroupsCsv); egi.BuildGroupsList(userName); sg.SqlResult result = user.ResolveByName(true, egi.GroupsList); //sometimes multithreaded requests to create a new user get too close together, causing a dup-username error //this is a cheap retry if (result.SqlException != null) { if (result.SqlException.Number == 2601) //2601 == duplicate value error { System.Threading.Thread.Sleep(500); result = user.ResolveByName(true, egi.GroupsList); } //if err not duplicate or it still didn't work in retry, throw the exeption if (result.SqlException != null) { throw result.SqlException; } } } else { user.ResolveByName(); } } if (user.RlsMask == null) { user.RlsMask = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; } return(user); }
public SuplexUserRecord GetSuplexResolvedUserByName(string name) { ss.User user = new ss.User() { Name = name, CreateUnresolvedName = true, DataAccessor = _da }; user.ResolveByName(); return(user.FromSuplexNative()); }