Use Case 014: Bulk User Operations and Management
Overview
| Property | Value |
|---|---|
| Use Case ID | UC-014 |
| Use Case Name | Bulk User Operations and Management |
| Module | Identity Management - Bulk Operations |
| Priority | Medium |
| Status | Implemented |
| Version | 1.0 |
| Last Updated | January 30, 2026 |
Description
This use case describes the comprehensive bulk operations functionality that enables administrators to efficiently manage multiple trial users simultaneously. The system supports importing users from CSV files, performing mass updates (trial extensions, deactivations, access grants), sending bulk communications, and exporting filtered user lists. All bulk operations are processed asynchronously with progress tracking, validation, error handling, and audit logging. Administrators can preview changes in dry-run mode and rollback failed operations to maintain data integrity.
Actors
| Actor | Description | Role |
|---|---|---|
| Administrator | System administrator managing trial users at scale | Primary |
| System | Application Manager platform with job processing engine | Supporting |
| Job Queue | Background job processor for async bulk operations | Supporting |
| Email Service | SMTP or AWS SES for bulk email sending | Supporting |
| Audit Service | Logging service for compliance and tracking | Supporting |
Preconditions
- Administrator is authenticated with appropriate permissions (BulkUserOperations role)
- Application Manager is running with job processing enabled
- Database is accessible and has sufficient capacity for bulk operations
- Email service is configured (for bulk email operations)
- CSV import templates are available and documented
- Audit logging is enabled for compliance tracking
- Job queue workers are running and healthy
Postconditions
Success Postconditions
- Bulk operation completed with success/failure summary
- All affected user records updated in database
- Job execution logged with detailed results
- Audit trail records created for each modified user
- Notification email sent to administrator with results
- Any failures documented with error details
- Rollback information stored for recovery if needed
- Progress tracking data available for review
Failure Postconditions
- Partial completion data preserved
- Error details logged with specific failure reasons
- Rollback executed if critical failure detected
- Administrator notified of failure with diagnostics
- No data corruption from incomplete operations
- Job marked as failed with retry options
Triggers
- Administrator clicks "Import Users from CSV" button
- Administrator selects users and chooses bulk action
- Administrator schedules bulk email campaign
- Administrator exports filtered user list
- Automated job triggers bulk trial extension (scheduled)
- API client calls bulk operations endpoint
Basic Flow (Happy Path) - CSV Import
Detailed Steps - CSV Import
Administrator Initiates Import
- Navigate to "Users > Bulk Operations > Import from CSV"
- System displays upload form with template download link
- Administrator downloads CSV template if needed
Administrator Uploads CSV File
- Select CSV file (max 10MB, max 10,000 users)
- Optionally specify import options:
- Trial duration (default or per-row)
- Default applications to grant
- Send welcome emails (yes/no)
- Validation mode (strict/lenient)
System Validates CSV File
- Check file format (UTF-8, comma-delimited)
- Verify required columns present: Email, FullName
- Validate optional columns: CompanyName, PhoneNumber, TrialDuration, Applications
- Check data quality:
- Email format validation (all rows)
- Name length validation
- Trial duration range (1-365 days)
- Application IDs exist
- Detect duplicate emails within file
- Check for existing users in database
- Return validation summary with warnings/errors
System Creates Bulk Import Job
- Generate unique job ID (GUID)
- Store job metadata: type, user ID, filename, row count
- Set initial status: Queued
- Calculate estimated completion time
- Enqueue job for background processing
- Return 202 Accepted with job tracking URL
Background Worker Processes Job
- Pick up job from queue
- Update status: Processing
- Initialize progress tracking (0% complete)
- Process users in batches of 50 (for transaction safety)
Worker Creates Each Trial User
- For each valid row in CSV:
- Check if email already exists (skip or error based on config)
- Generate login token and API token
- Calculate trial expiration date
- Create TrialUser record
- Create application access grants
- Queue welcome email (if enabled)
- Log creation in audit trail
- Increment success counter
- For each error:
- Log error details (row number, field, reason)
- Increment failure counter
- Continue processing (fail-open strategy)
- For each valid row in CSV:
Worker Sends Welcome Emails
- Batch email sending (max 10/second for rate limiting)
- Track email delivery success/failure separately
- Log email delivery attempts
Worker Completes Job
- Update job status: Completed (or CompletedWithErrors)
- Store final counts: total, success, failed, skipped
- Generate detailed results CSV with all errors
- Send completion notification email to administrator
- Push final results to Web UI (WebSocket)
Administrator Reviews Results
- View summary: "198 users created, 2 failed"
- Download detailed results CSV
- Review error details for failed rows
- Take corrective action for failures (re-import, manual creation)
System Cleans Up
- Archive uploaded CSV file (retain 30 days)
- Compress job results (retain 90 days)
- Update analytics and metrics
Basic Flow (Happy Path) - Bulk Trial Extension
Alternative Flows
Alt Flow 1: CSV Validation Failures
Critical Errors (Block Import):
- Missing required columns (Email, FullName)
- Invalid file encoding
- Malformed CSV structure
- File exceeds size limit (>10MB)
- Row count exceeds limit (>10,000)
- All emails invalid format
Warnings (Allow with Confirmation):
- Some rows have invalid emails (will be skipped)
- Duplicate emails within file
- Some emails already exist in database
- Some application IDs not found
- Some trial durations out of range (will use default)
Steps:
- System detects validation issues during step 3
- If critical errors found:
- Return 400 Bad Request
- Include detailed error report
- Highlight affected rows/columns
- Provide correction guidance
- Administrator fixes and re-uploads
- If warnings only:
- Display warnings with row numbers
- Show "X rows will be skipped" message
- Offer "Proceed Anyway" or "Cancel" options
- If proceed: create job and process valid rows only
Alt Flow 2: Bulk Operation with Dry-Run Mode
Steps:
- Administrator selects users and bulk action
- Administrator clicks "Preview Changes" (dry-run mode)
- System executes operation in preview mode:
- Read all user records
- Calculate all proposed changes
- Validate all changes would succeed
- Check for conflicts or constraints
- Generate preview report
- Do not commit any changes
- System returns preview report:
- Number of users affected
- List of changes per user (before/after)
- Any validation warnings
- Estimated execution time
- Administrator reviews preview
- If approved:
- Administrator clicks "Execute"
- System creates actual job (without dry-run flag)
- If canceled:
- No job created, no changes made
Alt Flow 3: Partial Failure with Rollback
Rollback Strategy by Operation Type:
Transactional (Full Rollback):
- Bulk role assignments
- Bulk password resets
- Bulk deactivation (if critical)
Fail-Open (Continue on Error):
- Bulk email sending
- CSV imports
- Bulk trial extensions (already-expired users can fail)
Steps:
- Worker processes bulk operation in batches
- Critical failure detected in batch N:
- Database connection lost
- Constraint violation that affects all remaining
- Transaction deadlock
- If operation type is transactional:
- Rollback current batch (not committed)
- Preserve previously committed batches
- Mark job as PartiallyCompleted
- Store detailed failure information
- If operation type is fail-open:
- Log failure for specific records
- Continue processing remaining batches
- Mark individual records as failed
- Complete job with error summary
- Administrator notified with:
- Partial completion status
- Error details and diagnostics
- Option to retry failed records
- Manual intervention guidance if needed
Alt Flow 4: Bulk Email Rate Limiting
Steps:
- Bulk email job starts with large user list
- Worker sends emails at configured rate (10/second)
- Email service returns rate limit error (429)
- Worker detects rate limit:
- Pause sending
- Apply exponential backoff: 60s → 120s → 240s
- Report progress as "Rate Limited - Waiting"
- After backoff period:
- Retry failed batch
- If successful: reset backoff, continue
- If still rate limited: increase backoff, retry
- Job continues until all emails sent
- Total time extends but operation completes
- Administrator sees: "Email sent to 4,985 users (15 failed permanently)"
Alt Flow 5: Concurrent Bulk Operations Conflict
Steps:
- Administrator 1 starts bulk operation on user set A
- Administrator 2 starts bulk operation on user set B
- System detects overlap between sets A and B
- System checks operation compatibility:
- Compatible: Allow concurrent (e.g., both reading)
- Incompatible: Block second operation (e.g., both modifying)
- If conflict detected:
- Return 409 Conflict to second administrator
- Include details: "X users are locked by Job ID Y"
- Provide options: wait, adjust selection, or cancel
- Administrator can:
- Wait for first operation to complete
- Modify selection to exclude locked users
- Cancel and retry later
Business Rules
| Rule ID | Description | Enforcement |
|---|---|---|
| BR-001 | Maximum 10,000 users per CSV import | API validation + file parser |
| BR-002 | Maximum 1,000 users per real-time bulk operation | UI selection limit + API validation |
| BR-003 | Bulk operations > 1,000 users must be async (job queue) | API business logic |
| BR-004 | Email sending rate limited to 10/second (configurable) | Background worker throttling |
| BR-005 | CSV files retained for 30 days, results for 90 days | Scheduled cleanup job |
| BR-006 | Dry-run mode required for operations affecting > 500 users | UI workflow + API validation |
| BR-007 | Only users with BulkUserOperations permission can execute | Authorization middleware |
| BR-008 | Concurrent modifications to same user set blocked | Database locking + conflict detection |
| BR-009 | Bulk deactivation requires confirmation for > 100 users | UI confirmation dialog |
| BR-010 | Trial extensions cannot exceed 365 days total trial time | Business logic validation |
| BR-011 | Audit log entry required for every user modification | Audit service integration |
| BR-012 | Job results downloadable for 90 days after completion | Job cleanup policy |
Bulk Operation Types
1. CSV Import
Description: Create multiple trial users from CSV file
Input:
- CSV file with columns: Email (required), FullName (required), CompanyName, PhoneNumber, TrialDuration, Applications
- Import options: default trial duration, default applications, send emails
Process:
- Validate CSV structure and data quality
- Check for duplicates (within file and database)
- Create trial users in batches
- Generate tokens and credentials
- Send welcome emails (optional, rate limited)
Output:
- Success count, failure count, skipped count
- Detailed error report (CSV) with row numbers and reasons
- List of created user IDs
Rollback: Fail-open (skip invalid rows, process rest)
2. Bulk Trial Extension
Description: Extend trial expiration date for multiple users
Input:
- List of trial user IDs or selection criteria
- Extension period (days to add)
- Optional: send notification email
Process:
- Load current trial expiration for each user
- Calculate new expiration: current + extension days
- Update TrialExpirationDate and application access expirations
- Send notification emails (optional)
Output:
- Number of users extended
- New expiration dates
- Email delivery status
Rollback: Transactional per batch (can revert changes)
3. Bulk Deactivation
Description: Deactivate multiple trial users
Input:
- List of trial user IDs or selection criteria (e.g., expired > 30 days, company = "ABC Corp")
- Reason/notes for deactivation
- Revoke sessions (yes/no)
Process:
- Set IsActive = false for each user
- Revoke all active sessions (if requested)
- Revoke application access grants
- Log deactivation reason in notes
- Send notification email (optional)
Output:
- Number of users deactivated
- Number of sessions revoked
- List of deactivated user IDs
Rollback: Transactional (can reactivate if failed)
4. Bulk Application Access Grant
Description: Grant access to application(s) for multiple users
Input:
- List of trial user IDs or selection criteria
- Application ID(s) to grant
- Access duration (inherits trial expiration or custom)
Process:
- For each user and application:
- Check if access already exists (skip if yes)
- Create TrialUserApplication record
- Set appropriate expiration date
- Send notification email (optional)
Output:
- Number of access grants created
- Number of users already had access (skipped)
- Email delivery status
Rollback: Fail-open (continue on individual failures)
5. Bulk Email Sending
Description: Send announcement or notification to multiple users
Input:
- List of trial user IDs or selection criteria (e.g., all active users)
- Email template ID or custom message
- Subject line
- Personalization tokens (e.g., , )
Process:
- Filter users based on criteria
- Render email template with personalization
- Send emails in batches with rate limiting
- Track delivery success/failure
- Handle bounces and unsubscribes
Output:
- Number of emails sent successfully
- Number of delivery failures
- Bounce list
- Unsubscribe count
Rollback: None (emails cannot be unsent, but failures retryable)
6. Export User List
Description: Export filtered user list to CSV or Excel
Input:
- Filter criteria: status, expiration date range, company, applications, etc.
- Export format: CSV or Excel
- Columns to include (customizable)
Process:
- Query database with filters
- Generate export file with selected columns
- Include computed fields (days until expiration, login count, etc.)
- Stream large result sets (avoid memory overflow)
- Compress if > 10MB
Output:
- CSV or Excel file download
- Row count
- File size
Rollback: N/A (read-only operation)
7. Bulk Password Reset
Description: Generate new login tokens for multiple users
Input:
- List of trial user IDs or selection criteria
- Send notification email (yes/no)
- Invalidate old tokens immediately (yes/no)
Process:
- For each user:
- Generate new login token (32 chars)
- Generate new API token (64 chars)
- Update user record with new tokens
- Invalidate existing sessions (if requested)
- Send email with new tokens (if requested)
Output:
- Number of tokens reset
- Number of sessions invalidated
- Email delivery status
Rollback: Transactional (can restore old tokens if failed)
8. Bulk Role Assignment
Description: Assign or remove roles for multiple users
Input:
- List of trial user IDs
- Role(s) to assign or remove
- Operation: add or remove
Process:
- For each user:
- Check current roles
- Add or remove specified roles
- Update user-role mapping
- Log role change in audit trail
Output:
- Number of users updated
- Role changes summary
Rollback: Transactional (can revert role changes)
Data Requirements
Bulk Operation Job Record
{
"Id": "uuid-v4",
"JobType": "CsvImport | BulkExtension | BulkDeactivation | BulkEmailSend | BulkAccessGrant | BulkPasswordReset | BulkRoleAssignment | UserExport",
"Status": "Queued | Processing | Completed | CompletedWithErrors | Failed | Cancelled",
"CreatedBy": "uuid-v4 (admin user ID)",
"CreatedAt": "datetime (UTC)",
"StartedAt": "datetime (UTC, nullable)",
"CompletedAt": "datetime (UTC, nullable)",
"TotalRecords": "integer (total to process)",
"ProcessedRecords": "integer (completed)",
"SuccessCount": "integer",
"FailureCount": "integer",
"SkippedCount": "integer",
"ProgressPercentage": "decimal (0-100)",
"EstimatedCompletionTime": "datetime (UTC, nullable)",
"Parameters": "JSON (operation-specific input)",
"ResultsSummary": "JSON (operation-specific output)",
"ErrorDetails": "JSON array (failed records with reasons)",
"ResultsFileUrl": "string (S3/blob URL to detailed results CSV)",
"CanRollback": "boolean",
"RolledBack": "boolean",
"Notes": "string (admin notes or failure diagnostics)"
}
CSV Import Row Result
{
"RowNumber": 5,
"Email": "john.doe@example.com",
"Status": "Success | Failed | Skipped",
"UserId": "uuid-v4 (if created)",
"ErrorMessage": "string (if failed)",
"ErrorCode": "DuplicateEmail | InvalidFormat | DatabaseError"
}
Bulk Operation Parameters (Examples)
CSV Import:
{
"fileName": "users-2026-01-30.csv",
"fileSize": 524288,
"defaultTrialDuration": 30,
"defaultApplicationIds": ["app-1", "app-2"],
"sendWelcomeEmails": true,
"validationMode": "Strict"
}
Bulk Trial Extension:
{
"userIds": ["user-1", "user-2", "..."],
"extensionDays": 30,
"sendNotificationEmails": true,
"reason": "Product feedback program participation"
}
Bulk Email Send:
{
"recipientFilter": {
"isActive": true,
"expiresInDays": 7
},
"emailTemplateId": "trial-expiration-reminder",
"subject": "Your trial is expiring soon",
"customMessage": "We hope you're enjoying Riptide...",
"personalizationTokens": ["FullName", "ExpirationDate", "ApplicationNames"]
}
User Interface
Bulk Operations Dashboard
┌─────────────────────────────────────────────────────────────────┐
│ Bulk User Operations [New Job]│
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ Recent Jobs [Filter] [Refresh] │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Job ID Type Status Records Created ││
│ │───────────────────────────────────────────────────────────│││
│ │ JOB-12345 CSV Import ✅ Done 200/200 5 mins ago ││
│ │ JOB-12344 Trial Extend ✅ Done 45/45 1 hour ago ││
│ │ JOB-12343 Email Send ⚠️ Errors 498/500 2 hours ago ││
│ │ JOB-12342 Deactivation ✅ Done 78/78 Yesterday ││
│ │ JOB-12341 Access Grant ✅ Done 150/150 2 days ago ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Active Jobs │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ JOB-12346 - Bulk Email Send │││
│ │ Status: Processing │││
│ │ Progress: [████████████████░░░░░░░░] 68% (3,400/5,000) │││
│ │ Estimated time remaining: 12 minutes │││
│ │ [View Details] [Cancel Job] │││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Quick Actions │
│ ┌──────────────────┐ ┌──────────────────┐ ┌─────────────────┐│
│ │ 📤 Import CSV │ │ 📧 Send Email │ │ 📥 Export Users ││
│ │ Upload user file │ │ Bulk announcement│ │ Download list ││
│ └──────────────────┘ └──────────────────┘ └─────────────────┘│
│ ┌──────────────────┐ ┌──────────────────┐ ┌─────────────────┐│
│ │ ⏰ Extend Trials │ │ 🚫 Deactivate │ │ 🔑 Reset Tokens ││
│ │ Add more time │ │ Bulk disable │ │ Generate new ││
│ └──────────────────┘ └──────────────────┘ └─────────────────┘│
│ │
└─────────────────────────────────────────────────────────────────┘
CSV Import Wizard
┌─────────────────────────────────────────────────────────────────┐
│ Import Users from CSV Step 1 of 3 │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ 1. Upload File │
│ │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Drag and drop CSV file here or click to browse ││
│ │ ││
│ │ 📄 Click to Upload ││
│ │ ││
│ │ Supported: CSV files up to 10MB (max 10,000 users) ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ 📥 [Download CSV Template] │
│ │
│ Required columns: Email, FullName │
│ Optional columns: CompanyName, PhoneNumber, TrialDuration, │
│ Applications (comma-separated IDs) │
│ │
│ Import Options │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Default Trial Duration: [30 ] days ││
│ │ ││
│ │ Default Applications: ││
│ │ ☑ Fee Manager ││
│ │ ☑ Value Manager ││
│ │ ☐ Workflow Designer ││
│ │ ││
│ │ ☑ Send welcome emails to new users ││
│ │ ☑ Skip users with existing emails (don't create duplicates)││
│ │ ││
│ │ Validation Mode: ◉ Strict ○ Lenient ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ [Cancel] [Next: Validate >] │
└─────────────────────────────────────────────────────────────────┘
Import Validation Results
┌─────────────────────────────────────────────────────────────────┐
│ Import Users from CSV Step 2 of 3 │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ 2. Validation Results │
│ │
│ File: users-2026-01-30.csv (200 rows) │
│ │
│ ✅ 198 users ready to import │
│ ⚠️ 2 rows have errors and will be skipped │
│ │
│ Summary │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Total rows: 200 ││
│ │ Valid users: 198 ││
│ │ Duplicate emails: 1 (existing in database) ││
│ │ Invalid emails: 1 (malformed format) ││
│ │ Missing required fields: 0 ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Errors & Warnings [Download Report] │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Row Email Issue ││
│ │───────────────────────────────────────────────────────────│││
│ │ 5 john.doeexample.com Invalid email format │││
│ │ 42 existing@company.com Email already exists │││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ ⚠️ These 2 rows will be SKIPPED. Other users will be imported.│
│ │
│ [< Back] [Cancel] [Import 198 Users]│
└─────────────────────────────────────────────────────────────────┘
Bulk Operation Progress
┌─────────────────────────────────────────────────────────────────┐
│ Import Users from CSV Step 3 of 3 │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ 3. Processing │
│ │
│ Job ID: JOB-12345 │
│ Status: Processing │
│ │
│ Progress │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ [████████████████████████████░░░░░░░░] 75% (150/198) ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Creating user accounts... │
│ Estimated time remaining: 1 minute 30 seconds │
│ │
│ Details │
│ • Created: 150 users │
│ • Failed: 0 users │
│ • Remaining: 48 users │
│ │
│ Activity Log │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ [15:43:22] Starting batch 1 (50 users)... ││
│ │ [15:43:28] Batch 1 complete: 50 success, 0 failed ││
│ │ [15:43:28] Sending welcome emails... ││
│ │ [15:43:35] Starting batch 2 (50 users)... ││
│ │ [15:43:41] Batch 2 complete: 50 success, 0 failed ││
│ │ [15:43:41] Starting batch 3 (50 users)... ││
│ │ [15:43:47] Batch 3 complete: 50 success, 0 failed ││
│ │ [15:43:47] Starting batch 4 (48 users)... ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ You can safely close this window. You'll receive an email when │
│ the import is complete. │
│ │
│ [View in Background] [Cancel Import] │
└─────────────────────────────────────────────────────────────────┘
Bulk Operation Results
┌─────────────────────────────────────────────────────────────────┐
│ ✅ Import Complete - JOB-12345 │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ CSV Import completed successfully! │
│ │
│ Summary │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Total processed: 198 users ││
│ │ ✅ Created: 198 users ││
│ │ ❌ Failed: 0 users ││
│ │ ⏭️ Skipped: 2 users (validation errors) ││
│ │ ││
│ │ Duration: 2 minutes 15 seconds ││
│ │ Completed: January 30, 2026 at 3:45 PM ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Email Delivery │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ ✅ Sent: 195 emails ││
│ │ ⚠️ Failed: 3 emails (delivery issues) ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Actions │
│ 📥 [Download Detailed Results CSV] │
│ 📥 [Download Failed Email List] │
│ 📧 [Resend Failed Emails] │
│ │
│ Created Users [View All 198] │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ john.doe@example.com John Doe User-1234 ││
│ │ jane.smith@company.com Jane Smith User-1235 ││
│ │ bob.jones@enterprise.org Bob Jones User-1236 ││
│ │ ... ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ [Close] [Import More Users] │
└─────────────────────────────────────────────────────────────────┘
Bulk Trial Extension Dialog
┌─────────────────────────────────────────────────────────────────┐
│ Extend Trial for Selected Users [Close] │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ You have selected 45 users │
│ │
│ Extension Details │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ Extend by: [30 ] days ││
│ │ ││
│ │ Reason/Notes (optional): ││
│ │ ┌──────────────────────────────────────────────────────┐ ││
│ │ │ Product feedback program - additional evaluation time│ ││
│ │ └──────────────────────────────────────────────────────┘ ││
│ │ ││
│ │ ☑ Send notification email to affected users ││
│ │ ☑ Extend application access grants ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Preview Changes [Show Preview]│
│ │
│ ⚠️ Important: This will extend the trial expiration date for │
│ all selected users. This action can be rolled back if │
│ needed within 24 hours. │
│ │
│ [Cancel] [Extend 45 Trials] │
└─────────────────────────────────────────────────────────────────┘
Preview Changes (Dry-Run)
┌─────────────────────────────────────────────────────────────────┐
│ Preview: Extend Trial for 45 Users │
│ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
│ │
│ ℹ️ This is a preview. No changes will be made until you │
│ click "Execute Extension". │
│ │
│ Changes Summary │
│ • 45 users will have trials extended by 30 days │
│ • 90 application access grants will be updated │
│ • 45 notification emails will be sent │
│ │
│ User Changes [Export List] │
│ ┌────────────────────────────────────────────────────────────┐│
│ │ User Current Expiry New Expiry Change ││
│ │───────────────────────────────────────────────────────────│││
│ │ john@ex.com Feb 5, 2026 Mar 7, 2026 +30 days │││
│ │ jane@co.com Feb 6, 2026 Mar 8, 2026 +30 days │││
│ │ bob@ent.org Feb 7, 2026 Mar 9, 2026 +30 days │││
│ │ ... ││
│ └────────────────────────────────────────────────────────────┘│
│ │
│ Estimated Execution Time: 15 seconds │
│ │
│ [Cancel] [Execute Extension] │
└─────────────────────────────────────────────────────────────────┘
API Endpoints
Create Bulk Import Job
Endpoint: POST /api/v1/bulk-operations/import-users
Authentication: Bearer Token (Admin with BulkUserOperations permission)
Request: Multipart form data
Content-Type: multipart/form-data
file: <CSV file>
defaultTrialDuration: 30
defaultApplicationIds: ["app-1", "app-2"]
sendWelcomeEmails: true
validationMode: "Strict"
Success Response: 202 Accepted
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "Queued",
"totalRecords": 200,
"estimatedCompletionTime": "2026-01-30T15:50:00Z",
"trackingUrl": "/api/v1/bulk-operations/jobs/550e8400-e29b-41d4-a716-446655440000",
"message": "Import job queued successfully. 200 users will be processed."
}
Error Response: 400 Bad Request - Validation errors
{
"error": "ValidationError",
"message": "CSV validation failed",
"validationResults": {
"totalRows": 200,
"validRows": 198,
"invalidRows": 2,
"errors": [
{
"rowNumber": 5,
"field": "email",
"value": "john.doeexample.com",
"error": "Invalid email format"
},
{
"rowNumber": 42,
"field": "email",
"value": "existing@company.com",
"error": "Email already exists in database"
}
]
},
"canProceedWithWarnings": true,
"proceedUrl": "/api/v1/bulk-operations/import-users?force=true"
}
Create Bulk Trial Extension Job
Endpoint: POST /api/v1/bulk-operations/extend-trial
Authentication: Bearer Token (Admin)
Request Body:
{
"userIds": [
"user-id-1",
"user-id-2"
],
"extensionDays": 30,
"sendNotificationEmails": true,
"reason": "Product feedback program participation",
"dryRun": false
}
Success Response: 202 Accepted
{
"jobId": "650e8400-e29b-41d4-a716-446655440001",
"status": "Queued",
"totalRecords": 45,
"estimatedCompletionTime": "2026-01-30T15:35:00Z",
"trackingUrl": "/api/v1/bulk-operations/jobs/650e8400-e29b-41d4-a716-446655440001"
}
Dry-Run Response: 200 OK
{
"dryRun": true,
"affectedUsers": 45,
"changes": [
{
"userId": "user-id-1",
"currentExpiration": "2026-02-05T10:00:00Z",
"newExpiration": "2026-03-07T10:00:00Z",
"extensionDays": 30
}
],
"estimatedExecutionTime": "15 seconds",
"warnings": []
}
Get Job Status
Endpoint: GET /api/v1/bulk-operations/jobs/{jobId}
Authentication: Bearer Token (Admin)
Success Response: 200 OK
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"jobType": "CsvImport",
"status": "Processing",
"createdAt": "2026-01-30T15:43:00Z",
"startedAt": "2026-01-30T15:43:05Z",
"totalRecords": 200,
"processedRecords": 150,
"successCount": 150,
"failureCount": 0,
"skippedCount": 2,
"progressPercentage": 75.0,
"estimatedCompletionTime": "2026-01-30T15:45:00Z",
"canCancel": true,
"resultsSummary": null
}
Completed Job Response: 200 OK
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"jobType": "CsvImport",
"status": "Completed",
"createdAt": "2026-01-30T15:43:00Z",
"startedAt": "2026-01-30T15:43:05Z",
"completedAt": "2026-01-30T15:45:15Z",
"totalRecords": 200,
"processedRecords": 198,
"successCount": 198,
"failureCount": 0,
"skippedCount": 2,
"progressPercentage": 100.0,
"resultsSummary": {
"usersCreated": 198,
"emailsSent": 195,
"emailsFailed": 3
},
"resultsFileUrl": "/api/v1/bulk-operations/jobs/550e8400-e29b-41d4-a716-446655440000/results",
"canRollback": false,
"rolledBack": false
}
Download Job Results
Endpoint: GET /api/v1/bulk-operations/jobs/{jobId}/results
Authentication: Bearer Token (Admin)
Success Response: 200 OK
Content-Type: text/csv
Content-Disposition: attachment; filename="bulk-import-results-JOB-12345.csv"
RowNumber,Email,FullName,Status,UserId,ErrorMessage
1,john.doe@example.com,John Doe,Success,user-1234,
2,jane.smith@company.com,Jane Smith,Success,user-1235,
3,bob.jones@enterprise.org,Bob Jones,Success,user-1236,
...
5,john.doeexample.com,Invalid User,Failed,,Invalid email format
...
42,existing@company.com,Duplicate User,Skipped,,Email already exists
...
Cancel Job
Endpoint: POST /api/v1/bulk-operations/jobs/{jobId}/cancel
Authentication: Bearer Token (Admin)
Success Response: 200 OK
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "Cancelled",
"message": "Job cancelled successfully. 75 of 200 records were processed before cancellation."
}
Bulk Deactivate Users
Endpoint: POST /api/v1/bulk-operations/deactivate-users
Authentication: Bearer Token (Admin)
Request Body:
{
"userIds": ["user-1", "user-2"],
"reason": "Expired trials - no upgrade",
"revokeSessions": true,
"sendNotification": false
}
Success Response: 202 Accepted
{
"jobId": "750e8400-e29b-41d4-a716-446655440002",
"status": "Queued",
"totalRecords": 78
}
Bulk Send Email
Endpoint: POST /api/v1/bulk-operations/send-email
Authentication: Bearer Token (Admin)
Request Body:
{
"recipientFilter": {
"isActive": true,
"expiresInDays": 7
},
"emailTemplateId": "trial-expiration-reminder",
"subject": "Your trial is expiring soon",
"customMessage": "We hope you're enjoying Riptide. Your trial expires in {DaysRemaining} days.",
"personalizationTokens": ["FullName", "ExpirationDate", "DaysRemaining"]
}
Success Response: 202 Accepted
{
"jobId": "850e8400-e29b-41d4-a716-446655440003",
"status": "Queued",
"totalRecords": 324,
"estimatedCompletionTime": "2026-01-30T16:15:00Z"
}
Export User List
Endpoint: POST /api/v1/bulk-operations/export-users
Authentication: Bearer Token (Admin)
Request Body:
{
"filter": {
"isActive": true,
"expiresAfter": "2026-02-01",
"expiresBefore": "2026-03-01",
"companyName": "Acme Corp",
"hasApplicationAccess": ["app-1"]
},
"format": "CSV",
"columns": [
"Email",
"FullName",
"CompanyName",
"TrialExpirationDate",
"IsActive",
"LastLoginAt",
"LoginCount"
]
}
Success Response: 200 OK (for small exports) or 202 Accepted (for large exports)
Small export (< 1,000 users):
Content-Type: text/csv
Content-Disposition: attachment; filename="users-export-2026-01-30.csv"
Email,FullName,CompanyName,TrialExpirationDate,IsActive,LastLoginAt,LoginCount
john.doe@example.com,John Doe,Acme Corp,2026-03-01T10:00:00Z,true,2026-01-29T14:30:00Z,15
...
Large export (>= 1,000 users):
{
"jobId": "950e8400-e29b-41d4-a716-446655440004",
"status": "Processing",
"message": "Export is being generated. You'll receive an email when it's ready.",
"downloadUrl": "/api/v1/bulk-operations/jobs/950e8400-e29b-41d4-a716-446655440004/download"
}
Performance Requirements
| Metric | Target | Critical Threshold |
|---|---|---|
| CSV import processing rate | > 50 users/second | > 20 users/second |
| Job queue response time | < 500ms | < 2 seconds |
| WebSocket progress updates | Every 2 seconds | Every 5 seconds |
| Bulk operation batch size | 50-100 records | 25 records (minimum) |
| Email sending rate | 10 emails/second | 5 emails/second |
| Export generation time (1,000 users) | < 5 seconds | < 15 seconds |
| Concurrent bulk operations supported | 10 jobs | 5 jobs |
| Job history retention | 90 days | 30 days (minimum) |
| Database batch insert time (100 records) | < 1 second | < 3 seconds |
Security Considerations
Authorization
- Bulk operations require
BulkUserOperationspermission - Only admins who created job can view results (unless SuperAdmin)
- Job results expire after 90 days for data protection
- Sensitive data in results files encrypted at rest
Data Protection
- CSV files sanitized (remove scripts, XSS attempts)
- File size limits enforced (10MB max)
- Row count limits enforced (10,000 max)
- Rate limiting on API endpoints (10 requests/minute)
- Job results only accessible to authorized users
Audit Trail
- Every bulk operation logged with:
- Admin user ID and name
- Operation type and parameters
- Timestamp and duration
- Success/failure counts
- Affected user IDs
- Individual user modifications logged separately
- Audit logs retained for compliance (7 years)
Rollback Safety
- Transactional operations support rollback
- Rollback window: 24 hours
- Rollback requires justification (logged)
- Critical operations (deactivation) have confirmation step
Email Security
- Rate limiting to prevent abuse (10/second)
- Unsubscribe links in all bulk emails
- Bounce handling to detect invalid addresses
- Spam complaint monitoring
- Domain reputation protection
Testing Scenarios
Test Case 1: Successful CSV Import (198/200 Users)
Given: CSV with 200 users, 2 have validation errors
When: Admin uploads CSV and confirms import
Then: Job created, 198 users created successfully, 2 skipped
Verify: Database has 198 new users, results CSV shows 2 errors, welcome emails sent
Test Case 2: Bulk Trial Extension (45 Users)
Given: 45 users selected, extend by 30 days
When: Admin confirms extension
Then: All 45 users have TrialExpirationDate updated (+30 days)
Verify: Application access grants also extended, notification emails sent, audit log updated
Test Case 3: Dry-Run Preview (No Changes)
Given: 100 users selected for deactivation
When: Admin clicks "Preview Changes" (dry-run)
Then: System shows what would change, no database modifications
Verify: Database unchanged, preview accurate, admin can approve or cancel
Test Case 4: Concurrent Bulk Operations Conflict
Given: Admin 1 extends trials for users 1-100
When: Admin 2 tries to deactivate users 50-150
Then: Second operation blocked for overlapping users (50-100)
Verify: 409 Conflict returned, clear error message, suggestion to wait or adjust selection
Test Case 5: Bulk Email with Rate Limiting
Given: 5,000 users selected for bulk email
When: Job starts sending emails at 10/second
Then: Email service rate limits after 500 emails
Verify: Worker applies exponential backoff, retries, completes job (slower), no emails lost
Test Case 6: Job Cancellation Mid-Processing
Given: CSV import job processing 200 users (currently at 50%)
When: Admin cancels job
Then: Job stops gracefully, 100 users already created remain
Verify: Job status: Cancelled, partial results saved, no data corruption
Test Case 7: Failed Batch with Rollback
Given: Bulk password reset for 500 users, database fails at batch 3
When: Worker detects failure
Then: Batch 3 rolled back, batches 1-2 preserved
Verify: 100 users have new tokens, 400 unchanged, admin notified, retry option available
Test Case 8: Large Export (10,000 Users)
Given: Filter matches 10,000 users
When: Admin requests CSV export
Then: Async job created, file generated, download link provided
Verify: Export file accurate, no memory overflow, compressed if large
Test Case 9: CSV with Duplicate Emails
Given: CSV contains duplicate email addresses (rows 5 and 42)
When: Admin uploads CSV
Then: Validation detects duplicate, shows warning
Verify: Only first occurrence processed, second skipped, clear error message
Test Case 10: Bulk Operation Audit Trail
Given: Admin performs bulk deactivation of 78 users
When: Operation completes
Then: Audit log contains 1 bulk operation entry + 78 individual user modification entries
Verify: All audit entries have correct timestamps, admin ID, before/after values
Monitoring and Analytics
Key Metrics to Track
- Bulk Operations Per Day: Count by operation type
- Job Success Rate: Completed successfully / Total jobs
- Average Processing Time: By operation type and record count
- CSV Import Success Rate: Users created / Total rows
- Email Delivery Rate: Emails delivered / Emails sent (bulk emails)
- Job Cancellation Rate: Cancelled jobs / Total jobs
- Rollback Frequency: Rollback operations / Total operations
- Concurrent Jobs: Active jobs at peak times
- Queue Depth: Jobs waiting in queue
- Worker Utilization: % of time workers are busy
Alerts
- Job processing time > 10 minutes (investigate performance)
- Job failure rate > 10% in 1 hour (system issue)
- Queue depth > 20 jobs (worker capacity issue)
- CSV validation failure rate > 50% (data quality issue)
- Email bounce rate > 5% (deliverability issue)
- Database connection errors during bulk ops (critical)
- Concurrent job conflicts > 5/hour (workflow coordination issue)
Dashboards
- Bulk Operations Overview: Jobs by type, status, time period
- Performance Metrics: Processing rates, queue times, completion times
- Error Analysis: Common errors, affected users, resolution status
- Email Deliverability: Send rates, bounce rates, spam complaints
- User Impact: Users affected by bulk operations, trial extensions, deactivations
Related Use Cases
- UC-001: Trial User Self-Registration and Access (individual user creation)
- UC-005: Administrator Trial User Management (single user operations)
- UC-007: Trial User Metrics and Reporting (analytics and insights)
- UC-009: Email Notification Management (email templates and delivery)
- UC-011: Audit Trail and Compliance Reporting (detailed logging)
- UC-013: Background Job Processing (job queue infrastructure)
- UC-015: Data Import/Export Utilities (file handling and formats)
Notes and Assumptions
- Async by Default: Operations affecting > 100 users always processed asynchronously
- Fail-Open Strategy: CSV imports continue processing even if some rows fail (maximize success)
- Batch Processing: All bulk operations use batching (50-100 records) for transaction safety
- Email Rate Limiting: Respect email service limits (10/second default, configurable)
- Job Retention: Job history and results retained for 90 days, then archived
- WebSocket Support: Real-time progress updates require WebSocket connection (fallback: polling)
- Rollback Limitations: Only transactional operations support rollback; emails cannot be unsent
- CSV Format: UTF-8 encoding required, comma-delimited, optional BOM
- Large Files: Files > 10MB or > 10,000 rows rejected (contact support for special handling)
- Permissions: Separate permissions for different bulk operation types (future enhancement)
System Architecture
Async Processing Flow
Job Queue Architecture
Revision History
| Version | Date | Author | Changes |
|---|---|---|---|
| 1.0 | 2026-01-30 | System Analyst | Initial use case documentation for bulk operations |
Document Owner: Platform Architecture Team
Stakeholders: Product Management, Engineering, Customer Success, Operations
Review Cycle: Quarterly or as needed for major changes