class ApiPermissionService (View source)

Permission gate for the public API. A facade over PermissionService so the API and the web UI share one oracle; group and visible-zone lookups read the user repository.

Constants

TEMPLATE_ASSIGN_DENIED

TEMPLATE_SELF_ASSIGN_DENIED

TEMPLATE_SUPERUSER_DENIED

TEMPLATE_NOT_SUBSET_DENIED

Methods

__construct(UserLookupInterface&UserPermissionReadInterface $userRepository, PermissionService $permissions, ConfigurationInterface|null $config = null)

No description

permissions()

The underlying oracle, for callers that take a PermissionService.

bool
userHasPermission(int $userId, string $permissionName)

Grant from the user's own template or any group template; ueberusers hold every permission.

array
getUserGroupIds(int $userId)

Return the group IDs the user is a member of.

bool
userOwnsZone(int $userId, int $zoneId)

Direct ownership or through any group the user belongs to.

bool
canViewZone(int $userId, int $zoneId)

No description

bool
hasZoneContentEditPermission(int $userId, int $zoneId)

Content-edit grant that applies to the zone (never own_as_client, never metadata).

bool
canEditZoneContent(int $userId, int $zoneId, string|null $zoneType = null)

No description

bool
canEditZoneRecord(int $userId, int $zoneId, string $recordType, string|null $zoneType = null, string|null $recordName = null, string|null $zoneName = null)

No description

bool
canDeleteZone(int $userId, int $zoneId)

No description

bool
canCreateZone(int $userId, string $zoneType = 'MASTER')

MASTER/NATIVE/SLAVE only: the API does not create catalog kinds.

bool
canManageDnssec(int $userId, int $zoneId)

No description

bool
canManageDnssecForNewZone(int $userId, int|null $ownerId, array $groupIds = [])

DNSSEC on a zone being created: the caller must end up owning it, directly or via one of the groups.

bool
canViewUser(int $userId, int $targetUserId)

No description

bool
canEditUser(int $userId, int $targetUserId)

No description

bool
canEditUserPassword(int $userId, int $targetUserId)

No description

bool
canCreateUser(int $userId)

No description

bool
canDeleteUser(int $userId, int $targetUserId)

No description

bool
canManageGroups(int $userId)

No description

bool
canEditPermissionTemplates(int $userId)

No description

int|null
getUserPermissionTemplateId(int $userId)

Read the permission template currently stored on an account.

bool
templateGrantsSuperuser(int $permTemplId)

No description

string|null
checkPermissionTemplateAssignment(int $userId, int|null $targetUserId, int $permTemplId)

No description

bool
canListUsers(int $userId)

No description

bool
canCreateZoneTemplate(int $userId)

No description

bool
canEditZoneTemplate(int $userId)

No description

bool
canWriteTemplateRecordType(int $userId, string $recordType)

Template records follow the caller's global edit level; clients may not write SOA/NS/LUA.

bool
canViewZoneTemplates(int $userId)

No description

bool
canEditZoneMeta(int $userId, int $zoneId)

No description

bool
canViewZoneMetadata(int $userId, int $zoneId)

No description

bool
canViewZoneOwnership(int $userId, int $zoneId)

No description

string
getChangeRequestPermissionLevelForZone(int $userId, int $zoneId)

Change request level narrowed to the zone: "all", "own", or "none".

string
getChangeApprovePermissionLevelForZone(int $userId, int $zoneId)

Change approve level narrowed to the zone: "all", "own", or "none".

string
getChangeApprovalMode(int $userId, int $zoneId)

How the user's zone changes are handled: written directly, filed as a change request, or refused. With change approval off this is today's edit rule.

bool
canReviewChangeRequests(int $userId, int $zoneId)

Whether the user may approve or reject change requests for the zone.

array|null
getReviewableZoneIds(int $userId)

Zones whose change requests the user may review: null for every zone, otherwise the owned zones (or none) that the approve and edit levels cover.

bool
zoneDeleteRequiresApproval(int $userId, int $zoneId)

Whether a zone deletion has to go through a change request. Deleting stays direct for holders of the delete permission unless every change is reviewed.

bool
canRequestZoneDelete(int $userId, int $zoneId)

Whether the user may file a request to delete the zone: their request level covers it, or every change is reviewed and they could delete it.

bool
canRequestZoneRecord(int $userId, int $zoneId, string $recordType, string|null $recordName = null, string|null $zoneName = null)

canEditZoneRecord()'s record-type rule for filing a request: SOA/NS/LUA need an edit grant above own_as_client or a request level that covers the zone, except subzone NS records for zone_content_edit_ns_subzone holders.

array
getUserOwnedZoneIds(int $userId)

Zones the user owns directly or through any group.

array|null
getUserVisibleZoneIds(int $userId)

Get all zone IDs that the user is allowed to view (stateless)

Details

__construct(UserLookupInterface&UserPermissionReadInterface $userRepository, PermissionService $permissions, ConfigurationInterface|null $config = null)

No description

Parameters

UserLookupInterface&UserPermissionReadInterface $userRepository
PermissionService $permissions
ConfigurationInterface|null $config

Omitted, the change approval flags read as off

PermissionService permissions()

The underlying oracle, for callers that take a PermissionService.

Return Value

PermissionService

bool userHasPermission(int $userId, string $permissionName)

Grant from the user's own template or any group template; ueberusers hold every permission.

Parameters

int $userId
string $permissionName

Return Value

bool

array getUserGroupIds(int $userId)

Return the group IDs the user is a member of.

Parameters

int $userId

Return Value

array

bool userOwnsZone(int $userId, int $zoneId)

Direct ownership or through any group the user belongs to.

Parameters

int $userId
int $zoneId

Return Value

bool

bool canViewZone(int $userId, int $zoneId)

No description

Parameters

int $userId
int $zoneId

Return Value

bool

bool hasZoneContentEditPermission(int $userId, int $zoneId)

Content-edit grant that applies to the zone (never own_as_client, never metadata).

Parameters

int $userId
int $zoneId

Return Value

bool

bool canEditZoneContent(int $userId, int $zoneId, string|null $zoneType = null)

No description

Parameters

int $userId
int $zoneId
string|null $zoneType

Return Value

bool

bool canEditZoneRecord(int $userId, int $zoneId, string $recordType, string|null $zoneType = null, string|null $recordName = null, string|null $zoneName = null)

No description

Parameters

int $userId
int $zoneId
string $recordType
string|null $zoneType
string|null $recordName
string|null $zoneName

Return Value

bool

bool canDeleteZone(int $userId, int $zoneId)

No description

Parameters

int $userId
int $zoneId

Return Value

bool

bool canCreateZone(int $userId, string $zoneType = 'MASTER')

MASTER/NATIVE/SLAVE only: the API does not create catalog kinds.

Parameters

int $userId
string $zoneType

Return Value

bool

bool canManageDnssec(int $userId, int $zoneId)

No description

Parameters

int $userId
int $zoneId

Return Value

bool

bool canManageDnssecForNewZone(int $userId, int|null $ownerId, array $groupIds = [])

DNSSEC on a zone being created: the caller must end up owning it, directly or via one of the groups.

Parameters

int $userId
int|null $ownerId
array $groupIds

Return Value

bool

bool canViewUser(int $userId, int $targetUserId)

No description

Parameters

int $userId
int $targetUserId

Return Value

bool

bool canEditUser(int $userId, int $targetUserId)

No description

Parameters

int $userId
int $targetUserId

Return Value

bool

bool canEditUserPassword(int $userId, int $targetUserId)

No description

Parameters

int $userId
int $targetUserId

Return Value

bool

bool canCreateUser(int $userId)

No description

Parameters

int $userId

Return Value

bool

bool canDeleteUser(int $userId, int $targetUserId)

No description

Parameters

int $userId
int $targetUserId

Return Value

bool

bool canManageGroups(int $userId)

No description

Parameters

int $userId

Return Value

bool

bool canEditPermissionTemplates(int $userId)

No description

Parameters

int $userId

Return Value

bool

int|null getUserPermissionTemplateId(int $userId)

Read the permission template currently stored on an account.

Parameters

int $userId

User ID to look up

Return Value

int|null

Template id, or null when the account is gone or has none

bool templateGrantsSuperuser(int $permTemplId)

No description

Parameters

int $permTemplId

Return Value

bool

string|null checkPermissionTemplateAssignment(int $userId, int|null $targetUserId, int $permTemplId)

No description

Parameters

int $userId
int|null $targetUserId
int $permTemplId

Return Value

string|null

bool canListUsers(int $userId)

No description

Parameters

int $userId

Return Value

bool

bool canCreateZoneTemplate(int $userId)

No description

Parameters

int $userId

Return Value

bool

bool canEditZoneTemplate(int $userId)

No description

Parameters

int $userId

Return Value

bool

bool canWriteTemplateRecordType(int $userId, string $recordType)

Template records follow the caller's global edit level; clients may not write SOA/NS/LUA.

Parameters

int $userId
string $recordType

Return Value

bool

bool canViewZoneTemplates(int $userId)

No description

Parameters

int $userId

Return Value

bool

bool canEditZoneMeta(int $userId, int $zoneId)

No description

Parameters

int $userId
int $zoneId

Return Value

bool

bool canViewZoneMetadata(int $userId, int $zoneId)

No description

Parameters

int $userId
int $zoneId

Return Value

bool

bool canViewZoneOwnership(int $userId, int $zoneId)

No description

Parameters

int $userId
int $zoneId

Return Value

bool

string getChangeRequestPermissionLevelForZone(int $userId, int $zoneId)

Change request level narrowed to the zone: "all", "own", or "none".

Parameters

int $userId
int $zoneId

Return Value

string

string getChangeApprovePermissionLevelForZone(int $userId, int $zoneId)

Change approve level narrowed to the zone: "all", "own", or "none".

Parameters

int $userId
int $zoneId

Return Value

string

string getChangeApprovalMode(int $userId, int $zoneId)

How the user's zone changes are handled: written directly, filed as a change request, or refused. With change approval off this is today's edit rule.

Parameters

int $userId
int $zoneId

Return Value

string

One of the ChangeApprovalPolicy::MODE_* constants

bool canReviewChangeRequests(int $userId, int $zoneId)

Whether the user may approve or reject change requests for the zone.

Parameters

int $userId
int $zoneId

Return Value

bool

array|null getReviewableZoneIds(int $userId)

Zones whose change requests the user may review: null for every zone, otherwise the owned zones (or none) that the approve and edit levels cover.

Parameters

int $userId

Return Value

array|null

bool zoneDeleteRequiresApproval(int $userId, int $zoneId)

Whether a zone deletion has to go through a change request. Deleting stays direct for holders of the delete permission unless every change is reviewed.

Parameters

int $userId
int $zoneId

Return Value

bool

bool canRequestZoneDelete(int $userId, int $zoneId)

Whether the user may file a request to delete the zone: their request level covers it, or every change is reviewed and they could delete it.

Parameters

int $userId
int $zoneId

Return Value

bool

bool canRequestZoneRecord(int $userId, int $zoneId, string $recordType, string|null $recordName = null, string|null $zoneName = null)

canEditZoneRecord()'s record-type rule for filing a request: SOA/NS/LUA need an edit grant above own_as_client or a request level that covers the zone, except subzone NS records for zone_content_edit_ns_subzone holders.

Parameters

int $userId
int $zoneId
string $recordType
string|null $recordName
string|null $zoneName

Return Value

bool

array getUserOwnedZoneIds(int $userId)

Zones the user owns directly or through any group.

Parameters

int $userId

Return Value

array

array|null getUserVisibleZoneIds(int $userId)

Get all zone IDs that the user is allowed to view (stateless)

Parameters

int $userId

User ID to check

Return Value

array|null

Array of zone IDs the user can view, or null if user can view all zones