final class ChangeApprovalPolicy (View source)

Pure rules for the opt-in change approval workflow: whether a user's zone changes are written directly, filed as a change request, or refused, and who may review a request.

Constants

MODE_DIRECT

Changes are written to the zone immediately (today's behaviour).

MODE_REQUEST

Changes are stored as a change request that a reviewer applies later.

MODE_NONE

The user may neither change the zone nor request changes to it.

Methods

static string
mode(bool $enabled, bool $requireReviewForAll, string $permEdit, string $permRequest, bool $userIsZoneOwner)

How the user's changes to a zone are handled.

static bool
canReview(string $permApprove, string $permEdit, bool $userIsZoneOwner)

Reviewing needs both the approve level and the edit permission: the record writers re-check the reviewer's edit rights when a request is applied, so the approve permission adds to edit rights and never replaces them.

Details

static string mode(bool $enabled, bool $requireReviewForAll, string $permEdit, string $permRequest, bool $userIsZoneOwner)

How the user's changes to a zone are handled.

Parameters

bool $enabled approval.enabled
bool $requireReviewForAll approval.require_review_for_all
string $permEdit

edit level for the zone: all, own, own_as_client or none

string $permRequest

change request level: all, own or none

bool $userIsZoneOwner

Return Value

string

one of the MODE_* constants

static bool canReview(string $permApprove, string $permEdit, bool $userIsZoneOwner)

Reviewing needs both the approve level and the edit permission: the record writers re-check the reviewer's edit rights when a request is applied, so the approve permission adds to edit rights and never replaces them.

Parameters

string $permApprove

change approve level: all, own or none

string $permEdit

edit level for the zone: all, own, own_as_client or none

bool $userIsZoneOwner

Return Value

bool