Add a boolean for when a registrar has enabled registry lock (#228)

* Add a boolean for when a registrar has enabled registry lock

* enabled -> allowed

* get -> is
This commit is contained in:
gbrodman
2019-08-16 10:46:07 -04:00
committed by GitHub
parent 57975898d5
commit 92f2f3274e
5 changed files with 80 additions and 0 deletions
@@ -409,6 +409,9 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
*/
boolean contactsRequireSyncing = true;
/** Whether or not registry lock is allowed for this registrar. */
boolean registryLockAllowed = false;
@NonFinalForTesting
private static Supplier<byte[]> saltSupplier =
() -> {
@@ -545,6 +548,10 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return contactsRequireSyncing;
}
public boolean isRegistryLockAllowed() {
return registryLockAllowed;
}
public String getUrl() {
return url;
}
@@ -895,6 +902,11 @@ public class Registrar extends ImmutableObject implements Buildable, Jsonifiable
return this;
}
public Builder setRegistryLockAllowed(boolean registryLockAllowed) {
getInstance().registryLockAllowed = registryLockAllowed;
return this;
}
/** Build the registrar, nullifying empty fields. */
@Override
public Registrar build() {
@@ -234,6 +234,13 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
arity = 1)
private Boolean contactsRequireSyncing;
@Nullable
@Parameter(
names = "--registry_lock_allowed",
description = "Whether this registrar is allowed to use registry lock",
arity = 1)
private Boolean registryLockAllowed;
@Nullable
@Parameter(
names = "--drive_folder_id",
@@ -393,6 +400,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
}
Optional.ofNullable(blockPremiumNames).ifPresent(builder::setBlockPremiumNames);
Optional.ofNullable(contactsRequireSyncing).ifPresent(builder::setContactsRequireSyncing);
Optional.ofNullable(registryLockAllowed).ifPresent(builder::setRegistryLockAllowed);
Optional.ofNullable(phonePasscode).ifPresent(builder::setPhonePasscode);
Optional.ofNullable(icannReferralEmail).ifPresent(builder::setIcannReferralEmail);
Optional.ofNullable(whoisServer).ifPresent(builder::setWhoisServer);