/// <summary> /// Set privileges that are stored as privs in Mobius user parameters /// </summary> /// <param name="ui"></param> public static void SetUserParmPrivileges(UserInfo ui) { Dictionary <string, string> ups = UserObjectDao.GetUserParameters(ui.UserName); string prefix = "Privilege"; foreach (string uoName in ups.Keys) // store other non-ad privileges { if (!Lex.StartsWith(uoName, prefix) || // Privilege user parm? Lex.Ne(ups[uoName], "True")) { continue; // and granted? } string privName = uoName.Substring(prefix.Length); if (!PrivilegesMx.IsValidPrivilegeName(privName)) { continue; } if (Lex.Eq(privName, "Logon")) { continue; // ignore old Logon priv from database } ui.Privileges.SetPrivilege(privName, true); } if (!ups.ContainsKey("NAMEADDRESS")) // store user name and address in Mobius db if not there already { Security.CreateUser(ui); } return; }
public static void Load() { string value; int i1; PrefDict = UserObjectDao.GetUserParameters(Security.UserName); SS.I.PreferredProjectId = // get preferred project Get("PreferredProject", "DEFAULT_FOLDER"); SS.I.TableColumnZoom = GetInt("TableColumnZoom", 100); SS.I.GraphicsColumnZoom = GetInt("GraphicsColumnZoom", 100); SS.I.ScrollGridByPixel = GetBool("ScrollGridByPixel", false); // default to row scrolling SS.I.AsyncImageRetrieval = GetBool("AsyncImageRetrieval", true); try // get preferred number format { value = Get("DefaultNumberFormat", "SigDigits"); EnumUtil.TryParse(value, out SS.I.DefaultNumberFormat); SS.I.DefaultDecimals = GetInt("DefaultDecimals", 3); } catch (Exception ex) { } SS.I.RepeatReport = // repeating report across page GetBool("RepeatReport", false); MqlUtil.DefaultToSingleStepQueryExecution = // default to single step query execution GetBool("DefaultToSingleStepQueryExecution", false); if (MqlUtil.DefaultToSingleStepQueryExecution) { QueryEngine.SetParameter("DefaultToSingleStepQueryExecution", MqlUtil.DefaultToSingleStepQueryExecution.ToString()); // set in QE for current session } SS.I.FindRelatedCpdsInQuickSearch = GetBool("FindRelatedCpdsInQuickSearch", true); SS.I.RestoreWindowsAtStartup = // get bool for restoring windows at startup GetBool("RestoreWindowsAtStartup", false); SS.I.BreakHtmlPopupsAtPageWidth = GetBool("BreakHtmlPopupsAtPageWidth", true); try // qualified number splitting { value = Get("QualifiedNumberSplit"); SS.I.QualifiedNumberSplit = QnfSplitControl.DeserializeQualifiedNumberSplit(value); } catch (Exception ex) { } SS.I.HilightCidChanges = GetBool("HilightCorpIdChanges", true); SS.I.RemoveLeadingZerosFromCids = GetBool("RemoveLeadingZerosFromCids", true); SS.I.GridMarkCheckBoxesInitially = // (always false initially now) GetBool("GridMarkCheckBoxesInitially", false); value = Get("DefaultHorizontalAlignment", MetaColumn.SessionDefaultHAlignment.ToString()); MetaColumn.SessionDefaultHAlignment = (HorizontalAlignmentEx)Enum.Parse(typeof(HorizontalAlignmentEx), value, true); value = Get("DefaultVerticalAlignment", MetaColumn.SessionDefaultVAlignment.ToString()); MetaColumn.SessionDefaultVAlignment = (VerticalAlignmentEx)Enum.Parse(typeof(VerticalAlignmentEx), value, true); SS.I.EvenRowBackgroundColor = Color.FromArgb(GetInt("EvenRowBackgroundColor", Color.WhiteSmoke.ToArgb())); // slightly contrasting color SS.I.OddRowBackgroundColor = Color.FromArgb(GetInt("OddRowBackgroundColor", Color.White.ToArgb())); ClientDirs.DefaultMobiusUserDocumentsFolder = Preferences.Get("DefaultExportFolder", ClientDirs.DefaultMobiusUserDocumentsFolder); MoleculeFormat molFormat = MoleculeFormat.Molfile; value = Get("PreferredMoleculeFormat", "Molfile"); if (Enum.TryParse(value, out molFormat)) { MoleculeMx.PreferredMoleculeFormat = molFormat; } return; }