class ZoneCreateOwnershipResolver (View source)

Resolves the user-owner and group-owner assignment for a new zone, applying the active zone_ownership_mode and permission rules. The API hands in its JSON body; the web forms hand in the owner and groups they already parsed.

Methods

string|null
ownerOptionsBlocker(int $callerUserId)

Why a user cannot pick any owner for a new zone in groups_only mode: no group exists at all, or the user belongs to none. Null when they can.

resolve(array $input, int $callerUserId)

No description

resolveOwnership(int|null $owner, array $groupIds, int $callerUserId)

The rules shared by the API and the web forms: the groups must exist, a zone needs at least one owner, giving it to another user needs zone_content_edit_others, and non-admins may only pick their own groups.

Details

__construct(ZoneOwnershipModeService $mode, PermissionService $permissions, UserGroupRepositoryInterface $groups)

No description

string|null ownerOptionsBlocker(int $callerUserId)

Why a user cannot pick any owner for a new zone in groups_only mode: no group exists at all, or the user belongs to none. Null when they can.

Parameters

int $callerUserId

Return Value

string|null

ZoneOwnershipResolution resolve(array $input, int $callerUserId)

No description

Parameters

array $input

Decoded JSON body.

int $callerUserId

Authenticated caller.

Return Value

ZoneOwnershipResolution

ZoneOwnershipResolution resolveOwnership(int|null $owner, array $groupIds, int $callerUserId)

The rules shared by the API and the web forms: the groups must exist, a zone needs at least one owner, giving it to another user needs zone_content_edit_others, and non-admins may only pick their own groups.

Parameters

int|null $owner
array $groupIds
int $callerUserId

Return Value

ZoneOwnershipResolution