mirror of
https://github.com/azaion/admin.git
synced 2026-06-21 14:41:08 +00:00
3a925b9b0f
- Deleted the `POST /resources/get/{dataFolder?}` and `GET /resources/get-installer` endpoints as part of the architectural shift towards simplified resource management.
- Removed associated methods and configurations, including `ResourcesService.GetEncryptedResource`, `ResourcesService.GetInstaller`, and related properties in `ResourcesConfig`.
- Cleaned up environment variables and configuration files to reflect the removal of installer-related settings.
- Eliminated the `GetResourceRequest` DTO and its validator, along with the `WrongResourceName` error code.
- Updated documentation to clarify the changes in resource handling and the retirement of per-user file encryption.
Co-authored-by: Cursor <cursoragent@cursor.com>
2.4 KiB
2.4 KiB
Module: Azaion.Services.ResourcesService
Purpose
File-based resource management: upload, list, and clear files in the server's filesystem.
Cycle 2 (2026-05-14) note —
GetInstallerandGetEncryptedResourcewere removed along with thePOST /resources/get/{dataFolder?}andGET /resources/get-installer[/stage]endpoints; the corresponding interface methods, theSecurity.EncryptTodependency, and theResourcesConfig.SuiteInstallerFolder/SuiteStageInstallerFolderproperties went with them. The service is now upload + list + clear only.
Public Interface
IResourcesService
| Method | Signature | Description |
|---|---|---|
SaveResource |
Task SaveResource(string? dataFolder, IFormFile data, CancellationToken ct) |
Saves an uploaded file to the resource folder |
ListResources |
Task<IEnumerable<string>> ListResources(string? dataFolder, string? search, CancellationToken ct) |
Lists file names in a resource folder, optionally filtered |
ClearFolder |
void ClearFolder(string? dataFolder) |
Deletes all files and subdirectories in the specified folder |
Internal Logic
- GetResourceFolder: resolves the target directory. If
dataFolderis null/empty, usesResourcesConfig.ResourcesFolderdirectly; otherwise, appends it as a subdirectory. - SaveResource: creates the folder if needed, deletes any existing file with the same name, then copies the uploaded file.
- ListResources: uses
DirectoryInfo.GetFileswith optional search pattern. - ClearFolder: iterates and deletes all files and subdirectories.
Dependencies
IOptions<ResourcesConfig>— folder pathsILogger<ResourcesService>— logs successful savesBusinessException— thrown for null file uploads
Consumers
Program.cs—POST /resources/{dataFolder?}(upload),GET /resources/list/{dataFolder?},POST /resources/clear/{dataFolder?}
Data Models
None.
Configuration
Uses ResourcesConfig.ResourcesFolder.
External Integrations
Local filesystem for resource storage.
Security
- File deletion overwrites existing files before writing new ones.
- No path traversal protection on
dataFolderparameter (security audit F-2 — open).
Tests
End-to-end coverage in e2e/Azaion.E2E/Tests/ResourceTests.cs — File_upload_succeeds and Upload_without_file_is_rejected_with_400_or_409_and_60_on_conflict.