0
Astech created
We have the following which hard deletes users with the name Tim:
public async Task DeleteData(int? tenantId)
{
using (CurrentUnitOfWork.SetTenantId(tenantId))
using (CurrentUnitOfWork.DisableFilter(OurDataFilters.EntitySecurity))
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.SoftDelete))
{
var users = await _userRepository.GetAll().Where(a => a.Name.Contains("Tim")).ToListAsync();
foreach (var user in users)
{
await _userRepository.HardDeleteAsync(user);
await WriteToOutput("user deleted. Id: " + user.Id);
}
}
}
If signed in as host, deleting host data, the user is hard deleted. If signed in as tenant, deleteing tenant data, the user is hard deleted. If signed in as host, deleting tenant data, the user is soft deleted.... why is this?
We need the ability to hard delete tenant data from host login.
Thanks
This is our GetTenantId method if it helps:
public int? GetTenantId()
{
// UOW - either as tenant or host running as tenant
if (UnitOfWorkManager.Current != null && UnitOfWorkManager.Current.GetTenantId() != null)
{
return UnitOfWorkManager.Current.GetTenantId();
}
// Host signed in with no tenant UOW - Get the selected tenantId (this could be null if host selected)
else if (_abpSession.UserId != null && _abpSession.TenantId == null)
{
//var user = await _userManager.FindByIdAsync(_abpSession.GetUserId().ToString()); // Do this instead to make async
var user = _userManager.GetUserById(_abpSession.GetUserId());
return user.HostSelectedTenantId;
}
// Tenant signed in with no UOW
else
{
return _abpSession.GetTenantId();
}
}
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
1 Answer(s)
-
0
Hi @Astech
Thank you for your feedback. We will look into this issue. You can follow the progress and any potential solutions here https://github.com/aspnetboilerplate/aspnetboilerplate/issues/7158
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)