lablup / lablup/backend.ai

Register users into an organization through an invitation that names the role

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

Description

프로젝트와 도메인에 사용자를 등록하는 동작을 초대로 바꾼다. 초대할 때 부여할 역할을 함께 지정한다.

지금은 관리자가 AssignUsersToProjectAction 으로 사용자를 바로 꽂는다. 받는 쪽 동의가 없고, 역할 부여는 별개 경로다. 초대로 바꾸면 등록과 역할 부여가 한 번에 가고 받는 쪽이 거절할 수 있다.

이것은 entity invitation 과 다른 축이다. entity invitation 은 권한 축이고 수락하면 object_permissions 를 넓힌다. 조직 초대는 역할 축이고 수락하면 user_roles 행을 쓴다. 물리적으로 다른 테이블에 다른 프리미티브로 쓰므로 한 테이블에 합치지 않는다. 따로 관리한다.

대상 조직을 별도 칸으로 실어야 한다. roles 행에 스코프 칸이 없다. 역할이 어느 프로젝트 것인지는 permissions 행이 role_id 와 함께 든 scope_type 과 scope_id 가 말한다. 그래서 역할 id 만으로는 어느 조직에 부르는 초대인지 알 수 없다.

역할 템플릿이 이미 있다. role_presets 가 scope_type 과 role_name_template 과 auto_assign 을 들고 있고, RoleTemplateSource 의 template_value 가 역할 이름 템플릿에 들어갈 값을 준다. 이 프로젝트의 member 역할 같은 것을 preset 으로 고르는 형태가 자연스럽다.

대상 엔티티는 role managed entity 다. RoleManagedEntityCreator 를 상속하는 것은 Domain, Project, User, ResourceGroup 넷이다. 이 중 User 는 제외한다 - 사용자를 사용자에게 등록한다는 것이 성립하지 않는다. ResourceGroup 을 포함할지는 착수 전에 사용자에게 확인한다.

착수 전에 물어서 정할 것이 셋이다. 대상 범위에 ResourceGroup 을 넣을지. 초대받는 사람을 이메일로 둘지 사용자 id 로 둘지 - 외부인을 부르는 시나리오가 있으면 이메일이어야 한다. 역할 지정을 role_id 로 직접 받을지 role_preset_id 로 받아 preset 이 스코프별 역할을 만들게 할지.

기존 등록 경로를 어떻게 할지도 정한다. AssignUsersToProjectAction 과 UnassignUsersFromProjectAction 을 초대 경로로 대체할지, 관리자용으로 남길지.

BA-7490 가 머지된 뒤 착수한다 - 옛 role invitation 이 없어진 자리에 이것이 선다.

JIRA Issue: BA-7492

Contributor guide

Open the contributing guide

Research direction

After BA-7490 merges, start by reading AssignUsersToProjectAction, UnassignUsersFromProjectAction, RoleManagedEntityCreator, role_presets, and RoleTemplateSource. Resolve the open questions about ResourceGroup, email versus user ID, role IDs versus presets, and the existing registration path before implementation. Done means a separate organization invitation can be accepted or declined, with the chosen role recorded in user_roles for the specified entity.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authorization, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.