public CustomizeRoleDialog(RoleDescription existingRole, string text) : this(text) { SetRole(existingRole); this.buttonCreateSubRole.Text = "Update sub-role"; this.Text = "Update existing sub-role"; this.checkBoxMakeThisRootRole.Enabled = false; }
private void SetRole(RoleDescription existingRole) { //this.Role.AssignUnassignRole //this.Role.CanCreateRoot //this.Role.CanCreateUsers //this.Role.CanManageSubRoles this.Role.ChildRoles = existingRole.ChildRoles.Select(r => r.Id).ToList(); //this.Role.DataEntities //this.Role.DataEntityPermission this.Role.Id = existingRole.Id; this.Role.IsRoot = existingRole.IsRoot; this.Role.Name = existingRole.Name; this.Role.Users = existingRole.Users.Select(u => u.Id).ToList(); this.textBoxName.Text = existingRole.Name.GetString(); this.checkBoxCanAssignUnassignRole.Checked = existingRole.AssignUnassignRole; this.checkBoxCanManageSubroles.Checked = existingRole.CanManageSubRoles; this.checkBoxCanCreateRootRoles.Checked = existingRole.CanCreateRoot; this.checkBoxCanCreateUsers.Checked = existingRole.CanCreateUsers; switch (existingRole.DataEntityPermission) { case DataEntityPermission.ReadContent: this.radioButtonPermissionReadonly.Checked = true; break; case DataEntityPermission.ModifyContent: this.radioButtonPermissionModify.Checked = true; break; default: throw new ArgumentOutOfRangeException(); } }
private void ShowRoleDetail(RoleDescription role) { SetDetailMode(true); this.labelDetailId.Text = role.Id.ToString(); this.labelDetailName.Text = role.Name.GetString(); this.labelDetailCreateUsers.Text = role.CanCreateUsers.ToString(); this.labelDetailPermission.Text = Enum.GetName(typeof (DataEntityPermission), role.DataEntityPermission); this.labelDetailRootRoles.Text = role.CanCreateRoot.ToString(); this.labelDetailSubRoles.Text = role.CanManageSubRoles.ToString(); this.labelDetailIsRootRole.Text = role.IsRoot.ToString(); this.labelDetailsCanBeAssigned.Text = role.AssignUnassignRole.ToString(); }