class ZoneManagementService (View source)

Service for managing DNS zones. Failures come back as

message is the API wording, the code lets the web forms word it themselves.

Constants

ERR_NO_OWNER

ERR_INVALID_NAME

ERR_EXISTS

ERR_OVERLAP

ERR_INVALID_TYPE

ERR_MASTER_REQUIRED

ERR_INVALID_MASTER

ERR_INVALID_SOA_EDIT_API

ERR_TEMPLATE_NOT_FOUND

ERR_TEMPLATE_AMBIGUOUS

ERR_TEMPLATE_FORBIDDEN

ERR_ZONE_WRITE

ERR_NOT_FOUND

ERR_READ_ONLY

Methods

__construct(ZoneRepositoryInterface $zoneRepository, ConfigurationManager $config, object $db, LoggerInterface|null $logger = null, RecordChangeLogger|null $changeLogger = null, PdnsCapabilities|null $capabilities = null, ZoneSigningService|null $signing = null)

No description

array
resolveZoneTemplate(string $zoneTemplate, int|null $actingUserId)

Resolves a template given by name or numeric id and checks the acting user may apply it (own, global, or ueberuser - the same rule the web UI enforces).

array
createZone(string $domain, string $type, int|null $owner, string $slaveMaster = '', string $zoneTemplate = 'none', bool $enableDnssec = false, array $groupIds = [], int|null $actingUserId = null, string|null $soaEditApi = null)

Create a new DNS zone

array
updateZone(int $zoneId, array $updates)

Update a zone

array
deleteZone(int $zoneId)

Delete a zone

array
setDomainPermissions(int $domainId, int $userId)

Set domain permissions

array
applyTemplate(int $zoneId, string $template, int $actingUserId)

Applies a zone template (or "none" to unlink) to an existing zone, replacing the template-managed records. The caller must be allowed to use the template.

Details

__construct(ZoneRepositoryInterface $zoneRepository, ConfigurationManager $config, object $db, LoggerInterface|null $logger = null, RecordChangeLogger|null $changeLogger = null, PdnsCapabilities|null $capabilities = null, ZoneSigningService|null $signing = null)

No description

Parameters

ZoneRepositoryInterface $zoneRepository
ConfigurationManager $config
object $db
LoggerInterface|null $logger
RecordChangeLogger|null $changeLogger
PdnsCapabilities|null $capabilities

What the connected server supports; null admits only the basic kinds

ZoneSigningService|null $signing

Needed for enable_dnssec; without it a create is never signed

array resolveZoneTemplate(string $zoneTemplate, int|null $actingUserId)

Resolves a template given by name or numeric id and checks the acting user may apply it (own, global, or ueberuser - the same rule the web UI enforces).

Parameters

string $zoneTemplate
int|null $actingUserId

Return Value

array

array createZone(string $domain, string $type, int|null $owner, string $slaveMaster = '', string $zoneTemplate = 'none', bool $enableDnssec = false, array $groupIds = [], int|null $actingUserId = null, string|null $soaEditApi = null)

Create a new DNS zone

Parameters

string $domain

Domain name

string $type

Zone type (MASTER, SLAVE, NATIVE)

int|null $owner

Owner user ID, or null when only group ownership is set

string $slaveMaster

Master IP for slave zones

string $zoneTemplate

Zone template to use

bool $enableDnssec

Whether to enable DNSSEC

array $groupIds

Optional list of group IDs to assign as owners

int|null $actingUserId

User performing the creation, used for the overlap check

string|null $soaEditApi

Per-zone SOA-EDIT-API choice; null applies the dns.soa_edit_api default

Return Value

array

array updateZone(int $zoneId, array $updates)

Update a zone

Parameters

int $zoneId

Zone ID

array $updates

Array of field => value pairs to update

Return Value

array

Result array with success status and message

array deleteZone(int $zoneId)

Delete a zone

Parameters

int $zoneId

Zone ID

Return Value

array

Result array with success status and message

array setDomainPermissions(int $domainId, int $userId)

Set domain permissions

Parameters

int $domainId

Domain ID

int $userId

User ID

Return Value

array

Result array with success status and message

array applyTemplate(int $zoneId, string $template, int $actingUserId)

Applies a zone template (or "none" to unlink) to an existing zone, replacing the template-managed records. The caller must be allowed to use the template.

Parameters

int $zoneId
string $template
int $actingUserId

Return Value

array