feat(policy): support unlimited values in user policies and box expiry

- Update user policy and user update handlers to accept -1 as an unlimited value for MaxDays, DailyBoxes, ActiveBoxes, and ShortWindowRequests.
- Introduce `optionalIntAllowUnlimited` helper and update `optionalMBAllowZero` to support -1.
- Use `boxExpiryLabel` helper across admin, dashboard, and download handlers to properly format expiration dates, supporting boxes that never expire.
This commit is contained in:
2026-05-31 22:40:48 +03:00
parent adb1a12dfd
commit 01996c0445
10 changed files with 106 additions and 43 deletions

View File

@@ -82,7 +82,7 @@ func (a *App) managePageData(box services.Box, token string) managePageData {
Token: token,
FileCount: len(box.Files),
TotalSize: helpers.FormatBytes(totalSize),
ExpiresLabel: box.ExpiresAt.Format("Jan 2, 2006 15:04 MST"),
ExpiresLabel: boxExpiryLabel(box.ExpiresAt, "Jan 2, 2006 15:04 MST"),
DownloadCount: box.DownloadCount,
MaxDownloads: box.MaxDownloads,
Protected: a.uploadService.IsProtected(box),