Skip to content

Add validation to prevent users from being defined in multiple groups - #1578

Draft
jpdillingham with Copilot wants to merge 3 commits into
masterfrom
copilot/add-validation-for-user-groups
Draft

Add validation to prevent users from being defined in multiple groups#1578
jpdillingham with Copilot wants to merge 3 commits into
masterfrom
copilot/add-validation-for-user-groups

Conversation

Copilot AI commented Dec 6, 2025

Copy link
Copy Markdown
Contributor

Group configuration dictates user limits and download speeds. Allowing users in multiple groups creates ambiguity about which settings apply.

Changes

  • Validation logic (GroupsOptions.Validate): Collects all usernames from UserDefined and Blacklisted groups, compares total count to distinct count. Returns validation error if counts differ.

  • Test coverage (GroupsOptionsTests.cs): Added 7 test cases covering duplicate detection across UserDefined groups, between UserDefined and Blacklisted, and verification that existing validation still works.

Example

Invalid configuration that will now be rejected:

groups:
  user_defined:
    vip:
      members: [alice, bob]
    premium:
      members: [charlie, alice]  # alice appears twice
  blacklisted:
    members: [bob, eve]  # bob appears twice

Error: "One or more users are defined in more than one group. Each user can only belong to a single group."

Original prompt

This section details on the original issue you should resolve

<issue_title>Add/ensure validation exists to prevent users from being added to more than one group</issue_title>
<issue_description>Because group configuration dictates a user's limits and download speeds, we can't allow them to be defined in more than one group without creating ambiguity about which settings apply.</issue_description>

<agent_instructions>in GroupsOptions.Validate, add an additional check that consolidates all of the usernames defined among the groups and then compares the length of it to the same group with the .Distinct() function called on it. if the length of the two collections isn't the same, a user has been defined in more than one group and the configuration is invalid</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add validation to prevent users from being in multiple groups Add validation to prevent users from being defined in multiple groups Dec 7, 2025
Copilot AI requested a review from jpdillingham December 7, 2025 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add/ensure validation exists to prevent users from being added to more than one group

2 participants