fix: user delete
This commit is contained in:
@ -271,6 +271,7 @@ namespace Oqtane.Controllers
|
|||||||
|
|
||||||
if (result != null)
|
if (result != null)
|
||||||
{
|
{
|
||||||
|
_folders.DeleteUserFolder(id);
|
||||||
_users.DeleteUser(id);
|
_users.DeleteUser(id);
|
||||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Deleted {UserId}", id);
|
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "User Deleted {UserId}", id);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,15 @@ namespace Oqtane.Repository
|
|||||||
_db.Folder.Remove(folder);
|
_db.Folder.Remove(folder);
|
||||||
_db.SaveChanges();
|
_db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
public void DeleteUserFolder(int userId)
|
||||||
|
{
|
||||||
|
string userFolderPath = Utilities.PathCombine("Users", userId.ToString(), System.IO.Path.DirectorySeparatorChar.ToString());
|
||||||
|
List<int> folderIdsToDelete = new List<int>(_db.Folder.Where(a => a.Path == userFolderPath).Select(a => a.FolderId));
|
||||||
|
foreach (int folderId in folderIdsToDelete)
|
||||||
|
{
|
||||||
|
DeleteFolder(folderId);
|
||||||
|
}
|
||||||
|
}
|
||||||
public string GetFolderPath(int folderId)
|
public string GetFolderPath(int folderId)
|
||||||
{
|
{
|
||||||
Folder folder = _db.Folder.Find(folderId);
|
Folder folder = _db.Folder.Find(folderId);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
namespace Oqtane.Repository
|
||||||
@ -12,6 +12,7 @@ namespace Oqtane.Repository
|
|||||||
Folder GetFolder(int folderId, bool tracking);
|
Folder GetFolder(int folderId, bool tracking);
|
||||||
Folder GetFolder(int siteId, string path);
|
Folder GetFolder(int siteId, string path);
|
||||||
void DeleteFolder(int folderId);
|
void DeleteFolder(int folderId);
|
||||||
|
void DeleteUserFolder(int userId);
|
||||||
string GetFolderPath(int folderId);
|
string GetFolderPath(int folderId);
|
||||||
string GetFolderPath(Folder folder);
|
string GetFolderPath(Folder folder);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user