ApiZoneRepository
final class ApiZoneRepository implements ZoneRepositoryInterface (View source)
API-backend zone repository; reads zone state through PowerDNS and ownership from zones and zones_groups.
Methods
No description
No description
Get reverse zones with efficient database-level filtering and pagination
Count the zones a permission scope may see, optionally narrowed by first letter and zone kind.
Get all reverse zone counts in a single query (optimization)
List zones with optional user/permission filtering
Get a zone by ID with full details
Find forward zones associated with reverse zones through PTR records
Get zone comment by zone ID
Write the native zones row of a zone the backend has just created.
Drop the native zones row of a zone, when the zone is deleted.
Set the zone comment, creating the zones row for a zone that has none.
Update zone comment
Direct owners of several zones in one query, for list pages.
Ids of every zone the user owns directly or through a group, in the id space the zone logs and zones_groups use.
Get users who own a zone
Whether two zones share this zone id in API backend mode, so owner rows and group grants keyed by it cannot tell the zones apart and are not honoured.
Lock the zone's owner rows for the rest of the open transaction, so a concurrent removal waits instead of deciding on stale owner counts.
Add owner to zone
Give the named zone row a user being deleted holds to another user, so the zone stays.
Remove owner from zone
Check if user is already an owner of the zone
Delete a zone by ID
Update zone metadata
Get the total number of zones
Get count of zones with filtering
Get all zones with filtering and pagination
Get a zone by ID
Details
__construct(PDO $db, DnsBackendProviderInterface $backendProvider, string $dbType, ConfigurationInterface $config, SessionInterface $session, LoggerInterface|null $logger = null)
No description
array
getDistinctStartingLetters(int $userId, bool $viewOthers)
No description
ZoneSummary>|int
getReverseZones(string $permType, int $userId, string $reverseType = 'all', int $offset = 0, int $limit = 25, string $sortBy = 'name', string $sortDirection = 'ASC', bool $countOnly = false, bool $showSerial = false, bool $showTemplate = false, bool $includeHealth = true, bool $includeRecordCount = true)
Get reverse zones with efficient database-level filtering and pagination
int
countZones(string $permType, int|null $userId, string $letterStart = 'all', string $zoneType = 'forward')
Count the zones a permission scope may see, optionally narrowed by first letter and zone kind.
array
getReverseZoneCounts(string $permType, int $userId)
Get all reverse zone counts in a single query (optimization)
array
listZones(int|null $userId = null, bool $viewOthers = false, array $filters = [], int $offset = 0, int $limit = 100)
List zones with optional user/permission filtering
ZoneDetail|null
getZone(int $zoneId)
Get a zone by ID with full details
The getZoneById() core plus comment, secured and the owner list; ZoneDetail::toArray() gives the legacy column-keyed shape.
array
findForwardZonesByPtrRecords(array $reverseZoneIds)
Find forward zones associated with reverse zones through PTR records
string|null
getZoneComment(int $zoneId)
Get zone comment by zone ID
int|string
createZoneShell(int $domainId, int|null $owner, int $templateId)
Write the native zones row of a zone the backend has just created.
void
deleteZoneShell(int $domainId)
Drop the native zones row of a zone, when the zone is deleted.
void
saveZoneComment(int $zoneId, string $comment)
Set the zone comment, creating the zones row for a zone that has none.
bool
updateZoneComment(int $zoneId, string $comment)
Update zone comment
array
getOwnerIdsByZoneIds(array $zoneIds)
Direct owners of several zones in one query, for list pages.
array
getOwnedZoneIds(int $userId)
Ids of every zone the user owns directly or through a group, in the id space the zone logs and zones_groups use.
array
getZoneOwners(int $zoneId)
Get users who own a zone
bool
isSharedZoneId(int $zoneId)
Whether two zones share this zone id in API backend mode, so owner rows and group grants keyed by it cannot tell the zones apart and are not honoured.
void
lockZoneOwners(int $zoneId)
Lock the zone's owner rows for the rest of the open transaction, so a concurrent removal waits instead of deciding on stale owner counts.
bool
addOwnerToZone(int $zoneId, int $userId)
Add owner to zone
bool|null
handOverNamedZoneRow(int $zoneId, int $fromUserId, int $toUserId)
Give the named zone row a user being deleted holds to another user, so the zone stays.
Null when the backend keeps no such row or the user holds none (add an owner instead); false when the id is shared and the row it opens is not that user's.
bool
removeOwnerFromZone(int $zoneId, int $userId)
Remove owner from zone
bool
isUserZoneOwner(int $zoneId, int $userId)
Check if user is already an owner of the zone
bool
deleteZone(int $zoneId)
Delete a zone by ID
bool
updateZone(int $zoneId, array $updates)
Update zone metadata
int
getZoneCount()
Get the total number of zones
int
getZoneCountFiltered(array|null $zoneIds, int|null $userId = null, string|null $nameFilter = null, string|null $nameContains = null)
Get count of zones with filtering
array
getAllZonesFiltered(array|null $zoneIds, int|null $userId = null, string|null $nameFilter = null, int|null $offset = null, int|null $limit = null, string|null $nameContains = null, array $sort = [])
Get all zones with filtering and pagination
array|null
getZoneById(int $zoneId)
Get a zone by ID