interface ZoneOwnershipRepositoryInterface (View source)

Zone ownership reads and writes; one of the three roles ZoneRepositoryInterface combines.

Methods

array
getZoneOwners(int $zoneId)

Get users who own a zone

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.

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.

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
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.

Details

array getZoneOwners(int $zoneId)

Get users who own a zone

Parameters

int $zoneId

The zone ID

Return Value

array

Array of user information

array getOwnerIdsByZoneIds(array $zoneIds)

Direct owners of several zones in one query, for list pages.

Parameters

array $zoneIds

Return Value

array

Zone id => owner user ids; zones without a row are absent

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.

Parameters

int $userId

Return Value

array

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.

Parameters

int $zoneId

The zone ID

Return Value

void

bool addOwnerToZone(int $zoneId, int $userId)

Add owner to zone

Parameters

int $zoneId

The zone ID

int $userId

The user ID

Return Value

bool

True if added successfully

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.

Parameters

int $zoneId
int $fromUserId
int $toUserId

Return Value

bool|null

bool removeOwnerFromZone(int $zoneId, int $userId)

Remove owner from zone

Parameters

int $zoneId

The zone ID

int $userId

The user ID

Return Value

bool

True if removed successfully

bool isUserZoneOwner(int $zoneId, int $userId)

Check if user is already an owner of the zone

Parameters

int $zoneId

The zone ID

int $userId

The user ID

Return Value

bool

True if user is already an owner

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.

Parameters

int $zoneId

Return Value

bool