public bool Create(string message, IBntWebModule module, SecurityLevel securityLevel = SecurityLevel.Normal, object extension = null) { var userId = "0"; var userName = "******"; try { var currentUser = _userContainer.CurrentUser; if (currentUser != null) { userId = currentUser.Id; userName = currentUser.UserName; } } catch (Exception) { } return(_currencyService.Create(new SystemLog { Id = KeyGenerator.GetGuidKey(), ModuleKey = module.InnerKey, ModuleName = module.InnerDisplayName, UserId = userId, UserName = userName, CreateTime = DateTime.Now, SecurityLevel = securityLevel, Message = message })); }
public void OnSecurityChange(nsIWebProgress progress, nsIRequest request, uint status) { SecurityChangedEventHandler eh = (SecurityChangedEventHandler)(owner.Events[WebBrowser.SecurityChangedEvent]); if (eh != null) { SecurityLevel state = SecurityLevel.Insecure; switch (status) { case 4: state = SecurityLevel.Insecure; break; case 1: state = SecurityLevel.Mixed; break; case 2: state = SecurityLevel.Secure; break; } SecurityChangedEventArgs e = new SecurityChangedEventArgs(state); eh(this, e); } }
/// <summary> /// Event handler for the OK button <c>Click</c> event. Set the <c>SecurityLevel</c> property to the selected security level. /// </summary> /// <param name="sender">Reference to the object that raised the event.</param> /// <param name="e">Parameter passed from the object that raised the event.</param> private void m_ButtonOK_Click(object sender, EventArgs e) { if (m_ComboBoxSecurityLevel.Text.Equals(Security.DescriptionLevel0)) { m_SecurityLevel = SecurityLevel.Level0; } else if (m_ComboBoxSecurityLevel.Text.Equals(Security.DescriptionLevel1)) { m_SecurityLevel = SecurityLevel.Level1; } else if (m_ComboBoxSecurityLevel.Text.Equals(Security.DescriptionLevel2)) { m_SecurityLevel = SecurityLevel.Level2; } else if (m_ComboBoxSecurityLevel.Text.Equals(Security.DescriptionLevel3)) { m_SecurityLevel = SecurityLevel.Level3; } else { m_SecurityLevel = SecurityLevel.Undefined; } DialogResult = DialogResult.OK; Close(); }
/// <summary> /// Get the description corresponding to the specified security level. /// </summary> /// <param name="securityLevel">The security level for which the description is required.</param> /// <returns>The security description corresponding to the specified security level.</returns> public string GetSecurityDescription(SecurityLevel securityLevel) { // Get the description associated with the workset security level. string securityLevelDescription; switch (securityLevel) { case SecurityLevel.Level0: securityLevelDescription = DescriptionLevel0; break; case SecurityLevel.Level1: securityLevelDescription = DescriptionLevel1; break; case SecurityLevel.Level2: securityLevelDescription = DescriptionLevel2; break; case SecurityLevel.Level3: securityLevelDescription = DescriptionLevel3; break; default: securityLevelDescription = string.Empty; break; } return(securityLevelDescription); }
public CommandAttribute(CommandUsage commandUsage, SecurityLevel securityLevel, string help, params string[] alias) { CommandUsage = commandUsage; SecurityLevel = securityLevel; Help = help; Alias = alias; }
public Account(ulong id, string username, string nickname, SecurityLevel securityLevel) { Id = id; Username = username; Nickname = nickname; SecurityLevel = securityLevel; }
protected object DeSerialize(string viewState) { if (viewState == null || viewState.Equals(string.Empty)) { throw new ArgumentNullException("viewState is Nothing or Empty", "DeSerialize params Error"); } //Loads the Current Page Configuration Hashtable cfg = getCryptCfg(); if (cfg["optSlzEncrypt_" + _pHash] != null) { _encript = (SecurityLevel)cfg["optSlzEncrypt_" + _pHash]; } if (cfg["optSlzOptimize_" + _pHash] != null) { _optimize = (bool)cfg["optSlzOptimize_" + _pHash]; } byte[] bytes = Convert.FromBase64String(viewState); switch (_encript) { case SecurityLevel.None: break; case SecurityLevel.Machine: bytes = (byte[])_EncDecMethod.Invoke(null, new object[] { false, bytes, GetMacKeyModifier(base.StateFormatter), 0, bytes.Length }); break; default: bytes = Cryptos(bytes, this.GetKeys, CryptosMode.DeCrypt); break; } try { bytes = GZipDecompress(bytes); } catch (Exception ex) { throw new Exception("ViewState Data Error: " + ex.Message, ex); } if (_optimize) { //optimize for data option System.Runtime.Serialization.Formatters.Binary.BinaryFormatter formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); MemoryStream writer = new MemoryStream(bytes); writer.Position = 0; object transform = formatter.Deserialize(writer); return(cc2(transform)); } else { //classic mode return(DeSerializeInternal(base.StateFormatter, bytes)); } }
public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (Galleon != null) { if (Galleon.Contains(from)) { SecurityLevel level = Galleon.GetSecurityLevel(from); if (level >= SecurityLevel.Crewman) { list.Add(new EmergencyRepairEntry(this, from)); list.Add(new ShipRepairEntry(this, from)); } if (level == SecurityLevel.Captain) { list.Add(new RenameShipEntry(Galleon, from)); list.Add(new MoveTillermanEntry(this, from)); list.Add(new SecuritySettingsEntry(this, from)); list.Add(new ResetSecuritySettings(this, from)); } } else { list.Add(new DryDockEntry(Galleon, from)); } } }
public override void GetContextMenuEntries(Mobile from, List <ContextMenuEntry> list) { base.GetContextMenuEntries(from, list); if (m_Galleon != null && m_Galleon.Contains(from)) { SecurityLevel level = m_Galleon.GetSecurityLevel(from); if (level > SecurityLevel.Passenger) { list.Add(new EmergencyRepairEntry(this, from)); list.Add(new ShipRepairEntry(this, from)); } if (level >= SecurityLevel.Officer) { list.Add(new RenameShipEntry(this, from)); list.Add(new RelocateTillermanEntry(this, from)); } if (level == SecurityLevel.Captain) { list.Add(new SecuritySettingsEntry(this, from)); list.Add(new DefaultSecuritySettings(this, from)); } } else { list.Add(new DryDockEntry(m_Galleon, from)); } }
public Device(IPAddress dAddr, string mName) { deviceAddress = dAddr; networkName = mName; machineSecurityRel = SecurityLevel.Undetermined; properties = new Dictionary <string, string>(); }
public ServiceResult <List <ZahtjevListModelItem> > ZahtjeviZadnjiDodatiKojeJePotrebnoUraditi() { var securityLevel = new SecurityLevel(); var trenutni = authService.TrenutniKorisnik(); var ulogaId = trenutni.TrenutnaUlogaId; var korisnikUlogaId = _context.KorisnikUloge.Where(b => b.KorisnickoIme == trenutni.KorisnickoIme && b.UlogaId == ulogaId).Select(b => b.KorisnikUlogaId).FirstOrDefault(); var projekti = _context.KorisnikProjekti.Where(b => b.KorisnikUlogaId == korisnikUlogaId).Select(b => b.ProjekatId).ToList(); List <ZahtjevListModelItem> zahtjeviZadnjiDodatiKojeJePotrebnoUraditi = new List <ZahtjevListModelItem>(); if (trenutni.TrenutnaUloga.VrijednostUAplikaciji == (int)Uloga.Administrator) { zahtjeviZadnjiDodatiKojeJePotrebnoUraditi = _context.Zahtjevi.Where(z => z.ZahtjevStatus.Oznaka == (int)OznakeStatusa.ToDo && !z.IsDeleted). ToZahtjevListModelItem().OrderByDescending(d => d.DatumKreiranja).Take(5) .ToList(); } else if (trenutni.TrenutnaUloga.VrijednostUAplikaciji == (int)Uloga.Moderator) { zahtjeviZadnjiDodatiKojeJePotrebnoUraditi = _context.Zahtjevi.Where(z => projekti.Contains(z.ProjekatId) && z.ZahtjevStatus.Oznaka == (int)OznakeStatusa.ToDo && !z.IsDeleted). ToZahtjevListModelItem().OrderByDescending(d => d.DatumKreiranja).Take(5) .ToList(); } else if (trenutni.TrenutnaUloga.VrijednostUAplikaciji == (int)Uloga.Support) { var kategorije = _context.KorisnikKategorije.Where(a => a.KorisnickoIme == trenutni.KorisnickoIme).Select(a => a.ZahtjevKategorijaId).ToList(); zahtjeviZadnjiDodatiKojeJePotrebnoUraditi = _context.Zahtjevi.Where(z => kategorije.Contains(z.ZahtjevKategorijaId) && z.ZahtjevStatus.Oznaka == (int)OznakeStatusa.ToDo && !z.IsDeleted). ToZahtjevListModelItem().OrderByDescending(d => d.DatumKreiranja).Take(5) .ToList(); } return(new OkServiceResult <List <ZahtjevListModelItem> >(zahtjeviZadnjiDodatiKojeJePotrebnoUraditi)); }
public List <Bussiness_Logic.SecurityLevel> GetAllSecurityLevels() { List <Bussiness_Logic.SecurityLevel> levels = new List <SecurityLevel>(); string query = $"SELECT * FROM SecurityLevel"; SqlConnection conn = new SqlConnection(connect); SqlCommand command = new SqlCommand(query, conn); try { conn.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { //bool transformData = int.Parse(reader.GetValue(2).ToString()) == 1 ? true : false; Bussiness_Logic.SecurityLevel level = new SecurityLevel(reader.GetInt32(0), reader.GetString(1), reader.GetBoolean(2), reader.GetString(3), reader.GetString(4)); levels.Add(level); } } catch (Exception ex) { MessageBox.Show("Could not find Security Levels " + ex.Message); } finally { conn.Close(); } return(levels); }
/// <summary> /// Initializes a new instance of the class. Loads the <c>ComboBox</c> control with the security level descriptions associated with the project and sets the /// <c>Text</c> property of the <c>ComboBox</c> control to the description corresponding to the specified security level. /// </summary> /// <param name="name">The name of the workset.</param> /// <param name="securityLevelCurrent">The current security level of the workset.</param> public FormSetSecurityLevel(string name, SecurityLevel securityLevelCurrent) { InitializeComponent(); m_LabelWorkset.Text = name; // Populate the ComboBox control with the available security levels. for (short securityLevel = (short)Security.SecurityLevelBase; securityLevel <= (short)Security.SecurityLevelHighest; securityLevel++ ) { string description = Security.GetSecurityDescription((SecurityLevel)securityLevel); m_ComboBoxSecurityLevel.Items.Add(description); } switch (securityLevelCurrent) { case SecurityLevel.Level0: m_ComboBoxSecurityLevel.Text = Security.DescriptionLevel0; break; case SecurityLevel.Level1: m_ComboBoxSecurityLevel.Text = Security.DescriptionLevel1; break; case SecurityLevel.Level2: m_ComboBoxSecurityLevel.Text = Security.DescriptionLevel2; break; case SecurityLevel.Level3: m_ComboBoxSecurityLevel.Text = Security.DescriptionLevel3; break; default: m_ComboBoxSecurityLevel.Text = SecurityLevel.Undefined.ToString(); break; } }
public Account(AccountDto dto) { Id = (ulong)dto.Id; Username = dto.Username; Nickname = dto.Nickname; SecurityLevel = (SecurityLevel)dto.SecurityLevel; }
public static ILogger ForAccount(this ILogger logger, ulong id, string user, SecurityLevel securityLevel = SecurityLevel.User) { return(logger .ForContext("account_id", id) .ForContext("account_user", user) .ForContext("account_level", securityLevel)); }
void OnSecurityChanged(SecurityLevel state) { if (SecurityChanged != null) { SecurityChanged(this, new SecurityChangedEventArgs(state)); } }
public void Logout() { _isAuthenticated = false; _userLevel = SecurityLevel.Unknown; _username = null; _userId = 0; }
/// <summary> /// Updates the ListView control with the list of available worksets. /// </summary> private void UpdateListView() { // Skip, if the Dispose() method has been called. if (IsDisposed) { return; } Cursor = Cursors.WaitCursor; // Clear the list view items. m_ListView.Items.Clear(); // Add the updates list view items. for (int index = 0; index < m_WorksetCollection.Worksets.Count; index++) { // Display the worksets and show which is the default workset. bool isDefaultWorkset = (index == m_WorksetCollection.DefaultIndex) ? true : false; // Get the security level associated with the workset. SecurityLevel securityLevel = m_WorksetCollection.Worksets[index].SecurityLevel; m_ListView.Items.Add(new WorksetItem(m_WorksetCollection.Worksets[index], isDefaultWorkset, securityLevel)); } Cursor = Cursors.Default; }
public User LogInUser(string userName, string password) { // Reads the xml-file and creates a dataset System.Data.DataSet dsUsers = new System.Data.DataSet(); dsUsers.ReadXml(this.configDirectory + settingsReader.GetValue("UsersConfigXml", typeof(string)).ToString()); foreach (System.Data.DataRow dr in dsUsers.Tables[0].Rows) { // Lets read the username in the datarow string tmpUserName = dr["name"].ToString().ToLower(); // If the username matches, lets check the password if (tmpUserName.Equals(userName.ToLower())) { string tmpPassword = dr["password"].ToString().ToUpper(); if (System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "md5").Equals(tmpPassword)) { // Given username and password was correct. Lets read user's securitylevel int securityLevelID = Int32.Parse(dr["securitylevel_id"].ToString()); // Lets create the securitylevel-object SecurityLevel securityLevel = this.GetSecurityLevelByID(securityLevelID); // We get user's id int userID = Int32.Parse(dr["user_id"].ToString()); // And then finally we create the user object User newUser = new User(userID, userName, securityLevel); return(newUser); } } } // Username and password were incorrect return(new User("", 0)); }
private void SetViewStateValues(SecurityLevel EnCrypt, bool Optimize) { // now only in New _encript = EnCrypt; _optimize = Optimize; //need to access to this properties via reflection, because are declared 'internal' Type _PageType = typeof(System.Web.UI.Page); _ClientState = _PageType.GetProperty("ClientState", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); _RequestValueCollection = _PageType.GetProperty("RequestValueCollection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); _RequestViewStateString = _PageType.GetProperty("RequestViewStateString", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); Type _modeType = typeof(ObjectStateFormatter); _GetMemoryStream = _modeType.GetMethod("GetMemoryStream", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); _GetMacKeyModifier = _modeType.GetMethod("GetMacKeyModifier", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); Type machineKeySection = typeof(System.Web.Configuration.MachineKeySection); _EncDecMethod = machineKeySection.GetMethod("EncryptOrDecryptData", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, Type.DefaultBinder, new Type[] { typeof(bool), typeof(byte[]), typeof(byte[]), typeof(int), typeof(int) }, null); }
public SecurityLevel GetSecurityLevelByID(int securityLevelID) { SecurityLevel securityLevel = new SecurityLevel(); securityLevel.SecurityLevelReal = 0; securityLevel.SecurityLevelID = 0; securityLevel.SecurityLevelDescription = ""; // We need some objects System.Configuration.AppSettingsReader settingsReader = new System.Configuration.AppSettingsReader(); string configDirectory = settingsReader.GetValue("XmlConfigDirectory", typeof(string)).ToString(); // We read the required information from the xml-file System.Data.DataSet dataSet = new System.Data.DataSet(); dataSet.ReadXml(configDirectory + settingsReader.GetValue("SecuritylevelsConfigXml", typeof(string)).ToString()); // Cycle through the dataset and set object's information foreach (System.Data.DataRow dr in dataSet.Tables[0].Rows) { if (Int32.Parse(dr["securitylevel_id"].ToString()) == securityLevelID) { securityLevel.SecurityLevelID = securityLevelID; securityLevel.SecurityLevelDescription = dr["name"].ToString(); securityLevel.SecurityLevelReal = Int32.Parse(dr["level"].ToString()); break; } } return(securityLevel); }
/// <summary> /// Saves the hash code associated with the specified security level to the user settings. /// </summary> /// <param name="securityLevel">The security level associated with the hash code.</param> /// <param name="hashCode">The password hash code.</param> public virtual void SaveHashCode(SecurityLevel securityLevel, long hashCode) { // Update the settings. switch (securityLevel) { case SecurityLevel.Level0: break; case SecurityLevel.Level1: Settings.Default.HashCodeLevel1 = hashCode; break; case SecurityLevel.Level2: Settings.Default.HashCodeLevel2 = hashCode; break; case SecurityLevel.Level3: Settings.Default.HashCodeLevel3 = hashCode; break; default: break; } Settings.Default.Save(); }
public ServiceResult <List <int> > ZahtjeviPoSedmicama() { var securityLevel = new SecurityLevel(); var trenutni = authService.TrenutniKorisnik(); int ukupniBrojSedmica = 5; DateTime dateTime = DateTime.Today; var a = StartOfWeek(dateTime); var pocetakProvjere = dateTime.AddDays(-7 * ukupniBrojSedmica); //ponedjeljak Prije Pet Sedmica var ulogaId = trenutni.TrenutnaUlogaId; var korisnikUlogaId = _context.KorisnikUloge.Where(b => b.KorisnickoIme == trenutni.KorisnickoIme && b.UlogaId == ulogaId).Select(b => b.KorisnikUlogaId).FirstOrDefault(); List <int> brojZahtjevarRijesenihPoSedmicama = new List <int>(); if (trenutni.TrenutnaUloga.VrijednostUAplikaciji == (int)Uloga.TaskUser) { for (int i = 0; i < ukupniBrojSedmica; i++) { brojZahtjevarRijesenihPoSedmicama.Add(_context.Zahtjevi. Where(z => z.CreatedBy == trenutni.KorisnickoIme && z.ZahtjevStatus.Oznaka == (int)OznakeStatusa.Done && !z.IsDeleted && z.DatumIzmjene >= pocetakProvjere && z.DatumIzmjene < pocetakProvjere.AddDays(7)).Count()); pocetakProvjere = pocetakProvjere.AddDays(7); } } return(new OkServiceResult <List <int> >(brojZahtjevarRijesenihPoSedmicama)); }
public Device(IPAddress dAddr, string mName, SecurityLevel secState) { deviceAddress = dAddr; networkName = mName; machineSecurityRel = secState; properties = new Dictionary <string, string>(); }
public AccessListGump(Mobile from, BaseGalleon galleon) : base(galleon) { from.CloseGump(typeof(AccessListGump)); m_Galleon = galleon; m_Entry = galleon.SecurityEntry; if (m_Entry == null) { m_Entry = new SecurityEntry(m_Galleon); m_Galleon.SecurityEntry = m_Entry; } AddButton(10, 355, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(45, 357, 100, 18, 1149777, LabelColor, false, false); // MAIN MENU m_UseList = new List <Mobile>(m_Entry.Manifest.Keys); int page = 1; int y = 79; AddPage(page); for (int i = 0; i < m_UseList.Count; i++) { if (page > 1) { AddButton(270, 390, 4014, 4016, 0, GumpButtonType.Page, page - 1); } Mobile mob = m_UseList[i]; if (mob == null || m_Galleon.IsOwner(mob)) { continue; } string name = mob.Name; SecurityLevel level = m_Entry.GetEffectiveLevel(mob); AddButton(10, y, 0xFA5, 0xFA7, i + 2, GumpButtonType.Reply, 0); AddLabel(45, y + 2, 0x3E7, name); AddHtmlLocalized(160, y + 2, 150, 18, GetLevel(level), GetHue(level), false, false); y += 25; bool pages = (i + 1) % 10 == 0; if (pages && m_UseList.Count - 1 != i) { AddButton(310, 390, 4005, 4007, 0, GumpButtonType.Page, page + 1); page++; y = 0; AddPage(page); } } }
public BaseAgent(string name, SecurityLevel securityLevel, Elevator elevator) { Name = name; SecurityLevel = securityLevel; Elevator = elevator; }
public UserInformation(Guid key, SecurityLevel clearance, string name, Gender gender, UserType type) { Key = key; Clearance = clearance; Name = Name; Gender = gender; Type = type; }
public RoomNinjaCustomTokenDialog(IDialogContext context, Uri requestUri, string resource, bool ignoreCache, bool requireConsent) { _securityLevel = context.GetSecurityLevel(); _requestUri = requestUri; _resource = resource; _ignoreCache = ignoreCache; _requireConsent = requireConsent; }
internal SecurityLevel DeepClone() { var clone = new SecurityLevel(Depth, Range); clone.Position = Position; clone._scannerDirection = _scannerDirection; return(clone); }
public RecordItemResult(Guid recordKey, IUserGrain reporter, SecurityLevel securityLabel, bool testResult) { RecordKey = recordKey; Reporter = reporter; SecurityLabel = securityLabel; Timestamp = DateTime.UtcNow; TestResult = testResult; }
public Employee(int ID, HiringDate hiringDate, double Salary, SecurityLevel level, Gender gender) { this.ID = ID; HD = hiringDate; this.Salary = Salary; SL = level; this.gender = gender; }
public User(string use, string pass, SecurityLevel sec, string path) { username = use; password = pass; securityLevel = sec; savePath = path; }
public int GetHue(SecurityLevel level) { switch (level) { case SecurityLevel.Captain: return CaptainHue; case SecurityLevel.Officer: return OfficerHue; case SecurityLevel.Crewman: return CrewHue; case SecurityLevel.Passenger: return PassengerHue; default: return LabelColor; } }
public static int GetLevel(SecurityLevel level) { switch (level) { default: case SecurityLevel.Denied: return 1149726; case SecurityLevel.Passenger: return 1149727; case SecurityLevel.Crewman: return 1149728; case SecurityLevel.Officer: return 1149729; case SecurityLevel.Captain: return 1149730; } }
void OnSecurityChanged(SecurityLevel state) { if (SecurityChanged != null) { SecurityChanged (this, new SecurityChangedEventArgs (state)); } }
/// <summary> /// If the read-only property is not asserted, check the write-enabled status of the watch variable and set/clear the <c>WriteEnabled</c> property accordingly. /// The current state is determined by the specified <paramref name="attributeFlags"/> and <paramref name="securityLevel"/> parameters. True, indicates that the /// watch variable is currently write enabled; false, indicates that the watch variable is currently read-only. /// </summary> /// <param name="attributeFlags">The attribute flags associated with the watch variable.</param> /// <param name="securityLevel">The current security level.</param> private void CheckWriteEnabledStatus(AttributeFlags attributeFlags, SecurityLevel securityLevel) { // Local flag used to determine if the watch variable is currently write enabled. bool writeEnabled; // Check whether the ReadOnly property is asserted. if (ReadOnly == true) { // Yes - Force the user control to be read-only. writeEnabled = false; } else { // Check whether the read-only attribute is set. if ((attributeFlags & AttributeFlags.PTUD_READONLY) == AttributeFlags.PTUD_READONLY) { // Read-only watch variable. writeEnabled = false; } else { // Check whether the current security level is below that required to modify the watch variable. if (((attributeFlags & AttributeFlags.PTUD_PSSWD1) == AttributeFlags.PTUD_PSSWD1) && (securityLevel < SecurityLevel.Level1)) { // Read-only - security level is too low. writeEnabled = false; } else if (((attributeFlags & AttributeFlags.PTUD_PSSWD2) == AttributeFlags.PTUD_PSSWD2) && (securityLevel < SecurityLevel.Level2)) { // Read-only - security level is too low. writeEnabled = false; } else { // Write enabled - display value using bold text. m_LabelValueField.Font = new Font(ClientForm.Font, FontStyle.Bold); writeEnabled = true; } } } SetWriteEnabledProperty(writeEnabled); }
/// <summary> /// Replicate the specified workset i.e. produce a copy of the workset that is completely independent of the original. /// </summary> /// <param name="workset">The workset that is to be copied.</param> public void Replicate(Workset_t workset) { Name = workset.Name; SampleMultiple = workset.SampleMultiple; CountMax = workset.CountMax; SecurityLevel = workset.SecurityLevel; // Copy WatchElementList. WatchElementList = new List<short>(); short watchIdentifier; for (int watchElementIndex = 0; watchElementIndex < workset.WatchElementList.Count; watchElementIndex++) { watchIdentifier = workset.WatchElementList[watchElementIndex]; WatchElementList.Add(watchIdentifier); } Count = WatchElementList.Count; #region - [Column] - Column = new Column_t[workset.Column.Length]; for (int columnIndex = 0; columnIndex < workset.Column.Length; columnIndex++) { Column[columnIndex] = new Column_t(); Column[columnIndex].HeaderText = workset.Column[columnIndex].HeaderText; Column[columnIndex].OldIdentifierList = new List<short>(); short oldIdentifier; for (int rowIndex = 0; rowIndex < workset.Column[columnIndex].OldIdentifierList.Count; rowIndex++) { oldIdentifier = workset.Column[columnIndex].OldIdentifierList[rowIndex]; Column[columnIndex].OldIdentifierList.Add(oldIdentifier); } // Only replicate the chart recorder scaling information if it has been defined. if (workset.Column[columnIndex].ChartScaleList == null) { Column[columnIndex].ChartScaleList = null; } else { Column[columnIndex].ChartScaleList = new List<ChartScale_t>(); ChartScale_t chartScale; for (int rowIndex = 0; rowIndex < workset.Column[columnIndex].ChartScaleList.Count; rowIndex++) { chartScale = workset.Column[columnIndex].ChartScaleList[rowIndex]; Column[columnIndex].ChartScaleList.Add(chartScale); } } } #endregion - [Column] - #region - [PlotTabPages] - // Only replicate the tab page plot information if it has been defined. if (workset.PlotTabPages == null) { PlotTabPages = null; } else { PlotTabPages = new PlotTabPage_t[workset.PlotTabPages.Length]; // Copy the TabPagePlot information to the new array. Array.Copy(workset.PlotTabPages, PlotTabPages, workset.PlotTabPages.Length); } #endregion - [PlotTabPages] - WatchItems = new WatchItem_t[workset.WatchItems.Length]; // Copy the WatchItems property to the new array. Array.Copy(workset.WatchItems, WatchItems, WatchItems.Length); }
/// <summary> /// Sets the current security clearance level to the specified value. /// </summary> /// <param name="securityLevel">The new security level.</param> public virtual void SetLevel(SecurityLevel securityLevel) { m_SecurityLevelCurrent = securityLevel; byte level = (byte)m_SecurityLevelCurrent; m_Description = m_DescriptionArray[level]; m_HashCode = m_HashCodeArray[level]; }
/// <summary> /// Sets the password hash code for the specified security level to the default value and updates the application settings. /// </summary> /// <param name="securityLevel">The security level for which the password hash code is to be reset.</param> public virtual void SetHashCodeToDefault(SecurityLevel securityLevel) { byte level = (byte)securityLevel; m_HashCodeArray[level] = m_DefaultHashCodeArray[level]; SaveHashCode(securityLevel, m_HashCodeArray[level]); }
public SecurityChangedEventArgs (SecurityLevel state) { this.state = state; }
public SecurityEntry(BaseGalleon galleon, GenericReader reader) { m_Manifest = new Dictionary<Mobile, SecurityLevel>(); m_Galleon = galleon; int version = reader.ReadInt(); m_PartyAccess = (PartyAccess)reader.ReadInt(); m_DefaultPublicAccess = (SecurityLevel)reader.ReadInt(); m_DefaultPartyAccess = (SecurityLevel)reader.ReadInt(); m_DefaultGuildAccess = (SecurityLevel)reader.ReadInt(); int count = reader.ReadInt(); for (int i = 0; i < count; i++) { Mobile mob = reader.ReadMobile(); SecurityLevel sl = (SecurityLevel)reader.ReadInt(); AddToManifest(mob, sl); } }
public NotAuthorizedException(SecurityLevel requiredLevel) : base(string.Format("The current user requires the {0} security level to perform the operation.", requiredLevel)) { }
/// <summary> /// Inializes a new instance of the class. Used to create an item that shows a tick icon next to the workset name, depending upon /// the state of the showTick parameter. True, to display a tick icon; otherwise, false. The tick is used to show that the workset /// is the default workset. Also displays the description corresponding to the specified workset security level. /// </summary> public WorksetItem(Workset_t workset, bool showTick, SecurityLevel securityLevel) { m_Workset = workset; base.Text = m_Workset.Name; base.ImageIndex = showTick ? 1 : 0; string securityLevelDescription = new Security().GetSecurityDescription(securityLevel); base.SubItems.Add(securityLevelDescription); }
/// <summary> /// Inializes a new instance of the class. Used to create an item that shows a tick icon next to the workset name, depending upon /// the state of the showTick parameter. True, to display a tick icon; otherwise, false. The tick is used to show that the workset /// is the default workset. Also displays the description corresponding to the specified workset security level. /// </summary> public WorksetItem(Workset_t workset, SecurityLevel securityLevel) { m_Workset = workset; base.Text = m_Workset.Name; string securityLevelDescription = new Security().GetSecurityDescription(securityLevel); base.SubItems.Add(securityLevelDescription); }
/// <summary> /// Event handler for the OK button <c>Click</c> event. Set the <c>SecuityLevel</c> property to the selected security level. /// </summary> /// <param name="sender">Reference to the object that raised the event.</param> /// <param name="e">Parameter passed from the object that raised the event.</param> private void m_ButtonOK_Click(object sender, EventArgs e) { if (m_ComboBoxSecurityLevel.Text.Equals(Security.DescriptionLevel0)) { m_SecurityLevel = SecurityLevel.Level0; } else if (m_ComboBoxSecurityLevel.Text.Equals(Security.DescriptionLevel1)) { m_SecurityLevel = SecurityLevel.Level1; } else if (m_ComboBoxSecurityLevel.Text.Equals(Security.DescriptionLevel2)) { m_SecurityLevel = SecurityLevel.Level2; } else { m_SecurityLevel = SecurityLevel.Undefined; } DialogResult = DialogResult.OK; Close(); }
/// <summary> /// Initializes a new instance of the structure. /// </summary> /// <param name="descriptionLevel0">The description associated with security level 0.</param> /// <param name="descriptionLevel1">The description associated with security level 1.</param> /// <param name="descriptionLevel2">The description associated with security level 2.</param> /// <param name="descriptionLevel3">The description associated with security level 3.</param> /// <param name="securityLevelBase">The base security level, i.e. the security level that the PTU is set to on startup.</param> /// <param name="securityLevelHighest">The highest security level appropriate to the client.</param> public SecurityConfiguration_t(string descriptionLevel0, string descriptionLevel1, string descriptionLevel2, string descriptionLevel3, SecurityLevel securityLevelBase, SecurityLevel securityLevelHighest) { m_DescriptionLevel0 = descriptionLevel0; m_DescriptionLevel1 = descriptionLevel1; m_DescriptionLevel2 = descriptionLevel2; m_DescriptionLevel3 = descriptionLevel3; m_SecurityLevelBase = securityLevelBase; m_SecurityLevelHighest = securityLevelHighest; }
/// <summary> /// Saves the hash code associated with the specified security level to the user settings. /// </summary> /// <param name="securityLevel">The security level associated with the hash code.</param> /// <param name="hashCode">The password hash code.</param> public virtual void SaveHashCode(SecurityLevel securityLevel, long hashCode) { // Update the settings. switch (securityLevel) { case SecurityLevel.Level0: break; case SecurityLevel.Level1: Settings.Default.HashCodeLevel1 = hashCode; break; case SecurityLevel.Level2: Settings.Default.HashCodeLevel2 = hashCode; break; case SecurityLevel.Level3: Settings.Default.HashCodeLevel3 = hashCode; break; default: break; } Settings.Default.Save(); }
/// <summary> /// Initializes a new instance of the <see cref="WinPhone8CryptoProvider" /> class. /// </summary> /// <param name="securityLevel">The security level to apply to this instance. The default is <see cref="SecurityLevel.Maximum"/>.</param> public WinPhone8CryptoProvider(SecurityLevel securityLevel) { Requires.NotNull(securityLevel, "securityLevel"); securityLevel.Apply(this); }
public void SetToDefault() { m_PartyAccess = PartyAccess.MemberOnly; m_DefaultPublicAccess = SecurityLevel.Denied; m_DefaultPartyAccess = SecurityLevel.Crewman; m_DefaultGuildAccess = SecurityLevel.Officer; }
public AdministrationShapeFileLayer(string pathFileName, SecurityLevel securityLevel) : base(pathFileName) { this.securityLevel = securityLevel; }
public AdministrationShapeFileLayer(string pathFileName) : base(pathFileName) { securityLevel = SecurityLevel.AdministrativeLevel; }
public bool AddToManifest(Mobile from, SecurityLevel access) { if (from == null || m_Manifest == null) return false; //if (m_Manifest.ContainsKey(from) && m_Manifest[from] >= access) // return true; m_Manifest[from] = access; return true; }
/// <summary> /// Sets the password hash code for the specified security level to the specified value and updates the application settings. /// </summary> /// <param name="securityLevel">The security level for which the password hash code is to be set.</param> /// <param name="newHashCode">The new password hash code.</param> public virtual void SetHashCode(SecurityLevel securityLevel, long newHashCode) { byte level = (byte)securityLevel; m_HashCodeArray[level] = newHashCode; SaveHashCode(securityLevel, newHashCode); }
/// <summary> /// Initializes a new instance of the <see cref="DesktopCryptoProvider" /> class. /// </summary> /// <param name="securityLevel">The security level to apply to this instance. The default is <see cref="SecurityLevel.Maximum"/>.</param> public DesktopCryptoProvider(SecurityLevel securityLevel) { Requires.NotNull(securityLevel, "securityLevel"); securityLevel.Apply(this); }
/// <summary> /// Initialize a new instance of the structure. Creates a new workset based upon the specified name and list of watch identifiers. /// </summary> /// <param name="name">The name of the workset.</param> /// <param name="watchIdentifierList">The list of watch identifiers that are to be used to initialize the workset.</param> /// <param name="entryCountMax">The maximum number of entries that the workset can support.</param> /// <param name="columnCountMax">The maximum number of display columns that the workset can support.</param> /// <param name="securityLevel">The security level associated with the workset.</param> /// <remarks> /// All watch identifiers contained within the specified list will appear in the first column of the workset in the order that they appear in the list. The /// watch element list is sorted by watch identifier value in ascending order. /// </remarks> public Workset_t(string name, List<short> watchIdentifierList, short entryCountMax, short columnCountMax, SecurityLevel securityLevel) { Debug.Assert(name != string.Empty, "Workset_t.Ctor() - [name != string.Empty]"); Debug.Assert(watchIdentifierList != null, "Workset_t.Ctor() - [watchElementList != null]"); Debug.Assert((watchIdentifierList.Count > 0), "Workset_t.Ctor() - [watchElementList.Count > 0"); Name = name; SampleMultiple = DefaultSampleMultiple; CountMax = entryCountMax; SecurityLevel = securityLevel; // Create the WatchElementList property. WatchElementList = new List<short>(); short watchIdentifier; for (int watchIdentifierIndex = 0; watchIdentifierIndex < watchIdentifierList.Count; watchIdentifierIndex++) { watchIdentifier = watchIdentifierList[watchIdentifierIndex]; WatchElementList.Add(watchIdentifier); } WatchElementList.Sort(); Count = WatchElementList.Count; #region - [Column] - Column = new Column_t[columnCountMax]; for (int columnIndex = 0; columnIndex < columnCountMax; columnIndex++) { Column[columnIndex] = new Column_t(); Column[columnIndex].HeaderText = (columnIndex == 0) ? Resources.LegendColumn + CommonConstants.Space + (columnIndex + 1).ToString() : string.Empty; Column[columnIndex].OldIdentifierList = new List<short>(); Column[columnIndex].ChartScaleList = new List<ChartScale_t>(); } // Add the old identifier values of the watch variables defined in the watch element list to the first column of the workset. WatchVariable watchVariable; ChartScale_t chartScale; for (short watchIdentifierIndex = 0; watchIdentifierIndex < WatchElementList.Count; watchIdentifierIndex++) { chartScale = new ChartScale_t(); try { watchVariable = Lookup.WatchVariableTable.Items[watchIdentifierList[watchIdentifierIndex]]; if (watchVariable == null) { throw new Exception(); } else { Column[0].OldIdentifierList.Add(watchVariable.OldIdentifier); // Set up the default chart scaling from the values in the data dictionary. chartScale.ChartScaleUpperLimit = watchVariable.MaxChartScale; chartScale.ChartScaleLowerLimit = watchVariable.MinChartScale; chartScale.Units = watchVariable.Units; Column[0].ChartScaleList.Add(chartScale); } } catch (Exception) { Column[0].OldIdentifierList.Add(CommonConstants.OldIdentifierNotDefined); // Set the chart scaling values to represent an invalid entry. chartScale.ChartScaleLowerLimit = double.NaN; chartScale.ChartScaleUpperLimit = double.NaN; chartScale.Units = CommonConstants.ChartScaleUnitsNotDefinedString; Column[0].ChartScaleList.Add(chartScale); } } #endregion - [Column] - // This attribute is used to define the plot screen layout and is defined by the user when displaying the saved data file. PlotTabPages = null; WatchItems = new WatchItem_t[Lookup.WatchVariableTableByOldIdentifier.Items.Length]; // Create the WatchItems property from the list of watch elements. WatchItems = CreateWatchItems(WatchElementList, Lookup.WatchVariableTableByOldIdentifier.Items.Length); }
/// <summary> /// Initialize the class properties using the security configuration parameters defined in the data dictionary. /// </summary> public static void Initialize() { m_HashCodeArray[0] = DefaultHashCodeLevel0; m_HashCodeArray[1] = Settings.Default.HashCodeLevel1; m_HashCodeArray[2] = Settings.Default.HashCodeLevel2; m_HashCodeArray[3] = DefaultHashCodeLevel3; m_DefaultDescriptionLevel0 = Parameter.SecurityConfiguration.DescriptionLevel0; m_DefaultDescriptionLevel1 = Parameter.SecurityConfiguration.DescriptionLevel1; m_DefaultDescriptionLevel2 = Parameter.SecurityConfiguration.DescriptionLevel2; m_DefaultDescriptionLevel3 = Parameter.SecurityConfiguration.DescriptionLevel3; m_DefaultDescriptionArray = new string[] { m_DefaultDescriptionLevel0, m_DefaultDescriptionLevel1, m_DefaultDescriptionLevel2, m_DefaultDescriptionLevel3 }; m_DescriptionArray = new string[] { m_DefaultDescriptionLevel0, m_DefaultDescriptionLevel1, m_DefaultDescriptionLevel2, m_DefaultDescriptionLevel3 }; m_SecurityLevelCurrent = Parameter.SecurityConfiguration.SecurityLevelBase; m_Description = m_DescriptionArray[(short)m_SecurityLevelCurrent]; m_HashCode = m_HashCodeArray[(short)m_SecurityLevelCurrent]; m_SecurityLevelBase = Parameter.SecurityConfiguration.SecurityLevelBase; m_SecurityLevelHighest = Parameter.SecurityConfiguration.SecurityLevelHighest; }
/// <summary> /// Get the description corresponding to the specified security level. /// </summary> /// <param name="securityLevel">The security level for which the description is required.</param> /// <returns>The security description corresponding to the specified security level.</returns> public string GetSecurityDescription(SecurityLevel securityLevel) { // Get the description associated with the workset security level. string securityLevelDescription; switch (securityLevel) { case SecurityLevel.Level0: securityLevelDescription = DescriptionLevel0; break; case SecurityLevel.Level1: securityLevelDescription = DescriptionLevel1; break; case SecurityLevel.Level2: securityLevelDescription = DescriptionLevel2; break; case SecurityLevel.Level3: securityLevelDescription = DescriptionLevel3; break; default: securityLevelDescription = string.Empty; break; } return securityLevelDescription; }