Removed Repository methods which are not used and are not valid because they do not adhere to tenant scope boundaries
This commit is contained in:
parent
00914208ba
commit
d18b4d574a
|
@ -8,7 +8,7 @@
|
||||||
{
|
{
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col pl-0 pr-0">
|
||||||
<select class="form-control" @onchange="(e => FolderChanged(e))">
|
<select class="form-control" @onchange="(e => FolderChanged(e))">
|
||||||
@if (string.IsNullOrEmpty(Folder))
|
@if (string.IsNullOrEmpty(Folder))
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
}
|
}
|
||||||
@if (haseditpermission)
|
@if (haseditpermission)
|
||||||
{
|
{
|
||||||
<div>
|
<span class="text-nowrap">
|
||||||
@if (uploadmultiple)
|
@if (uploadmultiple)
|
||||||
{
|
{
|
||||||
<input type="file" id="@fileinputid" name="file" accept="@filter" multiple />
|
<input type="file" id="@fileinputid" name="file" accept="@filter" multiple />
|
||||||
|
@ -54,22 +54,22 @@
|
||||||
{
|
{
|
||||||
<input type="file" id="@fileinputid" name="file" accept="@filter" />
|
<input type="file" id="@fileinputid" name="file" accept="@filter" />
|
||||||
}
|
}
|
||||||
<span id="@progressinfoid"></span> <progress id="@progressbarid" style="visibility: hidden;"></progress>
|
<span id="@progressinfoid"></span><progress id="@progressbarid" style="visibility: hidden;"></progress>
|
||||||
@if (showfiles && GetFileId() != -1)
|
@if (showfiles && GetFileId() != -1)
|
||||||
{
|
{
|
||||||
<button type="button" class="btn btn-danger float-right" @onclick="DeleteFile">Delete</button>
|
<button type="button" class="btn btn-danger float-right" @onclick="DeleteFile">Delete</button>
|
||||||
}
|
}
|
||||||
<button type="button" class="btn btn-success float-right" @onclick="UploadFile">Upload</button>
|
<button type="button" class="btn btn-success float-right" @onclick="UploadFile">Upload</button>
|
||||||
</div>
|
</span>
|
||||||
@((MarkupString)@message)
|
@((MarkupString)@message)
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
@if (@image != "")
|
||||||
@if (@image != "")
|
{
|
||||||
{
|
<div class="col-auto pr-0">
|
||||||
@((MarkupString)@image)
|
@((MarkupString)@image)
|
||||||
}
|
</div>
|
||||||
</div>
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CloseFileManager()
|
public void CloseFileManager()
|
||||||
{
|
{
|
||||||
filemanagervisible = false;
|
filemanagervisible = false;
|
||||||
message = "";
|
message = "";
|
||||||
|
|
|
@ -145,6 +145,11 @@ namespace Oqtane.Controllers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var client = new System.Net.WebClient();
|
var client = new System.Net.WebClient();
|
||||||
|
// remove file if it already exists
|
||||||
|
if (System.IO.File.Exists(folderpath + filename))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(folderpath + filename);
|
||||||
|
}
|
||||||
client.DownloadFile(url, folderpath + filename);
|
client.DownloadFile(url, folderpath + filename);
|
||||||
Files.AddFile(CreateFile(filename, folder.FolderId, folderpath + filename));
|
Files.AddFile(CreateFile(filename, folder.FolderId, folderpath + filename));
|
||||||
}
|
}
|
||||||
|
@ -260,6 +265,11 @@ namespace Oqtane.Controllers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// remove file if it already exists
|
||||||
|
if (System.IO.File.Exists(Path.Combine(folder, filename)))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(Path.Combine(folder, filename));
|
||||||
|
}
|
||||||
// rename file now that the entire process is completed
|
// rename file now that the entire process is completed
|
||||||
System.IO.File.Move(Path.Combine(folder, filename + ".tmp"), Path.Combine(folder, filename));
|
System.IO.File.Move(Path.Combine(folder, filename + ".tmp"), Path.Combine(folder, filename));
|
||||||
logger.Log(LogLevel.Information, this, LogFunction.Create, "File Uploaded {File}", Path.Combine(folder, filename));
|
logger.Log(LogLevel.Information, this, LogFunction.Create, "File Uploaded {File}", Path.Combine(folder, filename));
|
||||||
|
@ -326,8 +336,18 @@ namespace Oqtane.Controllers
|
||||||
Models.File file = Files.GetFile(id);
|
Models.File file = Files.GetFile(id);
|
||||||
if (file != null && UserPermissions.IsAuthorized(User, "View", file.Folder.Permissions))
|
if (file != null && UserPermissions.IsAuthorized(User, "View", file.Folder.Permissions))
|
||||||
{
|
{
|
||||||
byte[] filebytes = System.IO.File.ReadAllBytes(GetFolderPath(file.Folder) + file.Name);
|
string filepath = GetFolderPath(file.Folder) + file.Name;
|
||||||
return File(filebytes, "application/octet-stream", file.Name);
|
if (System.IO.File.Exists(filepath))
|
||||||
|
{
|
||||||
|
byte[] filebytes = System.IO.File.ReadAllBytes(filepath);
|
||||||
|
return File(filebytes, "application/octet-stream", file.Name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logger.Log(LogLevel.Error, this, LogFunction.Read, "File Does Not Exist {File}", file);
|
||||||
|
HttpContext.Response.StatusCode = 404;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,19 +183,26 @@ namespace Oqtane.Controllers
|
||||||
string connectionString = Config.GetConnectionString("DefaultConnection");
|
string connectionString = Config.GetConnectionString("DefaultConnection");
|
||||||
connectionString = connectionString.Replace("|DataDirectory|", datadirectory);
|
connectionString = connectionString.Replace("|DataDirectory|", datadirectory);
|
||||||
|
|
||||||
SqlConnection connection = new SqlConnection(connectionString);
|
if (!string.IsNullOrEmpty(connectionString))
|
||||||
try
|
|
||||||
{
|
{
|
||||||
using (connection)
|
SqlConnection connection = new SqlConnection(connectionString);
|
||||||
|
try
|
||||||
{
|
{
|
||||||
connection.Open();
|
using (connection)
|
||||||
|
{
|
||||||
|
connection.Open();
|
||||||
|
}
|
||||||
|
response.Success = true;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// database does not exist
|
||||||
|
response.Message = "Database Does Not Exist";
|
||||||
}
|
}
|
||||||
response.Success = true;
|
|
||||||
}
|
}
|
||||||
catch
|
else
|
||||||
{
|
{
|
||||||
// database does not exist
|
response.Message = "Connection String Has Not Been Specified In Oqtane.Server\\appsettings.json";
|
||||||
response.Message = "Database Does Not Exist";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.Success)
|
if (response.Success)
|
||||||
|
@ -243,7 +250,7 @@ namespace Oqtane.Controllers
|
||||||
var result = dbUpgrade.PerformUpgrade();
|
var result = dbUpgrade.PerformUpgrade();
|
||||||
if (!result.Successful)
|
if (!result.Successful)
|
||||||
{
|
{
|
||||||
// TODO: log result.Error.Message;
|
// TODO: log result.Error.Message - problem is logger is not available here
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// iterate through Oqtane module assemblies and execute any database scripts
|
// iterate through Oqtane module assemblies and execute any database scripts
|
||||||
|
|
|
@ -16,11 +16,6 @@ namespace Oqtane.Repository
|
||||||
this.Permissions = Permissions;
|
this.Permissions = Permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Folder> GetFolders()
|
|
||||||
{
|
|
||||||
return db.Folder.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Folder> GetFolders(int SiteId)
|
public IEnumerable<Folder> GetFolders(int SiteId)
|
||||||
{
|
{
|
||||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Folder").ToList();
|
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Folder").ToList();
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IFolderRepository
|
public interface IFolderRepository
|
||||||
{
|
{
|
||||||
IEnumerable<Folder> GetFolders();
|
|
||||||
IEnumerable<Folder> GetFolders(int SiteId);
|
IEnumerable<Folder> GetFolders(int SiteId);
|
||||||
Folder AddFolder(Folder Folder);
|
Folder AddFolder(Folder Folder);
|
||||||
Folder UpdateFolder(Folder Folder);
|
Folder UpdateFolder(Folder Folder);
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IModuleRepository
|
public interface IModuleRepository
|
||||||
{
|
{
|
||||||
IEnumerable<Module> GetModules();
|
IEnumerable<Module> GetModules(int SiteId);
|
||||||
Module AddModule(Module Module);
|
Module AddModule(Module Module);
|
||||||
Module UpdateModule(Module Module);
|
Module UpdateModule(Module Module);
|
||||||
Module GetModule(int ModuleId);
|
Module GetModule(int ModuleId);
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IPageModuleRepository
|
public interface IPageModuleRepository
|
||||||
{
|
{
|
||||||
IEnumerable<PageModule> GetPageModules();
|
|
||||||
IEnumerable<PageModule> GetPageModules(int SiteId);
|
IEnumerable<PageModule> GetPageModules(int SiteId);
|
||||||
PageModule AddPageModule(PageModule PageModule);
|
PageModule AddPageModule(PageModule PageModule);
|
||||||
PageModule UpdatePageModule(PageModule PageModule);
|
PageModule UpdatePageModule(PageModule PageModule);
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IPageRepository
|
public interface IPageRepository
|
||||||
{
|
{
|
||||||
IEnumerable<Page> GetPages();
|
|
||||||
IEnumerable<Page> GetPages(int SiteId);
|
IEnumerable<Page> GetPages(int SiteId);
|
||||||
Page AddPage(Page Page);
|
Page AddPage(Page Page);
|
||||||
Page UpdatePage(Page Page);
|
Page UpdatePage(Page Page);
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IProfileRepository
|
public interface IProfileRepository
|
||||||
{
|
{
|
||||||
IEnumerable<Profile> GetProfiles();
|
|
||||||
IEnumerable<Profile> GetProfiles(int SiteId);
|
IEnumerable<Profile> GetProfiles(int SiteId);
|
||||||
Profile AddProfile(Profile Profile);
|
Profile AddProfile(Profile Profile);
|
||||||
Profile UpdateProfile(Profile Profile);
|
Profile UpdateProfile(Profile Profile);
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IRoleRepository
|
public interface IRoleRepository
|
||||||
{
|
{
|
||||||
IEnumerable<Role> GetRoles();
|
|
||||||
IEnumerable<Role> GetRoles(int SiteId);
|
IEnumerable<Role> GetRoles(int SiteId);
|
||||||
IEnumerable<Role> GetRoles(int SiteId, bool IncludeGlobalRoles);
|
IEnumerable<Role> GetRoles(int SiteId, bool IncludeGlobalRoles);
|
||||||
Role AddRole(Role Role);
|
Role AddRole(Role Role);
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
public interface IUserRoleRepository
|
public interface IUserRoleRepository
|
||||||
{
|
{
|
||||||
IEnumerable<UserRole> GetUserRoles();
|
|
||||||
IEnumerable<UserRole> GetUserRoles(int SiteId);
|
IEnumerable<UserRole> GetUserRoles(int SiteId);
|
||||||
IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId);
|
IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId);
|
||||||
UserRole AddUserRole(UserRole UserRole);
|
UserRole AddUserRole(UserRole UserRole);
|
||||||
|
|
|
@ -25,9 +25,9 @@ namespace Oqtane.Repository
|
||||||
this.ServiceProvider = ServiceProvider;
|
this.ServiceProvider = ServiceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Models.Module> GetModules()
|
public IEnumerable<Models.Module> GetModules(int SiteId)
|
||||||
{
|
{
|
||||||
return db.Module;
|
return db.Module.Where(item => item.SiteId == SiteId).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Models.Module AddModule(Models.Module Module)
|
public Models.Module AddModule(Models.Module Module)
|
||||||
|
|
|
@ -16,10 +16,6 @@ namespace Oqtane.Repository
|
||||||
this.Permissions = Permissions;
|
this.Permissions = Permissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<PageModule> GetPageModules()
|
|
||||||
{
|
|
||||||
return db.PageModule;
|
|
||||||
}
|
|
||||||
public IEnumerable<PageModule> GetPageModules(int SiteId)
|
public IEnumerable<PageModule> GetPageModules(int SiteId)
|
||||||
{
|
{
|
||||||
IEnumerable<PageModule> pagemodules = db.PageModule
|
IEnumerable<PageModule> pagemodules = db.PageModule
|
||||||
|
|
|
@ -18,11 +18,6 @@ namespace Oqtane.Repository
|
||||||
this.PageModules = PageModules;
|
this.PageModules = PageModules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Page> GetPages()
|
|
||||||
{
|
|
||||||
return db.Page.ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Page> GetPages(int SiteId)
|
public IEnumerable<Page> GetPages(int SiteId)
|
||||||
{
|
{
|
||||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Page").ToList();
|
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Page").ToList();
|
||||||
|
|
|
@ -14,11 +14,6 @@ namespace Oqtane.Repository
|
||||||
db = context;
|
db = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Profile> GetProfiles()
|
|
||||||
{
|
|
||||||
return db.Profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Profile> GetProfiles(int SiteId)
|
public IEnumerable<Profile> GetProfiles(int SiteId)
|
||||||
{
|
{
|
||||||
return db.Profile.Where(item => item.SiteId == SiteId || item.SiteId == null);
|
return db.Profile.Where(item => item.SiteId == SiteId || item.SiteId == null);
|
||||||
|
|
|
@ -14,11 +14,6 @@ namespace Oqtane.Repository
|
||||||
db = context;
|
db = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Role> GetRoles()
|
|
||||||
{
|
|
||||||
return db.Role;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Role> GetRoles(int SiteId)
|
public IEnumerable<Role> GetRoles(int SiteId)
|
||||||
{
|
{
|
||||||
return db.Role.Where(item => item.SiteId == SiteId);
|
return db.Role.Where(item => item.SiteId == SiteId);
|
||||||
|
|
|
@ -14,10 +14,6 @@ namespace Oqtane.Repository
|
||||||
db = context;
|
db = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<UserRole> GetUserRoles()
|
|
||||||
{
|
|
||||||
return db.UserRole;
|
|
||||||
}
|
|
||||||
public IEnumerable<UserRole> GetUserRoles(int SiteId)
|
public IEnumerable<UserRole> GetUserRoles(int SiteId)
|
||||||
{
|
{
|
||||||
return db.UserRole
|
return db.UserRole
|
||||||
|
|
Loading…
Reference in New Issue
Block a user