fixed Theme install/uninstall issue, fixed Layout inheritance issue, fixed File server performance issue, cleaned up remaining hardcoded permission strings
This commit is contained in:
parent
7f15a5f464
commit
8196112a59
|
@ -390,6 +390,10 @@
|
|||
if (string.IsNullOrEmpty(page.ThemeType))
|
||||
{
|
||||
page.ThemeType = site.DefaultThemeType;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(page.LayoutType))
|
||||
{
|
||||
page.LayoutType = site.DefaultLayoutType;
|
||||
}
|
||||
|
||||
|
|
|
@ -444,8 +444,8 @@ namespace Oqtane.Controllers
|
|||
string filepath = Path.Combine(GetFolderPath(file.Folder), file.Name);
|
||||
if (System.IO.File.Exists(filepath))
|
||||
{
|
||||
byte[] filebytes = System.IO.File.ReadAllBytes(filepath);
|
||||
return File(filebytes, "application/octet-stream", file.Name);
|
||||
var stream = new FileStream(filepath, FileMode.Open);
|
||||
return File(stream, "application/octet-stream", file.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -453,8 +453,8 @@ namespace Oqtane.Controllers
|
|||
HttpContext.Response.StatusCode = 404;
|
||||
if (System.IO.File.Exists(errorpath))
|
||||
{
|
||||
byte[] filebytes = System.IO.File.ReadAllBytes(errorpath);
|
||||
return File(filebytes, "application/octet-stream", file.Name);
|
||||
var stream = new FileStream(errorpath, FileMode.Open);
|
||||
return File(stream, "application/octet-stream", file.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -462,16 +462,16 @@ namespace Oqtane.Controllers
|
|||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Read, "User Not Authorized To Access File {FileId}", id);
|
||||
HttpContext.Response.StatusCode = 401;
|
||||
byte[] filebytes = System.IO.File.ReadAllBytes(errorpath);
|
||||
return File(filebytes, "application/octet-stream", file.Name);
|
||||
var stream = new FileStream(errorpath, FileMode.Open);
|
||||
return File(stream, "application/octet-stream", file.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Read, "File Not Found {FileId}", id);
|
||||
HttpContext.Response.StatusCode = 404;
|
||||
byte[] filebytes = System.IO.File.ReadAllBytes(errorpath);
|
||||
return File(filebytes, "application/octet-stream", "error.png");
|
||||
var stream = new FileStream(errorpath, FileMode.Open);
|
||||
return File(stream, "application/octet-stream", file.Name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace Oqtane.Controllers
|
|||
if (theme != null && Utilities.GetAssemblyName(theme.ThemeName) != "Oqtane.Client")
|
||||
{
|
||||
// use assets.json to clean up file resources
|
||||
string assetfilepath = Path.Combine(_environment.WebRootPath, "Modules", Utilities.GetTypeName(theme.ThemeName), "assets.json");
|
||||
string assetfilepath = Path.Combine(_environment.WebRootPath, "Themes", Utilities.GetTypeName(theme.ThemeName), "assets.json");
|
||||
if (System.IO.File.Exists(assetfilepath))
|
||||
{
|
||||
List<string> assets = JsonSerializer.Deserialize<List<string>>(System.IO.File.ReadAllText(assetfilepath));
|
||||
|
@ -84,23 +84,5 @@ namespace Oqtane.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
// GET api/<controller>/load/assembyname
|
||||
[HttpGet("load/{assemblyname}")]
|
||||
public IActionResult Load(string assemblyname)
|
||||
{
|
||||
if (Path.GetExtension(assemblyname).ToLower() == ".dll")
|
||||
{
|
||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
byte[] file = System.IO.File.ReadAllBytes(Path.Combine(binfolder, assemblyname));
|
||||
return File(file, "application/octet-stream", assemblyname);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Log(LogLevel.Error, this, LogFunction.Read, "User Not Authorized To Download Assembly {Assembly}", assemblyname);
|
||||
HttpContext.Response.StatusCode = 401;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ using System.Net;
|
|||
using Oqtane.Enums;
|
||||
using Oqtane.Infrastructure;
|
||||
using Oqtane.Repository;
|
||||
using Oqtane.Extensions;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
|
@ -186,8 +187,12 @@ namespace Oqtane.Controllers
|
|||
Path = Utilities.PathCombine(folder.Path, newUser.UserId.ToString(),Path.DirectorySeparatorChar.ToString()),
|
||||
Order = 1,
|
||||
IsSystem = true,
|
||||
Permissions = "[{\"PermissionName\":\"Browse\",\"Permissions\":\"[" + newUser.UserId.ToString() + "]\"},{\"PermissionName\":\"View\",\"Permissions\":\"All Users\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"[" +
|
||||
newUser.UserId.ToString() + "]\"}]"
|
||||
Permissions = new List<Permission>
|
||||
{
|
||||
new Permission(PermissionNames.Browse, newUser.UserId, true),
|
||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
||||
new Permission(PermissionNames.Edit, newUser.UserId, true)
|
||||
}.EncodePermissions()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ namespace Oqtane.Infrastructure
|
|||
// save list of assets
|
||||
if (assets.Count != 0)
|
||||
{
|
||||
string assetfilepath = Path.Combine(webRootPath, "Modules", name, "assets.json");
|
||||
string assetfilepath = Path.Combine(webRootPath, folder, name, "assets.json");
|
||||
if (File.Exists(assetfilepath))
|
||||
{
|
||||
File.Delete(assetfilepath);
|
||||
|
|
|
@ -673,12 +673,22 @@ namespace Oqtane.Repository
|
|||
Folder folder = _folderRepository.AddFolder(new Folder
|
||||
{
|
||||
SiteId = site.SiteId, ParentId = null, Name = "Root", Path = "", Order = 1, IsSystem = true,
|
||||
Permissions = "[{\"PermissionName\":\"Browse\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"View\",\"Permissions\":\"All Users\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]"
|
||||
Permissions = new List<Permission>
|
||||
{
|
||||
new Permission(PermissionNames.Browse, Constants.AdminRole, true),
|
||||
new Permission(PermissionNames.View, Constants.AllUsersRole, true),
|
||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
||||
}.EncodePermissions()
|
||||
});
|
||||
_folderRepository.AddFolder(new Folder
|
||||
{
|
||||
SiteId = site.SiteId, ParentId = folder.FolderId, Name = "Users", Path = Utilities.PathCombine("Users",Path.DirectorySeparatorChar.ToString()), Order = 1, IsSystem = true,
|
||||
Permissions = "[{\"PermissionName\":\"Browse\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]"
|
||||
Permissions = new List<Permission>
|
||||
{
|
||||
new Permission(PermissionNames.Browse, Constants.AdminRole, true),
|
||||
new Permission(PermissionNames.View, Constants.AdminRole, true),
|
||||
new Permission(PermissionNames.Edit, Constants.AdminRole, true)
|
||||
}.EncodePermissions()
|
||||
});
|
||||
|
||||
// process site template first
|
||||
|
|
Loading…
Reference in New Issue
Block a user