class RecordAddService (View source)

The add-record flow shared by the add-record page, the inline form on the zone editor and the record wizards: open() applies the same gates in the same order, and add() normalises name, content and TTL the same way and follows the same rules for the companion PTR or A record.

Methods

__construct(RecordManagerService $records, ReverseRecordCreator $reverseRecords, DomainRecordCreator $domainRecords, ReverseTtlResolver $ttlResolver, PermissionService $permissions, DomainRepositoryInterface $domains, ChangeApprovalContext $approval)

No description

open(int $zoneId, int $userId)

Whether the user may add records to the zone directly: the user must have some edit or request access to it, the zone must exist, the user's changes must not be routed through review (those go through the zone editor), and the zone must be writable by them.

add(int $zoneId, string $zoneName, string $name, string $type, string $content, int|null $ttl, int $prio, string $comment, int $userId, string $username, string $companion = '', int $disabled = 0, string $origin = AuditLoggerInterface::ORIGIN_WEB, Closure|null $companionZoneAllowed = null)

No description

addFromForm(int $zoneId, string $zoneName, string $name, string $type, string $content, int|null $ttl, int $prio, string $comment, int $userId, string $username, string $companion = '')

add() for the web forms, where an IP address typed as the name in a reverse zone stands for its PTR name and one outside the zone is refused.

Details

__construct(RecordManagerService $records, ReverseRecordCreator $reverseRecords, DomainRecordCreator $domainRecords, ReverseTtlResolver $ttlResolver, PermissionService $permissions, DomainRepositoryInterface $domains, ChangeApprovalContext $approval)

No description

Parameters

RecordManagerService $records
ReverseRecordCreator $reverseRecords
DomainRecordCreator $domainRecords
ReverseTtlResolver $ttlResolver
PermissionService $permissions
DomainRepositoryInterface $domains
ChangeApprovalContext $approval

RecordAddAccess open(int $zoneId, int $userId)

Whether the user may add records to the zone directly: the user must have some edit or request access to it, the zone must exist, the user's changes must not be routed through review (those go through the zone editor), and the zone must be writable by them.

Parameters

int $zoneId
int $userId

Return Value

RecordAddAccess

RecordAddResult add(int $zoneId, string $zoneName, string $name, string $type, string $content, int|null $ttl, int $prio, string $comment, int $userId, string $username, string $companion = '', int $disabled = 0, string $origin = AuditLoggerInterface::ORIGIN_WEB, Closure|null $companionZoneAllowed = null)

No description

Parameters

int $zoneId
string $zoneName
string $name
string $type
string $content
int|null $ttl

The submitted TTL, or null for the configured default of the type

int $prio
string $comment
int $userId
string $username
string $companion

One of the RecordAddResult::COMPANION_* constants, or '' for none

int $disabled

1 to create the record disabled (API callers); the forms always pass 0

string $origin

One of the AuditLoggerInterface::ORIGIN_* values; the API writes api_add_record

Closure|null $companionZoneAllowed

Whether the caller may write the companion or its synced comment into the other zone (an API key's zone scope)

Return Value

RecordAddResult

RecordAddResult addFromForm(int $zoneId, string $zoneName, string $name, string $type, string $content, int|null $ttl, int $prio, string $comment, int $userId, string $username, string $companion = '')

add() for the web forms, where an IP address typed as the name in a reverse zone stands for its PTR name and one outside the zone is refused.

Parameters

int $zoneId
string $zoneName
string $name
string $type
string $content
int|null $ttl

The submitted TTL, or null for the configured default of the type

int $prio
string $comment
int $userId
string $username
string $companion

One of the RecordAddResult::COMPANION_* constants, or '' for none

Return Value

RecordAddResult