Setup
- Rancher version: v2.13.3
- Rancher UI Extensions: N/A
- Browser type & version: Chrome (latest)
Describe the bug
The Add Project Member dialog in the Project Membership tab does not prevent you from assigning a role to a user or group that they already hold in the same project. Clicking Create silently creates a duplicate ProjectRoleTemplateBinding object. Over time this inflates the total PRTB count, compounding the display issues described in #17808, and causes multiple identical rows to appear in the table.
To Reproduce
- Navigate to any cluster → Cluster and Project Members → Project Membership tab
- For any project that already has a member with at least one role, click Add Project Member
- Select the same user/group and the same role they already hold in that project
- Click Create
- Observe that a duplicate entry is created without any warning or error
Result
A new ProjectRoleTemplateBinding is created for every selected role with no duplicate check, even when identical bindings already exist.
Expected Result
If the selected user/group already holds the selected role in the project:
- Show an error and prevent creation if all selected roles are already assigned
- Show a warning and skip only the duplicates if some selected roles are new
The check should be keyed on projectId (not project display name) so that projects with the same name in different clusters are correctly distinguished.
Screenshots
N/A
Additional context
The root cause is in shell/dialog/AddProjectMemberDialog.vue — the createBindings method dispatches rancher/create for every selected roleTemplateId without checking whether a binding with the same projectId + roleTemplateId + principalId already exists in the Vuex store.
Duplicate bindings also inflate the global PRTB count, making the scale issue described in #17808 worse over time.
Fix tracked in #17814.
Setup
Describe the bug
The Add Project Member dialog in the Project Membership tab does not prevent you from assigning a role to a user or group that they already hold in the same project. Clicking Create silently creates a duplicate
ProjectRoleTemplateBindingobject. Over time this inflates the total PRTB count, compounding the display issues described in #17808, and causes multiple identical rows to appear in the table.To Reproduce
Result
A new
ProjectRoleTemplateBindingis created for every selected role with no duplicate check, even when identical bindings already exist.Expected Result
If the selected user/group already holds the selected role in the project:
The check should be keyed on
projectId(not project display name) so that projects with the same name in different clusters are correctly distinguished.Screenshots
N/A
Additional context
The root cause is in
shell/dialog/AddProjectMemberDialog.vue— thecreateBindingsmethod dispatchesrancher/createfor every selectedroleTemplateIdwithout checking whether a binding with the sameprojectId+roleTemplateId+principalIdalready exists in the Vuex store.Duplicate bindings also inflate the global PRTB count, making the scale issue described in #17808 worse over time.
Fix tracked in #17814.