error out if no members to operate on were provided when -all is not passed in group member add/remove

This commit is contained in:
dusk 2025-11-23 20:19:23 +00:00
parent c68a77bb32
commit c730820614
No known key found for this signature in database

View file

@ -83,7 +83,7 @@ public class GroupMember
target.Color, opts, all); target.Color, opts, all);
} }
public async Task AddRemoveMembers(Context ctx, PKGroup target, List<PKMember> _members, Groups.AddRemoveOperation op, bool all, bool confirmYes) public async Task AddRemoveMembers(Context ctx, PKGroup target, List<PKMember>? _members, Groups.AddRemoveOperation op, bool all, bool confirmYes)
{ {
ctx.CheckOwnGroup(target); ctx.CheckOwnGroup(target);
@ -98,6 +98,9 @@ public class GroupMember
} }
else else
{ {
if (_members == null)
throw new PKError("Please provide a list of members to add/remove.");
members = _members members = _members
.FindAll(m => m.System == ctx.System.Id) .FindAll(m => m.System == ctx.System.Id)
.Select(m => m.Id) .Select(m => m.Id)