# Assign Role To User

## User Story

As a user with the appropriate role, I want to assign a role to a user, so that they gain the role's permissions.

## Story Diagram

```mermaid
flowchart TD
    A[Open User Detail] --> B[Click Assign Role]
    B --> C[Select role from list]
    C --> D[Confirm]
    D --> E{Validation}
    E -- Role already assigned --> F[Show duplicate assignment error]
    E -- Valid --> G[Role assigned to user]
```

## Scenario Patterns

- Assign a role that is not yet assigned to the user
- Saving role assignments without changes leaves the user's roles unchanged

## Test Cases

- Select a role not yet assigned to the user and confirm; verify the role appears in the user's role list
- Attempt to assign a role the user already holds; verify an error is shown and no duplicate assignment is created

## Screens

- [user-detail](../../../screen/user-detail.md)

## Resolvers

- [updateUserRoles](../../../resolver/updateUserRoles.md)
