class ZoneChangeRequestService (View source)

Files zone change requests and applies the reviewer's decision.

Filing validates the rows the way a direct save would and stores the diff without writing to the zone. Approval replays the stored actions through RecordManager as the reviewing user, so RecordManager's own permission checks still apply. Who may file or review is decided by the caller.

Constants

MAX_PAYLOAD_BYTES

Same ceiling as the change log's snapshot column

Methods

__construct(ZoneChangeRequestRepositoryInterface $requests, ZoneEditService $zoneEdit, DnsRecordValidationServiceInterface $validator, RecordLookupInterface $records, DomainRepositoryInterface $domains, ZoneRepositoryInterface $zones, RecordManagerInterface $recordManager, SOARecordManagerInterface $soaRecords, ZoneManagementService $zoneManagement, BackendCapabilitiesInterface $backend, TransactionInterface $transaction, ConfigurationInterface $config, bool $recordCommentsEnabled, bool $zoneCommentsEnabled, RecordCommentRepositoryInterface|null $recordComments = null, Closure|null $changeset = null, PermissionService|null $permissions = null, ChangeRequestNotifierInterface|null $notifier = null, Closure|null $zoneSnapshot = null, RecordLinkedCommentRepositoryInterface|null $linkedComments = null)

No description

fileRecordEdits(ZoneEditSubmission $submission, string|null $comment = null)

Files the rows of an editor submission that differ from the zone, plus the zone comment when it changed. Nothing is written to the zone.

fileRecordAdd(int $zoneId, string $zoneName, array $record, int $userId, string $username, string|null $comment = null)

No description

fileRecordDelete(int $zoneId, int|string $recordId, int $userId, string $username, string|null $comment = null)

No description

fileZoneDelete(int $zoneId, int $userId, string $username, string|null $comment = null)

No description

approve(int $requestId, int $reviewerId, string $reviewerName, string|null $comment = null)

Applies a pending request as the reviewing user. A refused or failed write leaves the request in the failed state with the reason in its error field.

reject(int $requestId, int $reviewerId, string $reviewerName, string|null $comment = null)

No description

cancel(int $requestId, int $userId)

Withdraws the caller's own pending request.

array
staleActions(ZoneChangeRequest $request)

Indexes of the actions the zone has moved away from: an edited or deleted record whose stored row no longer matches the filed "before" state (or is gone), and an addition the zone already holds.

bool
baseSerialMismatch(ZoneChangeRequest $request)

Whether the zone's SOA serial moved since the request's form was rendered.

Details

__construct(ZoneChangeRequestRepositoryInterface $requests, ZoneEditService $zoneEdit, DnsRecordValidationServiceInterface $validator, RecordLookupInterface $records, DomainRepositoryInterface $domains, ZoneRepositoryInterface $zones, RecordManagerInterface $recordManager, SOARecordManagerInterface $soaRecords, ZoneManagementService $zoneManagement, BackendCapabilitiesInterface $backend, TransactionInterface $transaction, ConfigurationInterface $config, bool $recordCommentsEnabled, bool $zoneCommentsEnabled, RecordCommentRepositoryInterface|null $recordComments = null, Closure|null $changeset = null, PermissionService|null $permissions = null, ChangeRequestNotifierInterface|null $notifier = null, Closure|null $zoneSnapshot = null, RecordLinkedCommentRepositoryInterface|null $linkedComments = null)

No description

Parameters

ZoneChangeRequestRepositoryInterface $requests
ZoneEditService $zoneEdit
DnsRecordValidationServiceInterface $validator
RecordLookupInterface $records
DomainRepositoryInterface $domains
ZoneRepositoryInterface $zones
RecordManagerInterface $recordManager
SOARecordManagerInterface $soaRecords
ZoneManagementService $zoneManagement
BackendCapabilitiesInterface $backend
TransactionInterface $transaction
ConfigurationInterface $config
bool $recordCommentsEnabled

Whether the comment of an approved addition is stored

bool $zoneCommentsEnabled

Whether a changed zone comment is filed

RecordCommentRepositoryInterface|null $recordComments

Omit to leave comments of approved additions unstored

Closure|null $changeset

fn(?int $zoneId, ?string $comment, callable $work): mixed grouping the applied writes in the change log; omitted, the work runs ungrouped

PermissionService|null $permissions

Gates zone deletion on the reviewer's delete permission; omitted, no gate

ChangeRequestNotifierInterface|null $notifier

Told about filed and decided requests; omitted, nobody is

Closure|null $zoneSnapshot

fn(int $zoneId, string $zoneName): ?string rendering the zone as a zone file, kept with the request before an approved deletion; omitted, nothing is kept

RecordLinkedCommentRepositoryInterface|null $linkedComments

Per-record comment links; null on a backend without them, where a delete request carries no stored comment

ZoneChangeRequestResult fileRecordEdits(ZoneEditSubmission $submission, string|null $comment = null)

Files the rows of an editor submission that differ from the zone, plus the zone comment when it changed. Nothing is written to the zone.

Parameters

ZoneEditSubmission $submission
string|null $comment

Return Value

ZoneChangeRequestResult

ZoneChangeRequestResult fileRecordAdd(int $zoneId, string $zoneName, array $record, int $userId, string $username, string|null $comment = null)

No description

Parameters

int $zoneId
string $zoneName
array $record

name, type, content, ttl, prio and optionally disabled (0/1) and comment

int $userId
string $username
string|null $comment

Return Value

ZoneChangeRequestResult

ZoneChangeRequestResult fileRecordDelete(int $zoneId, int|string $recordId, int $userId, string $username, string|null $comment = null)

No description

Parameters

int $zoneId
int|string $recordId
int $userId
string $username
string|null $comment

Return Value

ZoneChangeRequestResult

ZoneChangeRequestResult fileZoneDelete(int $zoneId, int $userId, string $username, string|null $comment = null)

No description

Parameters

int $zoneId
int $userId
string $username
string|null $comment

Return Value

ZoneChangeRequestResult

ZoneChangeRequestResult approve(int $requestId, int $reviewerId, string $reviewerName, string|null $comment = null)

Applies a pending request as the reviewing user. A refused or failed write leaves the request in the failed state with the reason in its error field.

Parameters

int $requestId
int $reviewerId
string $reviewerName
string|null $comment

Return Value

ZoneChangeRequestResult

ZoneChangeRequestResult reject(int $requestId, int $reviewerId, string $reviewerName, string|null $comment = null)

No description

Parameters

int $requestId
int $reviewerId
string $reviewerName
string|null $comment

Return Value

ZoneChangeRequestResult

ZoneChangeRequestResult cancel(int $requestId, int $userId)

Withdraws the caller's own pending request.

Parameters

int $requestId
int $userId

Return Value

ZoneChangeRequestResult

array staleActions(ZoneChangeRequest $request)

Indexes of the actions the zone has moved away from: an edited or deleted record whose stored row no longer matches the filed "before" state (or is gone), and an addition the zone already holds.

Parameters

ZoneChangeRequest $request

Return Value

array

bool baseSerialMismatch(ZoneChangeRequest $request)

Whether the zone's SOA serial moved since the request's form was rendered.

Parameters

ZoneChangeRequest $request

Return Value

bool