1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

[server] Fix user information deserialisation crash

This commit is contained in:
Starbeamrainbowlabs 2018-01-10 11:53:29 +00:00
parent aacb6f26f9
commit 9137426942
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -45,14 +45,14 @@ namespace Nibriboard.Userspace
[JsonIgnore] [JsonIgnore]
public List<RbacRole> Roles { get; set; } = new List<RbacRole>(); public List<RbacRole> Roles { get; set; } = new List<RbacRole>();
private List<string> rolesText = null; [JsonProperty]
[JsonProperty("RolesText")] public List<string> RawRoles { get; set; } = null;
public List<string> RolesText { public List<string> RolesText {
get { get {
return new List<string>(Roles.Select((RbacRole role) => role.Name)); return new List<string>(Roles.Select((RbacRole role) => role.Name));
} }
set { set {
rolesText = value; RawRoles = value;
} }
} }
@ -97,7 +97,7 @@ namespace Nibriboard.Userspace
[OnDeserialized] [OnDeserialized]
internal void OnDeserialized(StreamingContext context) internal void OnDeserialized(StreamingContext context)
{ {
Roles = new List<RbacRole>(userManager.ResolveRoles(rolesText)); Roles = new List<RbacRole>(userManager.ResolveRoles(RawRoles));
} }
} }
} }