Skip to content

US: Add a new role to a library member #45

Description

@gviedma-aulasneo

As a Library Admin, I want to add a new role to an existing library member, so that I can expand their access.

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

Acceptance criteria

  • Placement
    Add New Role action in the User View header, same level as the page title.

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

  • Modal
    Role selector lists available library roles for this scope.
    Controls: Close, Cancel, Save.
    User is preselected, no user input field.

  • Behavior
    Save assigns the selected role to the member.
    If the member already has that role, do nothing.
    On success, close the modal, refresh the User View, and show a toast, "Role added successfully."

  • States and feedback
    While saving, disable inputs and show a saving state.
    Errors are shown as an error message in the modal, design to be defined.

Notes, out of scope for this card

  • API and detailed error views are defined in a separate card.

Test Cases

Setup

  • Admin A has the manage team permission for the target library.
  • Member X is an existing member of the target library.
  • At least one library role exists that Member X does not already have.
  • Start on Libraries → Library Team Management → User View for Member X.

Scenarios

  • 1) Action is visible only to users with manage team
    Given: I am logged in as Admin A with manage team
    When: I view the User View header for Member X
    Then: I see the Add New Role action
    Given: I am logged in without the manage team permission
    When: I view the User View header for Member X
    Then: I do not see the Add New Role action

  • 2) Open modal and see required controls
    Given: I am on User View for Member X as Admin A
    When: I click Add New Role
    Then: I see a modal with a Role selector and the controls Close, Cancel, Save
    And: I do not see any user input field, the target user is preselected

  • 3) Save is disabled until a role is selected
    Given: the Add New Role modal is open
    When: no role is selected
    Then: the Save button is disabled

  • 4) Assign a new role that the member does not have
    Given: the Add New Role modal is open
    And: the selected role is not currently assigned to Member X
    When: I click Save
    Then: the Save button disables while the request runs
    And: when the request succeeds
    Then: the modal closes, the User View refreshes, I see a success toast, Role added successfully, and a Role Card for the newly added role is visible

  • 5) Selecting an already held role makes no change
    Given: the Add New Role modal is open
    And: the selected role is already assigned to Member X
    When: I click Save
    Then: no change is made to Member X roles

  • 6) While saving, inputs are disabled and no duplicate requests are sent
    Given: the Add New Role modal is open
    When: I click Save
    Then: the primary action and inputs are disabled during the request
    And: only a single network request is sent even if I click again

  • 7) Cancel closes the modal without changes
    Given: the Add New Role modal is open
    When: I click Cancel
    Then: the modal closes and no changes are made to Member X roles

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions