public a_rule_role() { required_role = "MY_ROLE"; user = new Mock <IUserSecurityActor>(); user.Setup(m => m.IsInRole(It.IsAny <string>())).Returns(false); rule = new RoleRule(user.Object, required_role); }
private async void UpdateRole() { RoleRule role = GetRule(); var result = await roleServer.UpdateRequest(Uris.BaseUrl + Uris.Role + "Update", role); if (!result.Equals(HttpStatusCode.OK.ToString())) { MessageBox.Show(result); } else { Goback(); } }
private async void CreateRole() { RoleRule role = GetRule(); role.id = null; var result = await roleServer.CreateRequest(Uris.BaseUrl + Uris.Role + "Create", role); if ((bool)result["success"]) { Goback(); } else { MessageBox.Show(result["error"]["message"].ToString()); } }
private RoleRule GetRule() { List <string> permission = new List <string>(); foreach (CheckBox item in permissinons.Children) { if (item.IsChecked == true) { permission.Add(item.Tag.ToString()); } } RoleRule role = new RoleRule() { id = ID, description = description.Text, displayName = displayName.Text, name = roleName.Text, grantedPermissions = permission.ToArray(), normalizedName = roleName.ToString().ToUpper() }; return(role); }