Skip to content

US: Add library team member #47

@gviedma-aulasneo

Description

@gviedma-aulasneo

As a Library Admin, I want to add one or more users to a library, so that I can onboard contributors quickly.

Figma: https://www.figma.com/design/q3Knq0BKoVTBbtaxb81n9R/RBAC---Console---Wireframes?node-id=2749-4312&t=71PeX22gyABqxnHu-4

Acceptance criteria

  • Placement
    Top right action + New Team Member in the Team Members tab header.

  • Access
    Visible and usable only for users with manage team permission.

  • Modal
    Users input accepts one or more usernames or emails, comma separated.
    Role selector lists available library roles for this scope.
    Controls: Close, Cancel, Save.

  • Behavior
    Save validates each entry, trims spaces, deduplicates within the input.
    If a user exists and is not in the team, add them with the selected role.
    If a user exists and is already in the team without that role, add the role.
    If a user already has that role, do nothing.
    If an entry does not match a user, show an error for that specific entry in the modal, but complete the rest.
    On success, close the modal, refresh the Team Members list, and show a toast.

  • States and feedback
    While saving, disable inputs and show a saving state.
    Success toast for multiple entries, "x users added".
    Errors are shown as an error message in the modal, design to be defined.

Notes, out of scope for this card

  • Filtering, sorting, and page size are separate stories.

  • API and detailed error views are defined in separate cards.

Test Cases

Setup

Scenarios

  • 1) Action is visible only to users with manage team
    Given: I am logged in as Admin A
    When: I view the Team Members tab header
    Then: I see + New Team Member
    Given: I am logged in as Member M without manage team
    When: I view the Team Members tab header
    Then: I do not see + New Team Member

  • 2) Open modal and see required controls
    Given: I am logged in as Admin A
    When: I click + New Team Member
    Then: I see a modal with a Users input for emails or usernames, comma separated, a Role selector, and Close, Cancel, Save controls

  • 3) Save is disabled until input and role are provided
    Given: the Add team member modal is open
    When: the Users input is empty or the Role selector is not chosen
    Then: the Save button is disabled

  • 4) Add one new user who is not on the team
    Given: the modal is open and a role is selected
    When: I enter [email protected] and click Save
    Then: the Save button disables while the request runs
    And: when the request succeeds
    Then: the modal closes, the Team Members list refreshes, and I see a success toast

  • 5) Add multiple new users, all valid
    Given: the modal is open and a role is selected
    When: I enter [email protected], [email protected] with extra spaces and click Save
    Then: spaces are trimmed and duplicates are collapsed
    And: when the request succeeds
    Then: the modal closes, the list refreshes, and a success toast reflects multiple additions

  • 6) Existing team member without the selected role gets that role
    Given: the modal is open and role Editor is selected
    When: I enter [email protected] and click Save
    Then: the Save button disables while the request runs
    And: when the request succeeds
    Then: the modal closes, the list refreshes, and I see a success toast

  • 7) Existing team member with the same role results in no change
    Given: the modal is open and role Viewer is selected
    When: I enter [email protected] and click Save
    Then: the request completes with no change to roles
    And: the modal may remain open or close according to design, a success toast is not required

  • 8) Mixed result, subtract successes and keep failures
    Given: the modal is open and a role is selected
    When: I enter [email protected], [email protected] and click Save
    Then: the request completes with a mixed result
    And: the modal stays open
    And: [email protected] is removed from the Users input
    And: [email protected] remains in the Users input for correction
    And: a single summary toast states how many were added and how many failed

  • 9) Validation failure shows toast without Retry
    Given: the modal is open and a role is selected
    When: I enter [email protected] and click Save
    Then: a toast appears that says the user was not found, without a Retry button
    And: the modal remains open with the entered value intact

  • 10) Transient failure shows toast with Retry, modal stays open
    Given: the modal is open and a role is selected
    When: I click Save and the request fails with a transient error, for example 500 or timeout
    Then: a toast appears with a Retry button
    And: the modal remains open
    And: when I click Retry
    Then: a single retry is sent and the Retry button disables while running

  • 11) Trim and deduplicate within the Users input
    Given: the modal is open and a role is selected
    When: I enter [email protected], [email protected] with extra spaces and click Save
    Then: only one request is sent for that user
    And: when the request succeeds
    Then: the modal closes and the list refreshes

  • 12) Cancel closes the modal without changes
    Given: the modal is open with values in the Users input
    When: I click Cancel
    Then: the modal closes and no changes are made to the Team Members list

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions