class ZoneOwnershipFormResolver (View source)

Reads the owner and group fields of the add-zone forms and applies the shared ownership rules. The forms drop what the ownership mode disallows instead of rejecting it, and word the refusals in the user's language.

Also decides which users the owner pickers offer.

Methods

array
selectableOwners(array $users, int $callerUserId)

The users an owner picker may offer: everyone with user_view_others, otherwise only the caller.

array
assignableOwners(array $users, int $callerUserId)

The users a new zone may be given to: everyone when the create path lets the caller assign other owners and they may see other users, otherwise only the caller.

bool
mayNameAccount(array $users, int $callerUserId, string $account, string|null $storedAccount = null)

Whether the caller may store this autoprimary account. PowerDNS copies it into the zones it creates, so it names their owner: a caller who cannot see other users may only pick from the accounts the form offered, or keep the stored one.

string|null
blocker(int $callerUserId)

The page-level refusal for a user who could not pick any owner, or null.

resolve(Request $request, int $callerUserId)

No description

resolveInputs(mixed $ownerInput, mixed $groupsInput, int $callerUserId)

No description

Details

__construct(ZoneOwnershipModeService $mode, ZoneCreateOwnershipResolver $resolver, PermissionService $permissions)

No description

array selectableOwners(array $users, int $callerUserId)

The users an owner picker may offer: everyone with user_view_others, otherwise only the caller.

Parameters

array $users

Rows with an 'id' key

int $callerUserId

Return Value

array

array assignableOwners(array $users, int $callerUserId)

The users a new zone may be given to: everyone when the create path lets the caller assign other owners and they may see other users, otherwise only the caller.

Parameters

array $users

Rows with an 'id' key

int $callerUserId

Return Value

array

bool mayNameAccount(array $users, int $callerUserId, string $account, string|null $storedAccount = null)

Whether the caller may store this autoprimary account. PowerDNS copies it into the zones it creates, so it names their owner: a caller who cannot see other users may only pick from the accounts the form offered, or keep the stored one.

Parameters

array $users

Rows with 'id' and 'username' keys

int $callerUserId
string $account
string|null $storedAccount

Return Value

bool

string|null blocker(int $callerUserId)

The page-level refusal for a user who could not pick any owner, or null.

Parameters

int $callerUserId

Return Value

string|null

ZoneOwnershipResolution resolve(Request $request, int $callerUserId)

No description

Parameters

Request $request
int $callerUserId

Return Value

ZoneOwnershipResolution

ZoneOwnershipResolution resolveInputs(mixed $ownerInput, mixed $groupsInput, int $callerUserId)

No description

Parameters

mixed $ownerInput

The posted owner field, if any

mixed $groupsInput

The posted groups field, if any

int $callerUserId

Return Value

ZoneOwnershipResolution