lablup / lablup/backend.ai

Implement BulkPurgeUser GraphQL mutation using Strawberry

Open
#6,035 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Story

As a system administrator, I want to purge multiple users through a single GraphQL mutation so that I can efficiently manage user cleanup operations.

## Technical Details

Implement a new GraphQL mutation `BulkPurgeUser` using the Strawberry framework in `/src/ai/backend/manager/api/gql`.

## Implementation Requirements

### Input Schema

```python
@strawberry.input
class BulkPurgeUserInput:
emails: list[str]
purge_shared_vfolders: bool = False
delegate_endpoint_ownership: bool = False
```

### Output Schema

```python
@strawberry.type
class BulkPurgeUserResult:
success: bool
message: str
succeeded_users: list[str]
failed_users: list[BulkPurgeFailure]

@strawberry.type
class BulkPurgeFailure:
email: str
reason: str
```

### Mutation Implementation

- Location: `/src/ai/backend/manager/api/gql/user.py` (or similar)
- Follow Strawberry conventions for mutation definition
- Integrate with the service layer's bulk_purge_user action
- Handle permission checks (SUPERADMIN only)
- Provide detailed feedback for partial failures

## Acceptance Criteria

- [ ] BulkPurgeUser mutation is accessible via GraphQL API
- [ ] Input validation for email list
- [ ] Proper authorization (SUPERADMIN only)
- [ ] Clear success/failure reporting for each user
- [ ] Integration with service layer bulk_purge_user action
- [ ] GraphQL schema documentation

## Dependencies

- Depends on the service layer bulk_purge_user implementation

## Parent Epic

BA-2510

JIRA Issue: BA-2511

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.