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="row">
|
||||
<div class="col">
|
||||
<div class="col pl-0 pr-0">
|
||||
<select class="form-control" @onchange="(e => FolderChanged(e))">
|
||||
@if (string.IsNullOrEmpty(Folder))
|
||||
{
|
||||
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
@if (haseditpermission)
|
||||
{
|
||||
<div>
|
||||
<span class="text-nowrap">
|
||||
@if (uploadmultiple)
|
||||
{
|
||||
<input type="file" id="@fileinputid" name="file" accept="@filter" multiple />
|
||||
|
@ -54,22 +54,22 @@
|
|||
{
|
||||
<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)
|
||||
{
|
||||
<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>
|
||||
</div>
|
||||
</span>
|
||||
@((MarkupString)@message)
|
||||
}
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
@if (@image != "")
|
||||
{
|
||||
@if (@image != "")
|
||||
{
|
||||
<div class="col-auto pr-0">
|
||||
@((MarkupString)@image)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
StateHasChanged();
|
||||
}
|
||||
|
||||
public async Task CloseFileManager()
|
||||
public void CloseFileManager()
|
||||
{
|
||||
filemanagervisible = false;
|
||||
message = "";
|
||||
|
|
|
@ -145,6 +145,11 @@ namespace Oqtane.Controllers
|
|||
try
|
||||
{
|
||||
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);
|
||||
Files.AddFile(CreateFile(filename, folder.FolderId, folderpath + filename));
|
||||
}
|
||||
|
@ -260,6 +265,11 @@ namespace Oqtane.Controllers
|
|||
}
|
||||
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
|
||||
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));
|
||||
|
@ -326,8 +336,18 @@ namespace Oqtane.Controllers
|
|||
Models.File file = Files.GetFile(id);
|
||||
if (file != null && UserPermissions.IsAuthorized(User, "View", file.Folder.Permissions))
|
||||
{
|
||||
byte[] filebytes = System.IO.File.ReadAllBytes(GetFolderPath(file.Folder) + file.Name);
|
||||
return File(filebytes, "application/octet-stream", file.Name);
|
||||
string filepath = 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.Log(LogLevel.Error, this, LogFunction.Read, "File Does Not Exist {File}", file);
|
||||
HttpContext.Response.StatusCode = 404;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -183,19 +183,26 @@ namespace Oqtane.Controllers
|
|||
string connectionString = Config.GetConnectionString("DefaultConnection");
|
||||
connectionString = connectionString.Replace("|DataDirectory|", datadirectory);
|
||||
|
||||
SqlConnection connection = new SqlConnection(connectionString);
|
||||
try
|
||||
if (!string.IsNullOrEmpty(connectionString))
|
||||
{
|
||||
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 = "Database Does Not Exist";
|
||||
response.Message = "Connection String Has Not Been Specified In Oqtane.Server\\appsettings.json";
|
||||
}
|
||||
|
||||
if (response.Success)
|
||||
|
@ -243,7 +250,7 @@ namespace Oqtane.Controllers
|
|||
var result = dbUpgrade.PerformUpgrade();
|
||||
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
|
||||
|
|
|
@ -16,11 +16,6 @@ namespace Oqtane.Repository
|
|||
this.Permissions = Permissions;
|
||||
}
|
||||
|
||||
public IEnumerable<Folder> GetFolders()
|
||||
{
|
||||
return db.Folder.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Folder> GetFolders(int SiteId)
|
||||
{
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Folder").ToList();
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
|||
{
|
||||
public interface IFolderRepository
|
||||
{
|
||||
IEnumerable<Folder> GetFolders();
|
||||
IEnumerable<Folder> GetFolders(int SiteId);
|
||||
Folder AddFolder(Folder Folder);
|
||||
Folder UpdateFolder(Folder Folder);
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Oqtane.Repository
|
|||
{
|
||||
public interface IModuleRepository
|
||||
{
|
||||
IEnumerable<Module> GetModules();
|
||||
IEnumerable<Module> GetModules(int SiteId);
|
||||
Module AddModule(Module Module);
|
||||
Module UpdateModule(Module Module);
|
||||
Module GetModule(int ModuleId);
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
|||
{
|
||||
public interface IPageModuleRepository
|
||||
{
|
||||
IEnumerable<PageModule> GetPageModules();
|
||||
IEnumerable<PageModule> GetPageModules(int SiteId);
|
||||
PageModule AddPageModule(PageModule PageModule);
|
||||
PageModule UpdatePageModule(PageModule PageModule);
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
|||
{
|
||||
public interface IPageRepository
|
||||
{
|
||||
IEnumerable<Page> GetPages();
|
||||
IEnumerable<Page> GetPages(int SiteId);
|
||||
Page AddPage(Page Page);
|
||||
Page UpdatePage(Page Page);
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
|||
{
|
||||
public interface IProfileRepository
|
||||
{
|
||||
IEnumerable<Profile> GetProfiles();
|
||||
IEnumerable<Profile> GetProfiles(int SiteId);
|
||||
Profile AddProfile(Profile Profile);
|
||||
Profile UpdateProfile(Profile Profile);
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
|||
{
|
||||
public interface IRoleRepository
|
||||
{
|
||||
IEnumerable<Role> GetRoles();
|
||||
IEnumerable<Role> GetRoles(int SiteId);
|
||||
IEnumerable<Role> GetRoles(int SiteId, bool IncludeGlobalRoles);
|
||||
Role AddRole(Role Role);
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Oqtane.Repository
|
|||
{
|
||||
public interface IUserRoleRepository
|
||||
{
|
||||
IEnumerable<UserRole> GetUserRoles();
|
||||
IEnumerable<UserRole> GetUserRoles(int SiteId);
|
||||
IEnumerable<UserRole> GetUserRoles(int UserId, int SiteId);
|
||||
UserRole AddUserRole(UserRole UserRole);
|
||||
|
|
|
@ -25,9 +25,9 @@ namespace Oqtane.Repository
|
|||
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)
|
||||
|
|
|
@ -16,10 +16,6 @@ namespace Oqtane.Repository
|
|||
this.Permissions = Permissions;
|
||||
}
|
||||
|
||||
public IEnumerable<PageModule> GetPageModules()
|
||||
{
|
||||
return db.PageModule;
|
||||
}
|
||||
public IEnumerable<PageModule> GetPageModules(int SiteId)
|
||||
{
|
||||
IEnumerable<PageModule> pagemodules = db.PageModule
|
||||
|
|
|
@ -18,11 +18,6 @@ namespace Oqtane.Repository
|
|||
this.PageModules = PageModules;
|
||||
}
|
||||
|
||||
public IEnumerable<Page> GetPages()
|
||||
{
|
||||
return db.Page.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<Page> GetPages(int SiteId)
|
||||
{
|
||||
IEnumerable<Permission> permissions = Permissions.GetPermissions(SiteId, "Page").ToList();
|
||||
|
|
|
@ -14,11 +14,6 @@ namespace Oqtane.Repository
|
|||
db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<Profile> GetProfiles()
|
||||
{
|
||||
return db.Profile;
|
||||
}
|
||||
|
||||
public IEnumerable<Profile> GetProfiles(int SiteId)
|
||||
{
|
||||
return db.Profile.Where(item => item.SiteId == SiteId || item.SiteId == null);
|
||||
|
|
|
@ -14,11 +14,6 @@ namespace Oqtane.Repository
|
|||
db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<Role> GetRoles()
|
||||
{
|
||||
return db.Role;
|
||||
}
|
||||
|
||||
public IEnumerable<Role> GetRoles(int SiteId)
|
||||
{
|
||||
return db.Role.Where(item => item.SiteId == SiteId);
|
||||
|
|
|
@ -14,10 +14,6 @@ namespace Oqtane.Repository
|
|||
db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<UserRole> GetUserRoles()
|
||||
{
|
||||
return db.UserRole;
|
||||
}
|
||||
public IEnumerable<UserRole> GetUserRoles(int SiteId)
|
||||
{
|
||||
return db.UserRole
|
||||
|
|
Loading…
Reference in New Issue
Block a user