lablup / lablup/backend.ai

Auto-assign RBAC role not applied when a new user is created with an initial project/domain assignment

Open
#12,171 0 comments 0 reactions 0 assignees View on GitHub
rbac
Dominant language
Python
Stars
670
Forks
183
Avg merge
15h 13m
Merged PRs (30d)
368

Description

## Summary

When an RBAC role is scoped to a project (e.g. `default`) with `auto_assign=true`, a **newly created user** who is assigned to that project **at creation time** is NOT auto-assigned to the role. Assigning the same project to an **existing** user (user update / user-join path) correctly triggers the auto-assignment.

The same problem reproduces with **domain-scoped** roles: a new user created with an initial domain assignment does not receive the domain's auto-assign roles, while attaching the domain to an existing user works.

Reported by HyeokJin Kim.

## Steps to Reproduce

1. Create (or have) an RBAC role whose scope is the `default` project, with `auto_assign=true`.
1. Create a **new user** and assign the `default` project as part of the user creation.
1. Check the new user's role assignments.

## Expected Behavior

The new user is automatically mapped to the project's `auto_assign=true` role(s), the same as when the project is attached to an existing user.

## Actual Behavior

The role is not assigned. The auto-assign mapping only happens when the project (or domain) is attached to an **already existing** user.

## Notes / Suspected Cause

- BA-6190 applied auto-assign roles on the **user-join** path, and BA-6178 maps `auto_assign` roles on user creation but only for the user's **own user-scope** preset roles.
- The user **creation** path with an initial project/domain membership appears to skip the scope-level auto-assign role mapping that the join/update path performs.

JIRA Issue: BA-6479

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.