improved file upload, enhanced module installation from Nuget to support upgrades, added ability to upgrade the framework from Nuget, completed isolated multitenancy and site alias management, created IPortable interface for importing data into modules, added default content to initial installation

This commit is contained in:
Shaun Walker
2019-10-08 16:11:23 -04:00
parent dce53e10b0
commit 9971510b1e
48 changed files with 961 additions and 157 deletions

View File

@ -122,7 +122,7 @@
private string DatabaseType = "LocalDB";
private string ServerName = "(LocalDb)\\MSSQLLocalDB";
private string DatabaseName = "Oqtane-" + DateTime.Now.ToString("yyyyMMddHHmm");
private string Username = "";
private string Username = "host";
private string Password = "";
private string HostUsername = "";
private string HostPassword = "";
@ -146,7 +146,7 @@
private async Task Install()
{
if (HostPassword.Length >= 6)
if (HostUsername != "" & HostPassword.Length >= 6 & HostEmail != "")
{
LoadingDisplay = "";
StateHasChanged();
@ -197,7 +197,7 @@
}
else
{
Message = "<div class=\"alert alert-danger\" role=\"alert\">Password Must Be 6 Characters Or Greater</div>";
Message = "<div class=\"alert alert-danger\" role=\"alert\">Username And Email Must Be Provided And Password Must Be Greater Than 5 Characters</div>";
}
}
}

View File

@ -100,6 +100,20 @@ namespace Oqtane.Shared
}
}
public ValueTask<string[]> GetFiles(string name)
{
try
{
return jsRuntime.InvokeAsync<string[]>(
"interop.getFiles",
name);
}
catch
{
return new ValueTask<string[]>(Task.FromResult(new string[0]));
}
}
public Task UploadFiles(string posturl, string folder, string name)
{
try

View File

@ -21,10 +21,12 @@
DynamicComponent = builder =>
{
string typename = ModuleState.ModuleType;
if (PageState.Control == "Settings") // module settings are a core component
{
typename = Constants.DefaultSettingsControl;
// check for core module actions component
if (Constants.DefaultModuleActions.Contains(PageState.Control))
{
typename = Constants.DefaultModuleActionsTemplate.Replace("{Control}", PageState.Control);
}
Type moduleType = null;
if (typename != null)
{

View File

@ -40,21 +40,22 @@
{
if (PageState.ModuleId != -1 && PageState.Control != "")
{
if (Name == Constants.AdminPane)
if (Name.ToLower() == Constants.AdminPane.ToLower())
{
Module module = PageState.Modules.Where(item => item.ModuleId == PageState.ModuleId).FirstOrDefault();
if (module != null)
{
string typename = module.ModuleType;
if (PageState.Control == "Settings")
// check for core module actions component
if (Constants.DefaultModuleActions.Contains(PageState.Control))
{
typename = Constants.DefaultSettingsControl;
typename = Constants.DefaultModuleActionsTemplate.Replace("{Control}", PageState.Control);
}
Type moduleType = Type.GetType(typename);
if (moduleType != null)
{
bool authorized = false;
if (PageState.Control == "Settings")
if (Constants.DefaultModuleActions.Contains(PageState.Control))
{
authorized = UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions);
}
@ -82,7 +83,7 @@
}
if (authorized)
{
if (PageState.Control != "Settings" && module.ControlTitle != "")
if (!Constants.DefaultModuleActions.Contains(PageState.Control) && module.ControlTitle != "")
{
module.Title = module.ControlTitle;
}
@ -93,8 +94,8 @@
}
else
{
// module control does not exist with name specified
}
// module control does not exist with name specified
}
}
}
}
@ -103,10 +104,10 @@
if (PageState.ModuleId != -1)
{
Module module = PageState.Modules.Where(item => item.ModuleId == PageState.ModuleId).FirstOrDefault();
if (module != null && module.Pane == Name)
if (module != null && module.Pane.ToLower() == Name.ToLower())
{
// check if user is authorized to view module
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
// check if user is authorized to view module
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
{
builder.OpenComponent(0, Type.GetType(Constants.DefaultContainer));
builder.AddAttribute(1, "Module", module);
@ -116,10 +117,10 @@
}
else
{
foreach (Module module in PageState.Modules.Where(item => item.Pane == Name).OrderBy(x => x.Order).ToArray())
foreach (Module module in PageState.Modules.Where(item => item.Pane.ToLower() == Name.ToLower()).OrderBy(x => x.Order).ToArray())
{
// check if user is authorized to view module
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
// check if user is authorized to view module
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
{
builder.OpenComponent(0, Type.GetType(Constants.DefaultContainer));
builder.AddAttribute(1, "Module", module);

View File

@ -342,9 +342,10 @@
// get IModuleControl properties
typename = module.ModuleType;
if (control == "Settings")
// check for core module actions component
if (Constants.DefaultModuleActions.Contains(control))
{
typename = Constants.DefaultSettingsControl;
typename = Constants.DefaultModuleActionsTemplate.Replace("{Control}", control);
}
Type moduletype = Type.GetType(typename);
if (moduletype != null)
@ -358,7 +359,7 @@
}
// ensure module's pane exists in current page and if not, assign it to the Admin pane
if (!panes.Contains(module.Pane))
if (!panes.ToLower().Contains(module.Pane.ToLower()))
{
module.Pane = Constants.AdminPane;
}

View File

@ -59,6 +59,18 @@ namespace Oqtane.Shared
return url;
}
public static string GetTypeName(string fullyqualifiedtypename)
{
if (fullyqualifiedtypename.Contains(","))
{
return fullyqualifiedtypename.Substring(0, fullyqualifiedtypename.IndexOf(","));
}
else
{
return fullyqualifiedtypename;
}
}
public static string GetTypeNameClass(string typename)
{
if (typename.Contains(","))