fix #242 - module definitions not loading in Edit page
This commit is contained in:
@ -73,7 +73,7 @@ namespace Oqtane.Services
|
|||||||
if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null)
|
if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
// download assembly from server and load
|
// download assembly from server and load
|
||||||
var bytes = await http.GetByteArrayAsync(apiurl + "/" + assemblyname + ".dll");
|
var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + assemblyname + ".dll");
|
||||||
Assembly.Load(bytes);
|
Assembly.Load(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ namespace Oqtane.Services
|
|||||||
if (assemblies.Where(item => item.FullName.StartsWith(moduledefinition.AssemblyName + ",")).FirstOrDefault() == null)
|
if (assemblies.Where(item => item.FullName.StartsWith(moduledefinition.AssemblyName + ",")).FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
// download assembly from server and load
|
// download assembly from server and load
|
||||||
var bytes = await http.GetByteArrayAsync(apiurl + "/" + moduledefinition.AssemblyName + ".dll");
|
var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + moduledefinition.AssemblyName + ".dll");
|
||||||
Assembly.Load(bytes);
|
Assembly.Load(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ namespace Oqtane.Services
|
|||||||
if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null)
|
if (assemblies.Where(item => item.FullName.StartsWith(assemblyname + ",")).FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
// download assembly from server and load
|
// download assembly from server and load
|
||||||
var bytes = await http.GetByteArrayAsync(apiurl + "/" + assemblyname + ".dll");
|
var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + assemblyname + ".dll");
|
||||||
Assembly.Load(bytes);
|
Assembly.Load(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ namespace Oqtane.Services
|
|||||||
if (assemblies.Where(item => item.FullName.StartsWith(theme.AssemblyName + ",")).FirstOrDefault() == null)
|
if (assemblies.Where(item => item.FullName.StartsWith(theme.AssemblyName + ",")).FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
// download assembly from server and load
|
// download assembly from server and load
|
||||||
var bytes = await http.GetByteArrayAsync(apiurl + "/" + theme.AssemblyName + ".dll");
|
var bytes = await http.GetByteArrayAsync(apiurl + "/load/" + theme.AssemblyName + ".dll");
|
||||||
Assembly.Load(bytes);
|
Assembly.Load(bytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ namespace Oqtane.Controllers
|
|||||||
|
|
||||||
// GET: api/<controller>?siteid=x
|
// GET: api/<controller>?siteid=x
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IEnumerable<ModuleDefinition> Get(int siteid)
|
public IEnumerable<ModuleDefinition> Get(string siteid)
|
||||||
{
|
{
|
||||||
List<ModuleDefinition> moduledefinitions = new List<ModuleDefinition>();
|
List<ModuleDefinition> moduledefinitions = new List<ModuleDefinition>();
|
||||||
foreach(ModuleDefinition moduledefinition in ModuleDefinitions.GetModuleDefinitions(siteid))
|
foreach(ModuleDefinition moduledefinition in ModuleDefinitions.GetModuleDefinitions(int.Parse(siteid)))
|
||||||
{
|
{
|
||||||
if (UserPermissions.IsAuthorized(User, "Utilize", moduledefinition.Permissions))
|
if (UserPermissions.IsAuthorized(User, "Utilize", moduledefinition.Permissions))
|
||||||
{
|
{
|
||||||
@ -63,16 +63,6 @@ namespace Oqtane.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// GET api/<controller>/filename
|
|
||||||
[HttpGet("{filename}")]
|
|
||||||
public IActionResult Get(string assemblyname)
|
|
||||||
{
|
|
||||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
|
||||||
byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, assemblyname));
|
|
||||||
return File(file, "application/octet-stream", assemblyname);
|
|
||||||
}
|
|
||||||
|
|
||||||
// PUT api/<controller>/5
|
// PUT api/<controller>/5
|
||||||
[HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
[Authorize(Roles = Constants.AdminRole)]
|
[Authorize(Roles = Constants.AdminRole)]
|
||||||
@ -123,5 +113,14 @@ namespace Oqtane.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GET api/<controller>/load/filename
|
||||||
|
[HttpGet("load/{filename}")]
|
||||||
|
public IActionResult Load(string assemblyname)
|
||||||
|
{
|
||||||
|
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, assemblyname));
|
||||||
|
return File(file, "application/octet-stream", assemblyname);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,15 +36,6 @@ namespace Oqtane.Controllers
|
|||||||
return Themes.GetThemes();
|
return Themes.GetThemes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET api/<controller>/filename
|
|
||||||
[HttpGet("{filename}")]
|
|
||||||
public IActionResult Get(string filename)
|
|
||||||
{
|
|
||||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
|
||||||
byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, filename));
|
|
||||||
return File(file, "application/octet-stream", filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpGet("install")]
|
[HttpGet("install")]
|
||||||
[Authorize(Roles = Constants.HostRole)]
|
[Authorize(Roles = Constants.HostRole)]
|
||||||
public void InstallThemes()
|
public void InstallThemes()
|
||||||
@ -80,5 +71,14 @@ namespace Oqtane.Controllers
|
|||||||
InstallationManager.RestartApplication();
|
InstallationManager.RestartApplication();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GET api/<controller>/load/filename
|
||||||
|
[HttpGet("load/{filename}")]
|
||||||
|
public IActionResult Load(string filename)
|
||||||
|
{
|
||||||
|
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, filename));
|
||||||
|
return File(file, "application/octet-stream", filename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user