mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 22:17:22 +01:00
do not allow to prune owner
This commit is contained in:
parent
ce0f123037
commit
bd128e832f
1 changed files with 4 additions and 2 deletions
|
|
@ -512,10 +512,12 @@ public partial class MareHub
|
|||
var (hasRights, group) = await TryValidateGroupModeratorOrOwner(dto.Group.GID).ConfigureAwait(false);
|
||||
if (!hasRights) return -1;
|
||||
|
||||
var allGroupUsers = await DbContext.GroupPairs.Include(p => p.GroupUser)
|
||||
var allGroupUsers = await DbContext.GroupPairs.Include(p => p.GroupUser).Include(p => p.Group)
|
||||
.Where(g => g.GroupGID == dto.Group.GID)
|
||||
.ToListAsync().ConfigureAwait(false);
|
||||
var usersToPrune = allGroupUsers.Where(p => !p.IsPinned && !p.IsModerator && p.GroupUserUID != UserUID
|
||||
var usersToPrune = allGroupUsers.Where(p => !p.IsPinned && !p.IsModerator
|
||||
&& p.GroupUserUID != UserUID
|
||||
&& p.Group.OwnerUID != p.GroupUserUID
|
||||
&& p.GroupUser.LastLoggedIn.AddDays(days) < DateTime.UtcNow);
|
||||
|
||||
if (!execute) return usersToPrune.Count();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue