class CatalogZoneService (View source)

Catalog zone membership.

PowerDNS stores membership as a catalog field on the member zone naming its producer. There is no separate endpoint, so every operation here is a read or a write of that one field.

Constants

PUBLISHABLE_KINDS

Kinds PowerDNS will actually publish from a catalog. Its member query is "type in ('MASTER','PRODUCER') and catalog = ?" with an enabled apex SOA, so any other kind accepts a catalog value and is then silently never served.

Methods

__construct(DnsBackendProvider $backendProvider, PermissionService $permissionService, AuditService|null $auditService = null, ZoneRepositoryInterface|null $zoneRepository = null)

No description

string
normalizeName(string $name)

The form PowerDNS stores in domains.catalog and matches members against.

bool
canManageZone(int $userId, int $zoneId)

Whether the user may change zone configuration on this zone.

array
getProducers()

Every producer zone. Used to resolve a catalog to its producer, so it must stay unfiltered even when the caller may not manage all of them.

array
getManageableProducers(int $userId)

Producers the user may actually publish through.

array|null
getCatalogProducer(int $zoneId)

The producer whose catalog this zone is in, or null when it is not a member.

array
getEligibleMembers(int $userId)

Zones the user may add to a catalog: publishable, not already a member, and theirs to change.

array
getMembers(string $producerName)

Members of a producer, each flagged with whether PowerDNS will publish it.

string
getCatalog(int $zoneId)

No description

bool
assign(int $userId, int $memberZoneId, int $producerZoneId)

Put $memberZoneId into the catalog published by $producerZoneId.

bool
clear(int $userId, int $memberZoneId)

Remove $memberZoneId from whichever catalog it is currently in.

Details

__construct(DnsBackendProvider $backendProvider, PermissionService $permissionService, AuditService|null $auditService = null, ZoneRepositoryInterface|null $zoneRepository = null)

No description

Parameters

DnsBackendProvider $backendProvider
PermissionService $permissionService
AuditService|null $auditService
ZoneRepositoryInterface|null $zoneRepository

string normalizeName(string $name)

The form PowerDNS stores in domains.catalog and matches members against.

Parameters

string $name

Return Value

string

bool canManageZone(int $userId, int $zoneId)

Whether the user may change zone configuration on this zone.

Membership is governed by zone_metaedit*, the same permission that already covers zone type, primary IP and template.

Parameters

int $userId
int $zoneId

Return Value

bool

array getProducers()

Every producer zone. Used to resolve a catalog to its producer, so it must stay unfiltered even when the caller may not manage all of them.

Return Value

array

array getManageableProducers(int $userId)

Producers the user may actually publish through.

Offering more than this would both leak zone names the user cannot otherwise see and present choices that fail on submit.

Parameters

int $userId

Return Value

array

array|null getCatalogProducer(int $zoneId)

The producer whose catalog this zone is in, or null when it is not a member.

Resolving to the producer's id here keeps name normalisation out of the templates, which cannot compare a stored catalog to a zone name safely.

Parameters

int $zoneId

Return Value

array|null

array getEligibleMembers(int $userId)

Zones the user may add to a catalog: publishable, not already a member, and theirs to change.

Parameters

int $userId

Return Value

array

array getMembers(string $producerName)

Members of a producer, each flagged with whether PowerDNS will publish it.

Parameters

string $producerName

Return Value

array

string getCatalog(int $zoneId)

No description

Parameters

int $zoneId

Return Value

string

bool assign(int $userId, int $memberZoneId, int $producerZoneId)

Put $memberZoneId into the catalog published by $producerZoneId.

Both zones are checked: the member's own row changes, and publishing through the producer changes what that zone serves.

Parameters

int $userId
int $memberZoneId
int $producerZoneId

Return Value

bool

bool clear(int $userId, int $memberZoneId)

Remove $memberZoneId from whichever catalog it is currently in.

The producer is resolved from the member's stored value rather than from the caller, so a request cannot name a catalog the caller happens to have rights on.

Parameters

int $userId
int $memberZoneId

Return Value

bool