public override bool CanExecute() { if (AsMember.IsOwner) { return(true); } if (!MemberPermissions.Has(Permission.Administrator, Permission.ManageRoles)) { return(false); } var memberHighestRole = GetRoleWithHighestPriority(MemberRoles); if (AddedRole.Priority >= memberHighestRole.Priority) { return(false); } if (!MemberPermissions.Has(Permission.Administrator) && !MemberPermissions.Has(AddedPermission)) { return(false); } return(true); }
public override void Expire() { MemberPermissions.Expire(); BoardPermissions.Expire(); OrganizationPermissions.Expire(); base.Expire(); }
private void addUserButton_Click(object sender, EventArgs e) { if (validateData()) { // try // { String name = nameField.Text; String location = locationField.Text; String phone = phoneField.Text; String email = emailField.Text; DateTime birthday = birthDayField.Value; Gender gender = (Gender)genderField.SelectedValue; MemberPermissions memberPermissions = (MemberPermissions)MemberPermissionsField.SelectedValue; Member m = new Member(name, location, phone, email, birthday, gender, memberPermissions, Member.getNewId()); GenerateBarcode(m.ID); m.Password = passWordField.Text; if (!Member.Members.ContainsKey(m.Name)) { Member.Members.Add(name, m); MessageBox.Show("nieuw lid toegevoegd\n\n\r" + m.ToString()); } else { MessageBox.Show("Een lid met dezelfde naam bestaat reeds in het gegevensbestand!"); } // }catch(Exception ex) // { // MessageBox.Show("Een ongekende fout heeft zich voorgedaan. Probeer opnieuw"); // MessageBox.Show(ex.StackTrace.ToString()); // } loadForm(); } }
public virtual IPermissionPolicyMemberPermissionsObject CreateMemberPermission() { WXafPermissionPolicyMemberPermissionsObject permissionPolicyObjectPermissionsObject = new WXafPermissionPolicyMemberPermissionsObject(Session); permissionPolicyObjectPermissionsObject.TypePermissionObject = this; MemberPermissions.Add(permissionPolicyObjectPermissionsObject); return(permissionPolicyObjectPermissionsObject); }
/// <summary> /// This constructor is used to create the first user account. Only the name and password are required in the "FirstUserForm.cs". /// (S)he will obtain the highest permission possible. /// </summary> /// <param name="name">The name of the first user</param> /// <param name="password">The password that's required to </param> public Member(String name, string password) { Name = name; Password = password; birthday = new DateTime(2000, 1, 1); // temporary birthday value iD = getNewId(); members.Add(name, this); memberPermissions = MemberPermissions.Beheerder; }
protected override IEnumerable <string> MergeDependencies(IJsonToken json, bool overwrite) { if (json.Permissions == null) { return(Enumerable.Empty <string>()); } return(MemberPermissions.Merge(json.Permissions.FirstOrDefault(p => p.ModelType == TokenModelType.Member), overwrite) .Concat(BoardPermissions.Merge(json.Permissions.FirstOrDefault(p => p.ModelType == TokenModelType.Board), overwrite)) .Concat(OrganizationPermissions.Merge(json.Permissions.FirstOrDefault(p => p.ModelType == TokenModelType.Organization), overwrite))); }
public override bool CanExecute() { if (AsMember.IsOwner) { return(true); } if (!MemberPermissions.Has(Permission.Administrator, Permission.ManageRoles)) { return(false); } var highestRole = GetRoleWithHighestPriority(MemberRoles); return(highestRole.Priority > AssignedRole.Priority); }
// // GET: /Security/Permissions/1 public virtual ActionResult Permissions(string id) { var employeeDetailsResult = _employeesService.GetEmployeeDetailsByKey(id); if (!employeeDetailsResult.Success) { ViewBag.Message = "Employee not found"; MessengerService.SetMessage(MessageType.Informational, "Employee not found"); return(RedirectToAction(MVC.Security.Index())); } var employeeDetails = employeeDetailsResult.ResultingObject; var model = new MemberPermissions { EmployeeKey = employeeDetails.EmployeeKey, EmployeeName = employeeDetails.DisplayName, Claims = employeeDetails.Claims }; return(View(model)); }
protected override IEnumerable <string> MergeDependencies(IJsonToken json) { return(MemberPermissions.Merge(json.Permissions.FirstOrDefault(p => p.ModelType == TokenModelType.Member)) .Concat(BoardPermissions.Merge(json.Permissions.FirstOrDefault(p => p.ModelType == TokenModelType.Board))) .Concat(OrganizationPermissions.Merge(json.Permissions.FirstOrDefault(p => p.ModelType == TokenModelType.Organization)))); }
public Member(String name, String city, String phone, String email, DateTime birthday, Gender gender, MemberPermissions p, long iD) { this.Name = name; this.City = city; this.Phone = phone; this.Email = email; this.Birthday = birthday; this.Gender = gender; this.MemberPermissions = p; this.ID = iD; }