diff --git a/cmd/server/assets/realmadmin/_form_codes.html b/cmd/server/assets/realmadmin/_form_codes.html index 4536e3313..a05bc3aba 100644 --- a/cmd/server/assets/realmadmin/_form_codes.html +++ b/cmd/server/assets/realmadmin/_form_codes.html @@ -12,6 +12,31 @@ {{ .csrfField }} +
+ +
+
+ + +
+ +
+ + +
+
+
+
{{if not $realm.EnableENExpress}} @@ -76,7 +101,7 @@ Recommended: Require a symptom date or test date when generating a verification code. Attempting to generate a verification - code without a date will return an error. Exposure notifications are + code without a date will return an error. Exposure notifications are more accurate when a date is provided. diff --git a/pkg/controller/realmadmin/settings.go b/pkg/controller/realmadmin/settings.go index b06784ab3..25fcf85f0 100644 --- a/pkg/controller/realmadmin/settings.go +++ b/pkg/controller/realmadmin/settings.go @@ -53,6 +53,7 @@ func (c *Controller) HandleSettings() http.Handler { Codes bool `form:"codes"` AllowedTestTypes database.TestType `form:"allowed_test_types"` + AllowBulkUpload bool `form:"allow_bulk"` RequireDate bool `form:"require_date"` CodeLength uint `form:"code_length"` CodeDurationMinutes int64 `form:"code_duration"` @@ -151,6 +152,7 @@ func (c *Controller) HandleSettings() http.Handler { if form.Codes { realm.AllowedTestTypes = form.AllowedTestTypes realm.RequireDate = form.RequireDate + realm.AllowBulkUpload = form.AllowBulkUpload realm.SMSTextTemplate = form.SMSTextTemplate // These fields can only be set if ENX is disabled diff --git a/pkg/database/migrations.go b/pkg/database/migrations.go index 0a54608e7..538c13b30 100644 --- a/pkg/database/migrations.go +++ b/pkg/database/migrations.go @@ -1668,6 +1668,16 @@ func (db *Database) getMigrations(ctx context.Context) *gormigrate.Gormigrate { return nil }, }, + { + ID: "00067-AddRealmAllowBulkUpload", + Migrate: func(tx *gorm.DB) error { + logger.Debugw("db migrations: adding allow_bulk_upload to realms") + return tx.Exec("ALTER TABLE realms ADD COLUMN IF NOT EXISTS allow_bulk_upload bool DEFAULT false").Error + }, + Rollback: func(tx *gorm.DB) error { + return tx.Exec("ALTER TABLE realms DROP COLUMN IF EXISTS allow_bulk_upload").Error + }, + }, }) } diff --git a/pkg/database/realm.go b/pkg/database/realm.go index 9849395bb..fc582042b 100644 --- a/pkg/database/realm.go +++ b/pkg/database/realm.go @@ -126,6 +126,9 @@ type Realm struct { WelcomeMessage string `gorm:"-"` WelcomeMessagePtr *string `gorm:"column:welcome_message; type:text;"` + // AllowBulkUpload allows users to issue codes from a batch file of test results. + AllowBulkUpload bool `gorm:"type:boolean; not null; default:false"` + // Code configuration CodeLength uint `gorm:"type:smallint; not null; default: 8"` CodeDuration DurationSeconds `gorm:"type:bigint; not null; default: 900"` // default 15m (in seconds)