public Match(Declaration declaration, AccessLevels accessLevel, string inheritedFrom, string isOfType) { _accessLevel = accessLevel; _declaration = declaration; _inheritedFrom = inheritedFrom; _isOfType = isOfType; }
public Master(AccessLevels accessLevel) { Get["/"] = Index; Get["/index"] = Index; Post["/login"] = parameters => { int id = -1; if (!int.TryParse(this.Request.Form.Fullname.Value, out id)) { return(Response.AsRedirect(String.Format("Index?{0}={1}&{2}={3}", BaseWebModule.Login, BaseWebModule.Failed, BaseWebModule.ID, id))); } string password = this.Request.Form.UserPassword; if (this.LoginUser(id, password)) { return(Response.AsRedirect("Index")); } else { return(Response.AsRedirect(String.Format("Index?{0}={1}&{2}={3}", BaseWebModule.Login, BaseWebModule.Failed, BaseWebModule.ID, id))); } }; Post["/logout"] = parameters => { this.Logout(); return(Response.AsRedirect("Index")); }; }
public CommandEntry(string command, CommandEventHandler handler, AccessLevels accessLevel, TargetType targ) { m_TargetType = targ; m_Command = command; m_Handler = handler; m_AccessLevel = accessLevel; }
public static void CreateAccount_OnCommand(KonsoleCommandEventArgs e) { Console.Write("Input account name: "); string name = Console.ReadLine(); if (HelperTools.AccExists(name)) { Console.WriteLine("This name already exists, try another.."); return; } Console.Write("Input account password: "******"Input account plevel (0-player, 1-gm, 2-admin): "); string splevel = Console.ReadLine(); AccessLevels plevel = AccessLevels.PlayerLevel; switch (splevel) { case "2": { plevel = AccessLevels.Admin; break; } case "1": { plevel = AccessLevels.GM; break; } default: { plevel = AccessLevels.PlayerLevel; break; } } World.allAccounts.Add(new Account(name, pass, plevel)); Console.WriteLine("Account: \"{0}\", pass: \"{1}\", plevel: \"{2}\" created", name, pass, plevel); }
public static string FormatAccessLevel(AccessLevels accessLevel) { switch (accessLevel) { case AccessLevels.Private: return("private"); case AccessLevels.Protected: return("protected"); case AccessLevels.Public: return("public"); case AccessLevels.InternalPrivate: return("internal private"); case AccessLevels.InternalProtected: return("internal protected"); case AccessLevels.InternalPublic: return("internal public"); default: throw new NotImplementedException(); } }
public IHttpActionResult AddAssignments(Guid id, Guid userId, AccessLevels accessLevel) { if (id == Guid.Empty) { return(BadRequest("project id is empty")); } if (userId == Guid.Empty) { return(BadRequest("user id is empty")); } var project = UnitOfWork.ProjectsRepository.Find(id); if (project == null) { return(NotFound()); } var orgUser = UnitOfWork.OrgUsersRepository.Find(userId); if (orgUser == null) { return(NotFound()); } var assignment = UnitOfWork.AssignmentsRepository.AssignAccessLevel(id, userId, accessLevel, grant: true); var result = Mapper.Map <ProjectAssignmentDTO>(assignment); MemoryCacher.DeleteStartingWith("ORG_TEAMS_ASSIGNMENTS"); return(Ok(result)); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { var isAuthorized = base.AuthorizeCore(httpContext); if (!isAuthorized) { return(false); } if (string.IsNullOrEmpty(this.AccessLevels)) { return(true); } else { UserPrincipal principal = (UserPrincipal)httpContext.User; string[] roles = this.AccessLevels.Split(','); foreach (string role in roles) { AccessLevels level = (AccessLevels)Enum.Parse(typeof(AccessLevels), role); Authorities authority = (Authorities)Enum.Parse(typeof(Authorities), this.Authority); if (principal.IsInRole(level, authority)) { return(true); } } return(false); } }
public AccessPermission(AccessLevels level) { None = false; Read = false; Write = false; Full = false; switch (level) { case AccessLevels.None: break; case AccessLevels.Read: Read = true; break; case AccessLevels.Write: Write = true; break; case AccessLevels.Full: Read = true; Write = true; Full = true; break; } }
public Master(AccessLevels accessLevel) { Get["/"] = Index; Get["/index"] = Index; Post["/login"] = parameters => { int id = -1; if (!int.TryParse(this.Request.Form.Fullname.Value, out id)) { return Response.AsRedirect(String.Format("Index?{0}={1}&{2}={3}", BaseWebModule.Login, BaseWebModule.Failed, BaseWebModule.ID, id)); } string password = this.Request.Form.UserPassword; if (this.LoginUser(id, password)) { return Response.AsRedirect("Index"); } else { return Response.AsRedirect(String.Format("Index?{0}={1}&{2}={3}", BaseWebModule.Login, BaseWebModule.Failed, BaseWebModule.ID, id)); } }; Post["/logout"] = parameters => { this.Logout(); return Response.AsRedirect("Index"); }; }
public BaseWebModule(AccessLevels accessLevel) { this.AccessLevel = accessLevel; Before += ctx => { if (this.IsValidUser()) { this.Context.ViewBag.IsValidUser = true; this.Context.ViewBag.FullName = this.FullName; if (IsValidManager()) { this.Context.ViewBag.IsValidUserManager = true; } if (IsValidAdmin()) { this.Context.ViewBag.IsValidUserAdmin = true; } } this.SetupFooter(); switch (this.AccessLevel) { case AccessLevels.Admin: if (!this.IsValidAdmin()) { return Response.AsRedirect(String.Format("index?{0}={1}", BaseWebModule.Login, BaseWebModule.RequiredAdmin)); } break; case AccessLevels.Manager: if (!this.IsValidManager()) { return Response.AsRedirect(String.Format("index?{0}={1}", BaseWebModule.Login, BaseWebModule.RequiredManager)); } break; case AccessLevels.User: if (!this.IsValidUser()) { return Response.AsRedirect(String.Format("index?{0}={1}", BaseWebModule.Login, BaseWebModule.RequiredUser)); } break; case AccessLevels.None: break; } if (this.Request.Query[Master.NavBar] != null) { switch (((string)this.Request.Query[Master.NavBar]).ToLower()) { case Master.Hidden: this.Context.ViewBag.IsNavBarHidden = true; break; } } return null; }; }
public Match(Declaration declaration, AccessLevels accessLevel, string inheritedFrom, string isOfType, string markedWithAttribute) { _accessLevel = accessLevel; _declaration = declaration; _inheritedFrom = inheritedFrom; _markedWithAttribute = markedWithAttribute; _isOfType = isOfType; }
public AccessLevelDescription(AccessLevels accessLevel, string name, string description, bool showEffective, bool showNotEffective) { AccessLevel = accessLevel; Name = name; Description = description; ShowEffective = showEffective; ShowNotEffective = showNotEffective; }
public CommandEventArgs(Character player, Mobile target, string command, string argString, string[] arguments, TargetType targType, bool isimpl, AccessLevels accLevel) { m_Player = player; m_Target = target; m_Command = command; m_ArgString = argString; m_Arguments = arguments; m_TargetType = targType; m_IsImpl = isimpl; m_AccessLevel = accLevel; }
public Bank ShowInformation(AccessLevels accessLevels) { try { return(db.Banks.First()); } catch (Exception e) { return(null); } }
private void ShowUserPriviledges(AccessLevels userAccess) { foreach (Control button in buttonBox.Controls) { if (button.Name.Contains("Yes") || button.Name.Contains("No")) { button.Visible = false; } } if (userAccess == AccessLevels.Admin) { foreach (Control button in buttonBox.Controls) { if (button.Name.Contains("Yes")) { button.Visible = true; } } } else if (userAccess == AccessLevels.Regular) { editPrivLabelNo.Visible = true; productPrivLabelYes.Visible = true; //ADD REST OF PRIVILEDGES HERE. } //List<Label> _priviledgeLabels = null; //Console.WriteLine(userAccess); //_priviledgeLabels = new List<Label>(); //for (int i = 0; i < buttonBox.Controls.Count; i++) //{ //_priviledgeLabels.Add(new Label()); //_priviledgeLabels[i].Font = yesLabel.Font; // _priviledgeLabels[i].Size = yesLabel.Size; //_priviledgeLabels[i].ForeColor = yesLabel.ForeColor; //_priviledgeLabels[i].AutoSize = true; // _priviledgeLabels[i].Text = yesLabel.Text; ////_priviledgeLabels[i].StartPosition = FormStartPosition.Manual; ////_priviledgeLabels[i].Location = new Point(200 , 200); //_priviledgeLabels[i].Location = new Point(buttonBox.Controls[i].Location.X + buttonBox.Controls[i].Size.Width + 5, buttonBox.Controls[i].Location.Y + 5); //_priviledgeLabels[i].Visible = true; //_priviledgeLabels[i].Show(); //_priviledgeLabels[i].BringToFront(); //} this.Show(); }
public BaseControlModule(AccessLevels accessLevel, string heading, string alias, string mainPage) : base(accessLevel) { this.Model = new System.Dynamic.ExpandoObject(); this.Heading = heading; this.Alias = alias; this.MainPage = mainPage; this.Model.Heading = this.Heading; this.Model.Alias = this.Alias; this.Model.MainPage = this.MainPage; }
public WowwoWTelnet() { this._AllowedIPs = TelnetConfig.AllowedTelnetIPs; this._DisallowedIPs = TelnetConfig.DisallowedTelnetIPs; this._IPAddress = TelnetConfig.IPAddress; this._MaxConnections = TelnetConfig.MaxConnections; this._MinAccessLevel = TelnetConfig.MinimumAccessLevel; this._Port = TelnetConfig.TelnetPort; listener = new TCPListener(this._IPAddress, this._Port, this._MaxConnections); listener.BeginConnect += new Server.Konsole.Sockets.TCPListener.ConnectEventHandler(listener_BeginConnect); listener.BeginDisconnect += new Server.Konsole.Sockets.TCPListener.DisconnectEventHandler(listener_BeginDisconnect); listener.BeginRead += new Server.Konsole.Sockets.TCPListener.ReadEventHandler(listener_BeginRead); }
internal void AddAccessLevels(List <string> list) { foreach (var accessLevel in list) { try { AccessLevel value = (AccessLevel)Enum.Parse(typeof(AccessLevel), accessLevel); if (value != null) { AccessLevels.Add(value); } } catch (ArgumentException) { //ignore invalid values } } }
public async Task <IActionResult> Edit(string id, [Bind("Description,Id,Name,NormalizedName,ConcurrencyStamp")] AccessLevels accessLevels) { if (id != accessLevels.Id) { _logger.LogInformation("Nível não encontrado"); return(NotFound()); } if (ModelState.IsValid) { await _accessLevelsRepository.Update(accessLevels); _logger.LogInformation("Nível atualizado"); return(RedirectToAction("Index", "AccessLevels")); } _logger.LogError("Informações inválidas"); return(View(accessLevels)); }
private void BeginSearch(string searchString) { RemoveOldResults(); AddSearchHistory(searchString); SimpleSearchCriteria Criteria = new SimpleSearchCriteria(); //Store the search key this.searchKey = searchBox.Text; //Clear the old recommendation. UpdateRecommendedQueries(Enumerable.Empty <String>().AsQueryable()); var selectedAccessLevels = AccessLevels.Where(a => a.Checked).Select(a => a.Access).ToList(); if (selectedAccessLevels.Any()) { Criteria.SearchByAccessLevel = true; Criteria.AccessLevels = new SortedSet <AccessLevel>(selectedAccessLevels); } else { Criteria.SearchByAccessLevel = false; Criteria.AccessLevels.Clear(); } var selectedProgramElementTypes = ProgramElements.Where(e => e.Checked).Select(e => e.ProgramElement).ToList(); if (selectedProgramElementTypes.Any()) { Criteria.SearchByProgramElementType = true; Criteria.ProgramElementTypes = new SortedSet <ProgramElementType>(selectedProgramElementTypes); } else { Criteria.SearchByProgramElementType = false; Criteria.ProgramElementTypes.Clear(); } SearchAsync(searchString, Criteria); }
private ViewControlModule(AccessLevels accessLevel, string heading, string alias, string mainPage, string displayPage, bool ignore) : base(accessLevel, heading, alias, mainPage) { if (ignore) return; this.DisplayPage = displayPage; Get["/" + this.MainPage] = parameters => { return this.GetView(); }; Post["/" + this.MainPage] = parameters => { return GetView(); }; }
private EditControlModule(AccessLevels accessLevel, string heading, string alias, string mainPage, string configPage, bool ignore) : base(accessLevel, heading, alias, mainPage) { if (ignore) { return; } this.ConfigPage = configPage; this.Model.ConfigPage = configPage; Get["/" + this.MainPage] = parameters => { if (this.Request.Query[Master.Success] != null) { switch ((string)this.Request.Query[Master.Success]) { case Master.PostAdd: this.SetSuccessMessage(String.Format("Successfully added a {0}.", this.Alias)); break; case Master.PostEdit: this.SetSuccessMessage(String.Format("Successfully edited a {0}.", this.Alias)); break; case Master.PostDelete: this.SetSuccessMessage(String.Format("Successfully deleted a {0}.", this.Alias)); break; } } return(this.PostView()); }; Post["/" + this.MainPage] = parameters => { return(PostView()); }; }
public async Task <IActionResult> Create([Bind("Description,Name")] AccessLevels accessLevels) { if (ModelState.IsValid) { _logger.LogInformation("Verificando se o nível de acesso existe"); bool accessLevelExist = await _accessLevelsRepository.AccessLevelExists(accessLevels.Name); if (!accessLevelExist) { accessLevels.NormalizedName = accessLevels.Name.ToUpper(); await _accessLevelsRepository.Insert(accessLevels); _logger.LogInformation("Novo nível de acesso criado"); return(RedirectToAction("Index", "AccessLevels")); } } _logger.LogError("Informações inválidas"); return(View(accessLevels)); }
public virtual void VerifyIsWriteonly(PropertyInfo propertyInfo, AccessLevels accessLevel) { VerifyCanWrite(propertyInfo, canWrite: true); VerifyAccessLevel(propertyInfo, new[] { accessLevel }, SetMethod: true); if (!propertyInfo.CanWrite) { return; } AccessLevels getMethodAccessLevel = ReflectionHelper.GetAccessLevel(propertyInfo.GetMethod); if (accessLevel == AccessLevels.Protected) { if (getMethodAccessLevel != AccessLevels.Private) { string message = string.Format( "{0}.{1} should not have get accessor or the get accessor should be private", FormatHelper.FormatType(propertyInfo.DeclaringType), propertyInfo.Name); throw new InvalidStructureException(message); } } else if (accessLevel == AccessLevels.Public) { if (getMethodAccessLevel != AccessLevels.Private && getMethodAccessLevel != AccessLevels.Protected) { string message = string.Format( "{0}.{1} should not have get accessor or the get accessor should be private or protected", FormatHelper.FormatType(propertyInfo.DeclaringType), propertyInfo.Name); throw new InvalidStructureException(message); } } else { throw new NotImplementedException(); } }
void CheckLogin(object a, LoginArgs e) { //Check whether the loginDetails are comparable to the ones we have in database and give user according userAccess. //e.LoginDetails returns a String in the format "username%%password" //Currently temp code which will be replaced by a query to database Console.WriteLine( "PRIVILEDGE NOT SET"); if (e.LoginDetails.CompareTo(e.LoginDetails) == 0) { userAccess = AccessLevels.Admin; } else { userAccess = AccessLevels.None; } this.StartPosition = FormStartPosition.Manual; //Show this main form again slightly above where the Login page was (Incase it was moved) this.Location = new Point(((Form)a).Location.X, ((Form)a).Location.Y - 150); ((Form)a).Close(); //Close the Login Screen and return to whatever screen launched it. // priviledgeLabels. ShowUserPriviledges(userAccess); }
private ViewControlModule(AccessLevels accessLevel, string heading, string alias, string mainPage, string displayPage, bool ignore) : base(accessLevel, heading, alias, mainPage) { if (ignore) { return; } this.DisplayPage = displayPage; Get["/" + this.MainPage] = parameters => { return(this.GetView()); }; Post["/" + this.MainPage] = parameters => { return(GetView()); }; }
void CheckLogin(object a, LoginArgs e) { //Check whether the loginDetails are comparable to the ones we have in database and give user according userAccess. //e.LoginDetails returns a String in the format "username%%password" //Currently temp code which will be replaced by a query to database Console.WriteLine("PRIVILEDGE NOT SET"); if (e.LoginDetails.CompareTo(e.LoginDetails) == 0) { userAccess = AccessLevels.Admin; } else { userAccess = AccessLevels.None; } this.StartPosition = FormStartPosition.Manual; //Show this main form again slightly above where the Login page was (Incase it was moved) this.Location = new Point(((Form)a).Location.X, ((Form)a).Location.Y - 150); ((Form)a).Close(); //Close the Login Screen and return to whatever screen launched it. // priviledgeLabels. ShowUserPriviledges(userAccess); }
public IHttpActionResult DeleteAssignments(Guid id, Guid userId, AccessLevels accessLevel) { if (id == Guid.Empty) { return(BadRequest("project id is empty")); } if (userId == Guid.Empty) { return(BadRequest("user id is empty")); } var project = UnitOfWork.ProjectsRepository.FindIncluding(id, p => p.Assignments); if (project == null) { return(NotFound()); } var assignment = project.Assignments.SingleOrDefault(a => a.OrgUserId == userId); if (assignment == null) { return(NotFound()); } var updatedAssignment = UnitOfWork.AssignmentsRepository.AssignAccessLevel(id, userId, accessLevel, grant: false); if (updatedAssignment != null) { return(Ok(Mapper.Map <ProjectAssignmentDTO>(updatedAssignment))); } MemoryCacher.DeleteStartingWith("ORG_TEAMS_ASSIGNMENTS"); return(Ok(new ProjectAssignmentDTO())); }
public Assignment AssignAccessLevel(Guid projectId, Guid userId, AccessLevels accessLevel, bool grant) { var project = this.CurrentUOW.ProjectsRepository.Find(projectId); var assignment = project.Assignments.SingleOrDefault(a => a.OrgUserId == userId); if (assignment != null) { assignment = FlagAccessLevel(assignment, accessLevel, grant); this.CurrentUOW.AssignmentsRepository.InsertOrUpdate(assignment); } else { assignment = new Assignment() { ProjectId = projectId, OrgUserId = userId }; assignment = FlagAccessLevel(assignment, accessLevel, grant); this.CurrentUOW.AssignmentsRepository.InsertOrUpdate(assignment); } this.CurrentUOW.Save(); return(project.Assignments.SingleOrDefault(a => a.OrgUserId == userId)); }
private EditControlModule(AccessLevels accessLevel, string heading, string alias, string mainPage, string configPage, bool ignore) : base(accessLevel, heading, alias, mainPage) { if (ignore) return; this.ConfigPage = configPage; this.Model.ConfigPage = configPage; Get["/" + this.MainPage] = parameters => { if (this.Request.Query[Master.Success] != null) { switch ((string)this.Request.Query[Master.Success]) { case Master.PostAdd: this.SetSuccessMessage(String.Format("Successfully added a {0}.", this.Alias)); break; case Master.PostEdit: this.SetSuccessMessage(String.Format("Successfully edited a {0}.", this.Alias)); break; case Master.PostDelete: this.SetSuccessMessage(String.Format("Successfully deleted a {0}.", this.Alias)); break; } } return this.PostView(); }; Post["/" + this.MainPage] = parameters => { return PostView(); }; }
/// <summary> /// Called when the "Submit" button in the UI gets pressed. /// Writes data passed from the UI into the ID stored in <see cref="TargetIdSlot"/>, if present. /// </summary> private void TryWriteToTargetId(string newFullName, string newJobTitle, List <string> newAccessList) { if (TargetIdSlot.Item is not { Valid: true } targetIdEntity || !PrivilegedIdIsAuthorized()) { return; } var cardSystem = EntitySystem.Get <IdCardSystem>(); cardSystem.TryChangeFullName(targetIdEntity, newFullName); cardSystem.TryChangeJobTitle(targetIdEntity, newJobTitle); if (!newAccessList.TrueForAll(x => AccessLevels.Contains(x))) { Logger.Warning("Tried to write unknown access tag."); return; } var accessSystem = EntitySystem.Get <AccessSystem>(); accessSystem.TrySetTags(targetIdEntity, newAccessList); }
protected override void Event(params string[] list) { string name; if (list.Length > 1) { name = list[1]; } else { Console.Write("Input account name: "); name = Console.ReadLine(); } if (ConsoleCommander.AccountExists(name)) { Console.WriteLine("This name already exists, try another.."); return; } Console.Write("Input account password: "******"Input account plevel (0-player, 1-gm, 2-admin): "); string splevel = Console.ReadLine(); AccessLevels plevel = AccessLevels.PlayerLevel; switch (splevel) { case "2": { plevel = AccessLevels.Admin; break; } case "1": { plevel = AccessLevels.GM; break; } default: { plevel = AccessLevels.PlayerLevel; break; } } World.allAccounts.Add(new Account(name, pass, plevel)); Console.WriteLine("Account: \"{0}\", pass: \"{1}\", plevel: \"{2}\" created", name, pass, plevel); }
public ViewControlModule(AccessLevels accessLevel, string heading, string alias, string mainPage, string displayPage) : this(accessLevel, heading, alias, mainPage, displayPage, false) { }
/// <summary> /// Updates mailing list access /// </summary> /// <param name="list">Alias name of the mailing list</param> /// <param name="access">New mailing list access level</param> /// <returns></returns> public async Task <Result <UpdateMailingListResponse> > UpdateMailingListAccessAsync(string list, AccessLevels access) { #region check args if (string.IsNullOrEmpty(list)) { throw new ArgumentNullException(nameof(list)); } #endregion return(await Http.SendRequest(new UpdateMailingListRequest(BaseUri, WorkDomain, list, null, null, null, access))); }
/// <summary> /// Creates a new mailing list /// </summary> /// <param name="alias">Alias name of the mailing list. The result address will looks like 'alias@WorkDomain'.</param> /// <param name="name">Display name of the mailing list</param> /// <param name="description">Mailing list description</param> /// <param name="access">Mailing list access level</param> /// <returns></returns> public async Task <Result <CreateMailingListResponse> > CreateMailingListAsync(string alias, string name, string description, AccessLevels access) { #region check args if (string.IsNullOrEmpty(alias)) { throw new ArgumentNullException(nameof(alias)); } if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException(nameof(name)); } if (string.IsNullOrEmpty(description)) { throw new ArgumentNullException(nameof(description)); } #endregion return(await Http.SendRequest(new CreateMailingListRequest(BaseUri, WorkDomain, alias, name, description, access))); }
public override void Verify(MemberInfo originalMember, MemberInfo translatedMember) { if (originalMember is ConstructorInfo originalConstructor) { AccessLevels accessLevel = ReflectionHelper.GetAccessLevel(originalConstructor); Verifier.VerifyMemberType(translatedMember, new[] { MemberTypes.Constructor }); Verifier.VerifyAccessLevel((ConstructorInfo)translatedMember, new[] { accessLevel }); } else if (originalMember is FieldInfo originalField) { AccessLevels accessLevel = ReflectionHelper.GetAccessLevel(originalField); Verifier.VerifyMemberType(translatedMember, new[] { MemberTypes.Field, MemberTypes.Property }); if (translatedMember is FieldInfo translatedField) { Verifier.VerifyAccessLevel(translatedField, new[] { accessLevel }); } else if (translatedMember is PropertyInfo translatedProperty) { Verifier.VerifyAccessLevel(translatedProperty, new[] { accessLevel }, GetMethod: true, SetMethod: true); } } else if (originalMember is PropertyInfo originalProperty) { AccessLevels?accessLevel1 = originalProperty.CanRead ? ReflectionHelper.GetAccessLevel(originalProperty.GetMethod) : (AccessLevels?)null; AccessLevels?accessLevel2 = originalProperty.CanWrite ? ReflectionHelper.GetAccessLevel(originalProperty.SetMethod) : (AccessLevels?)null; Verifier.VerifyMemberType(translatedMember, new[] { MemberTypes.Field, MemberTypes.Property }); if (translatedMember is FieldInfo translatedField) { if (accessLevel1 != null && accessLevel2 != null) { Verifier.VerifyAccessLevel(translatedField, new[] { (AccessLevels)accessLevel1, (AccessLevels)accessLevel2 }); } else if (accessLevel1 != null) { Verifier.VerifyAccessLevel(translatedField, new[] { (AccessLevels)accessLevel1 }); } else if (accessLevel2 != null) { Verifier.VerifyAccessLevel(translatedField, new[] { (AccessLevels)accessLevel2 }); } } else if (translatedMember is PropertyInfo translatedProperty) { if (accessLevel1 != null) { Verifier.VerifyAccessLevel(translatedProperty, new[] { (AccessLevels)accessLevel1 }, GetMethod: true); } if (accessLevel2 != null) { Verifier.VerifyAccessLevel(translatedProperty, new[] { (AccessLevels)accessLevel2 }, SetMethod: true); } } } else if (translatedMember is MethodInfo originalMethod) { AccessLevels accessLevel = ReflectionHelper.GetAccessLevel(originalMethod); Verifier.VerifyMemberType(translatedMember, new[] { MemberTypes.Method }); Verifier.VerifyAccessLevel((MethodInfo)translatedMember, new[] { accessLevel }); } else { throw new NotImplementedException(); } }
public Account( string u, string p, AccessLevels al ) : this(u, p) { accessLevel = al; }
private void ShowUserPriviledges(AccessLevels userAccess) { foreach (Control button in buttonBox.Controls) { if (button.Name.Contains("Yes") || button.Name.Contains("No")) button.Visible = false; } if (userAccess == AccessLevels.Admin) { foreach (Control button in buttonBox.Controls) { if (button.Name.Contains("Yes")) button.Visible = true; } } else if(userAccess == AccessLevels.Regular) { editPrivLabelNo.Visible = true; productPrivLabelYes.Visible = true; //ADD REST OF PRIVILEDGES HERE. } //List<Label> _priviledgeLabels = null; //Console.WriteLine(userAccess); //_priviledgeLabels = new List<Label>(); //for (int i = 0; i < buttonBox.Controls.Count; i++) //{ //_priviledgeLabels.Add(new Label()); //_priviledgeLabels[i].Font = yesLabel.Font; // _priviledgeLabels[i].Size = yesLabel.Size; //_priviledgeLabels[i].ForeColor = yesLabel.ForeColor; //_priviledgeLabels[i].AutoSize = true; // _priviledgeLabels[i].Text = yesLabel.Text; ////_priviledgeLabels[i].StartPosition = FormStartPosition.Manual; ////_priviledgeLabels[i].Location = new Point(200 , 200); //_priviledgeLabels[i].Location = new Point(buttonBox.Controls[i].Location.X + buttonBox.Controls[i].Size.Width + 5, buttonBox.Controls[i].Location.Y + 5); //_priviledgeLabels[i].Visible = true; //_priviledgeLabels[i].Show(); //_priviledgeLabels[i].BringToFront(); //} this.Show(); }
private void logoutButton_Click(object sender, EventArgs e) { userAccess = AccessLevels.None; logUser(); }
/// <summary> /// Create new Account, Load all info for acc from xml node /// </summary> /// <param name="version">version for loading</param> /// <param name="node">load from</param> /// <param name="doc">recursive reference for checking</param> /// <returns>Loaded Account</returns> public Account( int version, XmlNode node, XmlFile doc ) { if ( version == 1 ) { username = doc.GetAttributeVal( node, xml_attr_username, null ); password = doc.GetAttributeVal( node, xml_attr_password, null ); accessLevel = (AccessLevels)Convert.ToInt32( doc.GetAttributeVal( node, xml_attr_accesslevel, "0" ) ); foreach ( XmlNode char_node in node.SelectNodes( xml_attr_guid ) ) { UInt64 guid = UInt64.Parse( doc.GetInnerText( char_node, "0" ) ); Character character = (Character)World.FindMobileByGUID( guid ); if ( character != null ) { characteres.Add( character ); if ( World.StandardServer ) World.allMobiles.Remove( character ); } } } }
public EditControlModule(AccessLevels accessLevel, string heading, string alias, string mainPage, string configPage) : this(accessLevel, heading, alias, mainPage, configPage, false) { }
private void ShowUserPrivileges(AccessLevels userAccess) { if (userAccess == AccessLevels.Admin) { employeeButton.Enabled = true; productButton.Enabled = true; storeButton.Enabled = true; supplierButton.Enabled = true; graphsButton.Enabled = true; } else if (userAccess == AccessLevels.Manager) { employeeButton.Enabled = false; productButton.Enabled = true; storeButton.Enabled = false; supplierButton.Enabled = true; graphsButton.Enabled = false; } else if (userAccess == AccessLevels.Regular) { employeeButton.Enabled = false; productButton.Enabled = false; storeButton.Enabled = false; supplierButton.Enabled = false; graphsButton.Enabled = false; } this.Show(); lblLogin.Text = "Logged in as " + uname; }