Delegated ownership (owner_id) for v2 VFolder APIs
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 368
Description
### Background
The v2 VFolder REST/GQL APIs have no way to act on behalf of another user. BA-5901 originally proposed adding owner_access_key (string) to the v2 DTOs, but we adopt the user-UUID-based delegation pattern instead, matching the owner_id field already used by v2 session creation (CreateSessionInput.owner_id). Access-key-based delegation is considered legacy and will not be extended.
### Goal
An authorized caller can create and manage vfolders on behalf of a target user by specifying owner_id (UUID) in the request body. The created vfolder is owned by the target user exactly as if they had created it themselves.
### Scope
- Add owner_id: UUID | None to v2 VFolder request DTOs (common/dto/manager/v2/vfolder/request.py): CreateVFolderInput, CreateVFolderInScopeInput, SearchVFoldersInput, BulkDeleteVFoldersInput, BulkPurgeVFoldersInput, CloneVFolderInput.
- RBAC-based authorization check that the caller is allowed to act on behalf of the target user. Legacy helpers (check_if_requester_is_eligible_to_act_as_target_\*) must not be used.
- Resolve the delegated owner and compute all resource-policy constraints against the owner, consistent with session delegation: max_vfolder_count, allowed vfolder hosts, quota scope. The current checks live in the vfolder service create path (services/vfolder/services/vfolder.py) keyed by action.user_uuid / action.keypair_resource_policy, so the owner identity must be injected there. The exact layer is an implementation decision.
- Record the actual creator separately from the owner where applicable (the CreateVFolderAction already carries a TODO to distinguish creator and owner).
- Propagate the field through the full v2 stack: DTO, adapter, REST handler, GQL type, client SDK v2, CLI v2.
### References
- BA-5901: original request (owner_access_key on v2 Deployment and v2 VFolder DTOs) — superseded by the owner_id approach for the delegation field.
- v2 session delegation precedent: CreateSessionInput.owner_id (common/dto/manager/v2/session/request.py) and SessionService.enqueue_session owner resolution.
JIRA Issue: BA-6469
Contributor guide
Assessment
This issue has not been assessed yet.