class ZoneGroupService (View source)

Assigns zones to groups and removes them; the group-based half of zone ownership.

Handles assigning groups as zone owners

Constants

private SHARED_ZONE_ID

Methods

__construct(ZoneGroupRepositoryInterface $zoneGroupRepository, UserGroupLookupInterface $groupRepository, ZoneOwnershipGuard $ownershipGuard, ZoneOwnershipLimit|null $ownershipLimit = null)

No description

addGroupToZone(int $domainId, int $groupId)

Add a group as zone owner

removeGroupFromZone(int $domainId, int $groupId)

Remove a group from zone owners. The guard answers before the group lookup so a refusal outranks a missing group, as the API contract orders them.

array
listZoneOwners(int $domainId)

List all groups that own a zone

array
listGroupZones(int $groupId)

List all zones owned by a group

array
bulkAddZones(int $groupId, array $domainIds)

Add multiple zones to a group

array
bulkRemoveZones(int $groupId, array $domainIds)

Remove multiple zones from a group. A zone whose last allowed owner is this group stays assigned and is reported in failed with the reason.

bool
isGroupOwner(int $domainId, int $groupId)

Check if a group owns a zone

array
getGroupDeletionImpact(int $groupId, int $limit = 20)

Get zones that will be affected when a group is deleted

Details

__construct(ZoneGroupRepositoryInterface $zoneGroupRepository, UserGroupLookupInterface $groupRepository, ZoneOwnershipGuard $ownershipGuard, ZoneOwnershipLimit|null $ownershipLimit = null)

No description

Parameters

ZoneGroupRepositoryInterface $zoneGroupRepository
UserGroupLookupInterface $groupRepository
ZoneOwnershipGuard $ownershipGuard
ZoneOwnershipLimit|null $ownershipLimit

Zone limit of the group being granted a zone; null enforces none

ZoneGroup|ZoneLimitBreach addGroupToZone(int $domainId, int $groupId)

Add a group as zone owner

Parameters

int $domainId

Zone/Domain ID

int $groupId

Group ID

Return Value

ZoneGroup|ZoneLimitBreach

The grant, or the group's zone limit it would exceed

Exceptions

InvalidArgumentException

bool|ZoneOwnershipRefusal removeGroupFromZone(int $domainId, int $groupId)

Remove a group from zone owners. The guard answers before the group lookup so a refusal outranks a missing group, as the API contract orders them.

Parameters

int $domainId

Zone/Domain ID

int $groupId

Group ID

Return Value

bool|ZoneOwnershipRefusal

True when removed, false when the group did not own the zone, the refusal when the last-owner rule forbids it

Exceptions

GroupNotFoundException

array listZoneOwners(int $domainId)

List all groups that own a zone

Parameters

int $domainId

Zone/Domain ID

Return Value

array

array listGroupZones(int $groupId)

List all zones owned by a group

Parameters

int $groupId

Group ID

Return Value

array

Exceptions

InvalidArgumentException

array bulkAddZones(int $groupId, array $domainIds)

Add multiple zones to a group

Parameters

int $groupId

Group ID

array $domainIds

Array of domain IDs

Return Value

array

Results of bulk operation; limit is set when the group's zone limit stopped it

array bulkRemoveZones(int $groupId, array $domainIds)

Remove multiple zones from a group. A zone whose last allowed owner is this group stays assigned and is reported in failed with the reason.

Parameters

int $groupId

Group ID

array $domainIds

Array of domain IDs

Return Value

array

Results of bulk operation

bool isGroupOwner(int $domainId, int $groupId)

Check if a group owns a zone

Parameters

int $domainId

Zone/Domain ID

int $groupId

Group ID

Return Value

bool

array getGroupDeletionImpact(int $groupId, int $limit = 20)

Get zones that will be affected when a group is deleted

Parameters

int $groupId

Group ID

int $limit

Limit number of zones returned (default 20)

Return Value

array