Merge pull request #5716 from zyhfish/task/fix-5715
Fix #5715: delete role settings.
This commit is contained in:
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Oqtane.Models;
|
using Oqtane.Models;
|
||||||
|
using Oqtane.Shared;
|
||||||
|
|
||||||
namespace Oqtane.Repository
|
namespace Oqtane.Repository
|
||||||
{
|
{
|
||||||
@@ -19,10 +20,12 @@ namespace Oqtane.Repository
|
|||||||
public class RoleRepository : IRoleRepository
|
public class RoleRepository : IRoleRepository
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<TenantDBContext> _dbContextFactory;
|
private readonly IDbContextFactory<TenantDBContext> _dbContextFactory;
|
||||||
|
private readonly ISettingRepository _settings;
|
||||||
|
|
||||||
public RoleRepository(IDbContextFactory<TenantDBContext> dbContextFactory)
|
public RoleRepository(IDbContextFactory<TenantDBContext> dbContextFactory, ISettingRepository settings)
|
||||||
{
|
{
|
||||||
_dbContextFactory = dbContextFactory;
|
_dbContextFactory = dbContextFactory;
|
||||||
|
_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Role> GetRoles(int siteId)
|
public IEnumerable<Role> GetRoles(int siteId)
|
||||||
@@ -95,6 +98,9 @@ namespace Oqtane.Repository
|
|||||||
db.Permission.Remove(permission);
|
db.Permission.Remove(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//remove settings for role
|
||||||
|
_settings.DeleteSettings(EntityNames.Role, roleId);
|
||||||
|
|
||||||
Role role = db.Role.Find(roleId);
|
Role role = db.Role.Find(roleId);
|
||||||
db.Role.Remove(role);
|
db.Role.Remove(role);
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
|
|||||||
Reference in New Issue
Block a user