Fix #5715: delete settings with api.
This commit is contained in:
@@ -20,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)
|
||||||
@@ -97,10 +99,7 @@ namespace Oqtane.Repository
|
|||||||
}
|
}
|
||||||
|
|
||||||
//remove settings for role
|
//remove settings for role
|
||||||
foreach (var setting in db.Setting.Where(item => item.EntityName == EntityNames.Role && item.EntityId == roleId))
|
_settings.DeleteSettings(EntityNames.Role, roleId);
|
||||||
{
|
|
||||||
db.Setting.Remove(setting);
|
|
||||||
}
|
|
||||||
|
|
||||||
Role role = db.Role.Find(roleId);
|
Role role = db.Role.Find(roleId);
|
||||||
db.Role.Remove(role);
|
db.Role.Remove(role);
|
||||||
|
|||||||
Reference in New Issue
Block a user