mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-15 20:54:15 +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);
|
var (hasRights, group) = await TryValidateGroupModeratorOrOwner(dto.Group.GID).ConfigureAwait(false);
|
||||||
if (!hasRights) return -1;
|
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)
|
.Where(g => g.GroupGID == dto.Group.GID)
|
||||||
.ToListAsync().ConfigureAwait(false);
|
.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);
|
&& p.GroupUser.LastLoggedIn.AddDays(days) < DateTime.UtcNow);
|
||||||
|
|
||||||
if (!execute) return usersToPrune.Count();
|
if (!execute) return usersToPrune.Count();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue