diff --git a/modules/api/src/main/scala/vinyldns/api/domain/DomainValidations.scala b/modules/api/src/main/scala/vinyldns/api/domain/DomainValidations.scala
index 0170d13f6..e78637e0f 100644
--- a/modules/api/src/main/scala/vinyldns/api/domain/DomainValidations.scala
+++ b/modules/api/src/main/scala/vinyldns/api/domain/DomainValidations.scala
@@ -163,4 +163,8 @@ object DomainValidations {
def validateMX_NAPTR_SRVData(number: Int, recordDataType: String, recordType: String): ValidatedNel[DomainValidationError, Int] =
if (number >= INTEGER_MIN_VALUE && number <= INTEGER_MAX_VALUE) number.validNel
else InvalidMX_NAPTR_SRVData(number, INTEGER_MIN_VALUE, INTEGER_MAX_VALUE, recordDataType, recordType).invalidNel[Int]
+
+ def validateNaptrFlag(value: String): ValidatedNel[DomainValidationError, String] =
+ if (value == "U" || value == "S" || value == "A" || value == "P") value.validNel
+ else InvalidNaptrFlag(value).invalidNel[String]
}
diff --git a/modules/api/src/main/scala/vinyldns/api/domain/batch/BatchChangeValidations.scala b/modules/api/src/main/scala/vinyldns/api/domain/batch/BatchChangeValidations.scala
index fa2e57226..353e59b34 100644
--- a/modules/api/src/main/scala/vinyldns/api/domain/batch/BatchChangeValidations.scala
+++ b/modules/api/src/main/scala/vinyldns/api/domain/batch/BatchChangeValidations.scala
@@ -248,7 +248,7 @@ class BatchChangeValidations(
case mx: MXData =>
validateMX_NAPTR_SRVData(mx.preference, "preference", "MX").asUnit |+| validateHostName(mx.exchange).asUnit
case ns: NSData => validateHostName(ns.nsdname).asUnit
- case naptr: NAPTRData => validateMX_NAPTR_SRVData(naptr.preference, "preference", "NAPTR").asUnit |+| validateMX_NAPTR_SRVData(naptr.order, "order", "NAPTR").asUnit |+| validateHostName(naptr.replacement).asUnit
+ case naptr: NAPTRData => validateMX_NAPTR_SRVData(naptr.preference, "preference", "NAPTR").asUnit |+| validateMX_NAPTR_SRVData(naptr.order, "order", "NAPTR").asUnit |+| validateHostName(naptr.replacement).asUnit |+| validateNaptrFlag(naptr.flags).asUnit
case srv: SRVData => validateMX_NAPTR_SRVData(srv.priority, "priority", "SRV").asUnit |+| validateMX_NAPTR_SRVData(srv.port, "port", "SRV").asUnit |+| validateMX_NAPTR_SRVData(srv.weight, "weight", "SRV").asUnit |+| validateHostName(srv.target).asUnit
case other =>
InvalidBatchRecordType(other.toString, SupportedBatchChangeRecordTypes.get).invalidNel[Unit]
diff --git a/modules/core/src/main/scala/vinyldns/core/domain/DomainValidationErrors.scala b/modules/core/src/main/scala/vinyldns/core/domain/DomainValidationErrors.scala
index 7eebf540e..b5973c78f 100644
--- a/modules/core/src/main/scala/vinyldns/core/domain/DomainValidationErrors.scala
+++ b/modules/core/src/main/scala/vinyldns/core/domain/DomainValidationErrors.scala
@@ -113,6 +113,12 @@ final case class InvalidMX_NAPTR_SRVData(param: Long, min: Long, max: Long, reco
s"""Invalid $recordType $recordDataType: "${param.toString}", must be a number between $min and $max."""
}
+final case class InvalidNaptrFlag(value: String)
+ extends DomainValidationError {
+ def message: String =
+ s"""Invalid NAPTR flag value: '$value'. Valid NAPTR flag value must be U, S, A or P."""
+}
+
final case class InvalidBatchRecordType(param: String, supported: Set[RecordType])
extends DomainValidationError {
def message: String =
diff --git a/modules/core/src/main/scala/vinyldns/core/domain/SingleChangeError.scala b/modules/core/src/main/scala/vinyldns/core/domain/SingleChangeError.scala
index 8324978a0..23d8a2f46 100644
--- a/modules/core/src/main/scala/vinyldns/core/domain/SingleChangeError.scala
+++ b/modules/core/src/main/scala/vinyldns/core/domain/SingleChangeError.scala
@@ -31,7 +31,7 @@ object DomainValidationErrorType extends Enumeration {
// NOTE: once defined, an error code type cannot be changed!
val ChangeLimitExceeded, BatchChangeIsEmpty, GroupDoesNotExist, NotAMemberOfOwnerGroup,
InvalidDomainName, InvalidCname, InvalidLength, InvalidEmail, InvalidRecordType, InvalidPortNumber,
- InvalidIpv4Address, InvalidIpv6Address, InvalidIPAddress, InvalidTTL, InvalidMX_NAPTR_SRVData,
+ InvalidIpv4Address, InvalidIpv6Address, InvalidIPAddress, InvalidTTL, InvalidMX_NAPTR_SRVData, InvalidNaptrFlag,
InvalidBatchRecordType, ZoneDiscoveryError, RecordAlreadyExists, RecordDoesNotExist, InvalidUpdateRequest,
CnameIsNotUniqueError, UserIsNotAuthorized, UserIsNotAuthorizedError, RecordNameNotUniqueInBatch,
RecordInReverseZoneError, HighValueDomainError, MissingOwnerGroupId, ExistingMultiRecordError,
@@ -56,6 +56,7 @@ object DomainValidationErrorType extends Enumeration {
case _: InvalidIPAddress => InvalidIPAddress
case _: InvalidTTL => InvalidTTL
case _: InvalidMX_NAPTR_SRVData => InvalidMX_NAPTR_SRVData
+ case _: InvalidNaptrFlag => InvalidNaptrFlag
case _: InvalidBatchRecordType => InvalidBatchRecordType
case _: ZoneDiscoveryError => ZoneDiscoveryError
case _: RecordAlreadyExists => RecordAlreadyExists
diff --git a/modules/portal/app/views/dnsChanges/dnsChangeNew.scala.html b/modules/portal/app/views/dnsChanges/dnsChangeNew.scala.html
index ed27608fe..14689e3e3 100644
--- a/modules/portal/app/views/dnsChanges/dnsChangeNew.scala.html
+++ b/modules/portal/app/views/dnsChanges/dnsChangeNew.scala.html
@@ -281,7 +281,7 @@
-
+
Flags is required!
diff --git a/modules/portal/public/lib/dns-change/dns-change-new.controller.js b/modules/portal/public/lib/dns-change/dns-change-new.controller.js index 10cc525e0..9969423be 100644 --- a/modules/portal/public/lib/dns-change/dns-change-new.controller.js +++ b/modules/portal/public/lib/dns-change/dns-change-new.controller.js @@ -42,6 +42,7 @@ $scope.allowManualReview = false; $scope.confirmationPrompt = "Are you sure you want to submit this batch change request?"; $scope.manualReviewEnabled; + $scope.naptrFlags = ["U", "S", "A", "P"]; $scope.addSingleChange = function() { $scope.newBatch.changes.push({changeType: "Add", type: "A+PTR"});