exclude legacy Permissions properties from serialization/API payload
This commit is contained in:
@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Oqtane.Documentation;
|
||||
|
||||
namespace Oqtane.Models
|
||||
@ -68,55 +69,75 @@ namespace Oqtane.Models
|
||||
// additional IModule properties
|
||||
[NotMapped]
|
||||
public string Owner { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string Url { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string Contact { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string License { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string Runtimes { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string Dependencies { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string PermissionNames { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string ServerManagerType { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string ControlTypeRoutes { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string ReleaseVersions { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string DefaultAction { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string SettingsType { get; set; } // added in 2.0.2
|
||||
|
||||
[NotMapped]
|
||||
public string PackageName { get; set; } // added in 2.1.0
|
||||
|
||||
// internal properties
|
||||
[NotMapped]
|
||||
public int SiteId { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string ControlTypeTemplate { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string AssemblyName { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public List<Permission> PermissionList { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string Template { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public bool IsPortable { get; set; }
|
||||
|
||||
#region Deprecated Properties
|
||||
|
||||
[Obsolete("The Permissions property is deprecated. Use PermissionList instead", false)]
|
||||
[NotMapped]
|
||||
[JsonIgnore] // exclude from API payload
|
||||
public string Permissions
|
||||
{
|
||||
get
|
||||
{
|
||||
return JsonSerializer.Serialize(PermissionList);
|
||||
}
|
||||
set
|
||||
{
|
||||
PermissionList = JsonSerializer.Deserialize<List<Permission>>(Permissions);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user