Problem
Currently, when creating a campaign, users can enter any string for the allocation field and the campaign creation will succeed. However, if the allocation is not valid in the TACC Authentication Service (TAS), the campaign becomes invisible or inaccessible, creating a poor user experience.
Expected Behavior
The system should validate that the provided allocation exists and is accessible to the user before allowing campaign creation to succeed.
Current Implementation
- Campaign creation accepts any string for
allocation field (see app/api/v1/schemas/campaign.py:16)
- No validation occurs in
CampaignService.create_campaign() (app/services/campaign_service.py:12-16)
- Invalid allocations cause campaigns to be created but not visible to users
Proposed Solution
- Add allocation validation to the campaign creation process
- Validate against TAS that the allocation exists and user has access
- Return appropriate error messages for invalid allocations
- Consider adding similar validation for campaign updates
Implementation Notes
- The PyTAS integration exists in
app/pytas/ with Project and Allocation models
- Validation should occur in the service layer before database persistence
- Consider caching valid allocations to reduce API calls to TAS
Acceptance Criteria
Problem
Currently, when creating a campaign, users can enter any string for the
allocationfield and the campaign creation will succeed. However, if the allocation is not valid in the TACC Authentication Service (TAS), the campaign becomes invisible or inaccessible, creating a poor user experience.Expected Behavior
The system should validate that the provided allocation exists and is accessible to the user before allowing campaign creation to succeed.
Current Implementation
allocationfield (seeapp/api/v1/schemas/campaign.py:16)CampaignService.create_campaign()(app/services/campaign_service.py:12-16)Proposed Solution
Implementation Notes
app/pytas/withProjectandAllocationmodelsAcceptance Criteria