final class ZoneOwnershipIndex (View source)

Who owns which of a page of zones, resolved once so per-row controls do not query per zone. Ownership is direct (zones.owner) or through any group the user belongs to.

Methods

__construct(int $userId, array $userGroupIds, array $ownersByZone, array $groupsByZone)

No description

bool
owns(int $zoneId)

No description

bool
hasGroupOwners()

Whether any zone on the page is group-owned, so group names are worth loading.

array
groupIds(int $zoneId)

No description

bool
allows(string $level, int $zoneId)

Whether a permission level ("all", "own", "own_as_client", "none") lets the user act on the zone; the "_own" levels additionally need ownership.

Details

__construct(int $userId, array $userGroupIds, array $ownersByZone, array $groupsByZone)

No description

Parameters

int $userId

The user the index answers for

array $userGroupIds

Groups the user belongs to

array $ownersByZone

Zone id => direct owner user ids

array $groupsByZone

Zone id => owning group ids

bool owns(int $zoneId)

No description

Parameters

int $zoneId

Return Value

bool

bool hasGroupOwners()

Whether any zone on the page is group-owned, so group names are worth loading.

Return Value

bool

array groupIds(int $zoneId)

No description

Parameters

int $zoneId

Return Value

array

bool allows(string $level, int $zoneId)

Whether a permission level ("all", "own", "own_as_client", "none") lets the user act on the zone; the "_own" levels additionally need ownership.

Parameters

string $level
int $zoneId

Return Value

bool