ZoneTemplateRepositoryInterface
interface ZoneTemplateRepositoryInterface (View source)
Persistence for zone templates (zone_templ), their records (zone_templ_records) and the zone -> template links kept in zones.zone_templ_id.
ZoneTemplateAccessPolicy owns the permission checks, ZoneTemplateWriteService and ZoneTemplateRecordService the validation, ZoneTemplatePlaceholders the placeholder expansion; every SQL statement behind those decisions lives here.
Methods
List zone templates visible to the given user, with owner/creator names and the number of zones linked to each template.
Get zone template details by ID.
Get the template name linked to a zone.
Check if a zone template exists.
Check if a zone template name is already taken.
Find every template ID carrying the given name. Names are not unique.
Get the owner ID of a zone template.
Check if the user owns a zone template.
Whether the template is shared with a group the user belongs to.
Groups each template is shared with, sorted by name. With a viewer, a template the viewer does not own lists only the groups the viewer belongs to.
Replace the groups a template is shared with.
ID of the global template flagged is_default, if any.
Whether a global template (owner 0) with this ID exists.
Find global templates (owner 0) by name.
Flag one global template as the system-wide default, clearing the flag from every other global template in the same statement.
Clear the system-wide default template flag.
Create a new zone template with a default SOA record.
Create a zone template together with the given records, in one transaction.
Update a zone template.
Delete a zone template with its records and links.
Delete every template the user owns, with its records and zone links.
The user's templates that are shared with at least one group, sorted by name.
Give the user's shared templates to another user, so the groups keep them when the owner is deleted. Runs inside the caller's transaction.
Get the records of a zone template.
Get a single zone template record by ID.
Count the records in a zone template.
Add a record to a zone template.
Update a zone template record.
Delete a zone template record.
Unlink a zone from its template.
The template a zone is linked to.
Point a zone at a template; 0 unlinks it.
The zones.id rows of a zone. A zone shared by several owners has one row per owner, and the template sync state keys on that id.
Zone IDs of the zones linked to a template. On SQL backends a link whose PowerDNS domain no longer exists is left out.
Both ids of every zone linked to a template, so callers can address the PowerDNS side (domain_id) and Poweradmin-native tracking (zone_id) correctly.
The zones linked to a template with name, type, record count and owner details, ordered by zone name.
Name and type of the given zones, ordered by name.
Details
array
listZoneTemplates(int|null $userId, bool $isUeberuser)
List zone templates visible to the given user, with owner/creator names and the number of zones linked to each template.
array|false
getZoneTemplateDetails(int $id)
Get zone template details by ID.
string
getTemplateNameForZone(int|string $zoneId)
Get the template name linked to a zone.
bool
zoneTemplateExists(int $id)
Check if a zone template exists.
bool
zoneTemplateNameExists(string $name, int|null $excludeId = null)
Check if a zone template name is already taken.
array
findTemplateIdsByName(string $name)
Find every template ID carrying the given name. Names are not unique.
int|null
getOwner(int $templateId)
Get the owner ID of a zone template.
bool
isOwner(int $templateId, int $userId)
Check if the user owns a zone template.
bool
isSharedWithUser(int $templateId, int $userId)
Whether the template is shared with a group the user belongs to.
array
listGroupsForTemplates(array $templateIds, int|null $viewerId = null)
Groups each template is shared with, sorted by name. With a viewer, a template the viewer does not own lists only the groups the viewer belongs to.
void
replaceTemplateGroups(int $templateId, array $groupIds)
Replace the groups a template is shared with.
int|null
findFlaggedDefaultTemplateId()
ID of the global template flagged is_default, if any.
bool
globalTemplateExists(int $id)
Whether a global template (owner 0) with this ID exists.
array
findGlobalTemplateIdsByName(string $name)
Find global templates (owner 0) by name.
void
flagDefaultTemplate(int $templateId)
Flag one global template as the system-wide default, clearing the flag from every other global template in the same statement.
void
clearDefaultTemplate()
Clear the system-wide default template flag.
int
createZoneTemplate(string $name, string $description, int $owner, int $createdBy, array $groupIds = [])
Create a new zone template with a default SOA record.
int
createZoneTemplateWithRecords(string $name, string $description, int $owner, int $createdBy, array $records, array $groupIds = [])
Create a zone template together with the given records, in one transaction.
A default SOA record is appended when the records carry none.
bool
updateZoneTemplate(int $id, string $name, string $description, int|null $owner = null)
Update a zone template.
bool
deleteZoneTemplate(int $id)
Delete a zone template with its records and links.
void
deleteZoneTemplatesOwnedBy(int $ownerId)
Delete every template the user owns, with its records and zone links.
Runs inside the caller's transaction.
array
listSharedTemplatesOwnedBy(int $ownerId)
The user's templates that are shared with at least one group, sorted by name.
void
handOverSharedTemplates(int $ownerId, int $heirId)
Give the user's shared templates to another user, so the groups keep them when the owner is deleted. Runs inside the caller's transaction.
array
getZoneTemplateRecords(int $templateId, int $rowStart = 0, int $rowAmount = Constants::DEFAULT_MAX_ROWS, string $sortBy = 'name')
Get the records of a zone template.
array
getZoneTemplateRecordById(int $id, int|null $templateId = null)
Get a single zone template record by ID.
int
countZoneTemplateRecords(int $templateId)
Count the records in a zone template.
int
addRecord(int $templateId, string $name, string $type, string $content, int $ttl, int $prio)
Add a record to a zone template.
bool
updateRecord(int $id, string $name, string $type, string $content, int $ttl, int $prio)
Update a zone template record.
bool
deleteRecord(int $id)
Delete a zone template record.
bool
unlinkZoneFromTemplate(int $zoneId)
Unlink a zone from its template.
int
getTemplateIdForZone(int $zoneId)
The template a zone is linked to.
void
assignTemplateToZone(int $zoneId, int $templateId)
Point a zone at a template; 0 unlinks it.
array
listZoneRowIds(int $zoneId)
The zones.id rows of a zone. A zone shared by several owners has one row per owner, and the template sync state keys on that id.
array
listLinkedZoneIds(int $templateId, int|null $ownerId)
Zone IDs of the zones linked to a template. On SQL backends a link whose PowerDNS domain no longer exists is left out.
array
listLinkedZoneIdPairs(int $templateId, int|null $ownerId)
Both ids of every zone linked to a template, so callers can address the PowerDNS side (domain_id) and Poweradmin-native tracking (zone_id) correctly.
On SQL backends a link whose PowerDNS domain no longer exists is left out.
array
listLinkedZones(int $templateId, int|null $ownerId)
The zones linked to a template with name, type, record count and owner details, ordered by zone name.
array
getZonesByIds(array $zoneIds)
Name and type of the given zones, ordered by name.