# Assigning Users to a Role ## Overview Roles are assigned to users either at the time of user creation or afterwards through the role management screen. A user can hold one primary role. This page covers the role assignment workflow from the role side — finding which users belong to a role and adding role privileges to a user's department. ## When to Use - Adding role-based privileges to a user for a specific department - Reviewing which users have been assigned a given role - Resetting a user's role privileges to match the current role definition after the role was updated ## Navigating to Role-User Management 1. Click **Administration** → **Manage Users** 2. Navigate to the role management area 3. Select the role from the list 4. Click **Manage User Role Users** from the role actions > **Required privilege:** AdminManagingUsers ## Assigning a Role to a User from the User Record The most common way to assign a role is during user creation or editing: 1. Open **Administration** → **Manage Users** 2. Click **Manage User** for the user you want to change 3. The role assignment is made during user creation (the **User Role** field on the **Add New User** form) For existing users, the role can be updated via the user edit form. ## Applying Role Privileges to a Department The **Manage User Role Users** screen allows you to push role privileges to a specific user-department combination: 1. The **User** field shows the selected user (currently read-only in view) 2. Select the **Department** from the dropdown 3. Select the **Role** from the dropdown 4. Click **Add Role Privileges to Department** This operation copies the role's current privilege set to the user's individual privilege record for that department. It is useful when you want a user to have role-equivalent access in a department that they are not formally assigned to. ## Resetting Privileges In the role-user table, each row has a **Reset Privilege** button (shown when `needUpdateUserRole` is true). Clicking this re-syncs the user's privileges with the current role definition. Use this after updating the role's privileges so existing users reflect the new set. ## Removing a Role Assignment Click the trash icon in the Actions column to remove a user's role assignment. This does not delete the user; it only removes their role-based privileges. ## Technical Notes (Admin/Developer) Role assignment is handled by `WebUserRoleUserController`. The `addUsersToDepartmentRoleWithPrivileges()` method creates a `WebUserRoleUser` entity linking the user, department, and role, then copies the role's `WebUserRolePrivilege` entries to `UserPrivilege` records for that user-department pair. The `resetRolePrivileges(user)` method re-applies the current role privileges to override any individual changes. ## Related Features - [Understanding Roles and Privileges](Admin-Roles-and-Privileges-Overview) - [Creating and Managing User Roles](Admin-Creating-and-Managing-Roles) - [Assigning Privileges to a Role](Admin-Assigning-Privileges-to-a-Role) - [Creating and Managing Users](Admin-Creating-and-Managing-Users)