class ApiPermissionService (View source)

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

Constants

TEMPLATE_ASSIGN_DENIED

TEMPLATE_SELF_ASSIGN_DENIED

TEMPLATE_SUPERUSER_DENIED

Methods

__construct(PDO $db, PermissionService|null $permissions = null, 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.

array
getExistingGroupIds(array $groupIds)

Given a list of group IDs, return the subset that actually exists in user_groups.

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

array|null
getUserVisibleZoneIds(int $userId)

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

Details

__construct(PDO $db, PermissionService|null $permissions = null, ConfigurationInterface|null $config = null)

No description

Parameters

PDO $db
PermissionService|null $permissions
ConfigurationInterface|null $config

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

array getExistingGroupIds(array $groupIds)

Given a list of group IDs, return the subset that actually exists in user_groups.

Parameters

array $groupIds

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

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