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 the typed request input; the web forms hand in the owner and groups they 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(ZoneOwnershipInput $input, int $callerUserId)

Applies the ownership mode to what the request asked for, then the shared ownership rules of {resolveOwnership()}.

bool
canAssignOtherOwners(int $callerUserId)

Whether the caller may give a new zone to somebody else; the owner pickers offer other users only when this holds.

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 that user must exist, and non-admins may only pick their own groups.

Details

__construct(ZoneOwnershipModeService $mode, PermissionService $permissions, UserGroupLookupInterface $groups, UserLookupInterface $users)

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(ZoneOwnershipInput $input, int $callerUserId)

Applies the ownership mode to what the request asked for, then the shared ownership rules of {resolveOwnership()}.

Parameters

ZoneOwnershipInput $input
int $callerUserId

Return Value

ZoneOwnershipResolution

bool canAssignOtherOwners(int $callerUserId)

Whether the caller may give a new zone to somebody else; the owner pickers offer other users only when this holds.

Parameters

int $callerUserId

Return Value

bool

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 that user must exist, and non-admins may only pick their own groups.

Parameters

int|null $owner
array $groupIds
int $callerUserId

Return Value

ZoneOwnershipResolution