fix bug with privileged users not always showing the most recent profile

temporary bans are now applied to all linked accounts instead of a per-guid basis
rework set level flow
add guid and ip address (if logged in) to public async endpoint
This commit is contained in:
RaidMax
2019-03-24 21:34:20 -05:00
parent 1056c7c335
commit cae6d8389e
15 changed files with 320 additions and 214 deletions

View File

@ -45,7 +45,6 @@ namespace SharedLibraryCore.Services
OriginEntityId = e.Origin.ClientId,
TargetEntityId = e.Target?.ClientId ?? 0,
Comment = "Executed command",
PreviousValue = "",
CurrentValue = e.Message,
TypeOfChange = EFChangeHistory.ChangeType.Command
};
@ -56,8 +55,7 @@ namespace SharedLibraryCore.Services
OriginEntityId = e.Origin.ClientId,
TargetEntityId = e.Target.ClientId,
TypeOfChange = EFChangeHistory.ChangeType.Permission,
PreviousValue = ((Change)e.Extra).PreviousValue,
CurrentValue = ((Change)e.Extra).NewValue
CurrentValue = ((EFClient.Permission)e.Extra).ToString()
};
break;
default:

View File

@ -21,7 +21,6 @@ namespace SharedLibraryCore.Services
{
Level = Permission.User,
FirstConnection = DateTime.UtcNow,
Connections = 1,
LastConnection = DateTime.UtcNow,
Masked = false,
NetworkId = entity.NetworkId,
@ -356,11 +355,25 @@ namespace SharedLibraryCore.Services
}
}
/// <summary>
/// retrieves the number of owners
/// (client level is owner)
/// </summary>
/// <returns></returns>
public async Task<int> GetOwnerCount()
{
using (var ctx = new DatabaseContext(true))
{
return await ctx.Clients.AsNoTracking()
.CountAsync(_client => _client.Level == Permission.Owner);
}
}
public async Task<List<EFClient>> GetPrivilegedClients()
{
using (var context = new DatabaseContext(disableTracking: true))
{
var iqClients = from client in context.Clients
var iqClients = from client in context.Clients.AsNoTracking()
where client.Level >= Permission.Trusted
where client.Active
select new EFClient()