wfa.measurement.access.v1alpha.Permissions) provides APIs for managing permissions and checking what permissions a principal has on protected resources.
Overview
Permissions are the foundation of the access control system:- Granular permissions - Each permission represents a specific operation
- Resource-scoped - Permissions apply to specific resource types
- Role composition - Permissions are grouped into roles
- Runtime checks - Verify permissions before executing operations
Permission Resource
A Permission represents a single operation that can be performed on a resource type.Resource name (identifier)Format:
permissions/{permission}Examples:permissions/measurement.createpermissions/report.readpermissions/eventGroup.list
Set of resource types this permission can apply toExamples:
["halo.wfanet.org/Measurement"]["reporting.halo-cmm.org/Report", "reporting.halo-cmm.org/Metric"]["*"]- Applies to all resource types
Permission Naming Convention
Permission IDs follow the pattern{resource}.{operation}:
| Permission | Description |
|---|---|
measurement.create | Create measurements |
measurement.read | Read measurement details |
measurement.list | List measurements |
measurement.cancel | Cancel measurements |
report.create | Create reports |
report.read | Read report results |
report.list | List reports |
metric.create | Create metrics |
metric.read | Read metric results |
metric.invalidate | Invalidate cached metrics |
eventGroup.list | List event groups |
policy.manage | Create and modify policies |
Service Methods
GetPermission
Retrieve a permission by resource name.Permission resource nameFormat:
permissions/{permission}The requested permission resource
PERMISSION_NOT_FOUND- Permission does not exist
ListPermissions
List all available permissions in the system.Maximum number of permissions to returnDefault: 50
Maximum: 100
Token from previous ListPermissions call for pagination
List of permission resources
Token for retrieving the next page (empty if no more pages)
CheckPermissions
Check what permissions a principal has on a specific resource.Name of the resource to check permissions onFormat: Resource-specific (e.g.,
measurementConsumers/{id}/reports/{id})If not specified, checks permissions on the root of the API.Principal to check permissions forFormat:
principals/{principal}Set of permissions to checkExample:
["measurement.create", "measurement.read", "report.create"]Subset of requested permissions that the principal hasEmpty array if principal has none of the requested permissions.
PRINCIPAL_NOT_FOUND- Principal does not existPERMISSION_NOT_FOUND- One or more requested permissions don’t exist
Permission Check Patterns
Pre-request Authorization
Check permissions before making API calls:Batch Permission Check
Check multiple permissions at once:UI Authorization
Determine which UI elements to show:Permission Hierarchy
Permissions can be organized hierarchically:The system does not automatically grant wildcard permissions. Each permission must be explicitly assigned through roles and policies.
Integration with Roles and Policies
Permissions are granted to principals through the role-policy system: Example Policy:Common Permission Sets
Read-Only Access
Report Creator
Measurement Administrator
System Administrator
Best Practices
Check permissions early
Check permissions early
Verify permissions at the start of request handlers before expensive operations. Fail fast if unauthorized.
Use least privilege principle
Use least privilege principle
Grant only the minimum permissions required for each role. Don’t grant admin permissions by default.
Batch permission checks
Batch permission checks
When checking multiple permissions, use a single
CheckPermissions call rather than multiple calls.Cache permission check results
Cache permission check results
Cache CheckPermissions responses for short durations (e.g., 60 seconds) to reduce API calls, but balance with security needs.
Document permission requirements
Document permission requirements
Clearly document which permissions are required for each API operation in your API documentation.
Audit permission checks
Audit permission checks
Log failed permission checks for security monitoring and debugging authorization issues.
Error Handling
One or more requested permissions don’t existResolution: Verify permission names match defined permissions in the system
Principal does not existResolution: Verify principal resource name and ensure principal was created
Invalid resource name format or empty permissions listResolution: Verify request parameters follow correct format
Related APIs
Policies Service
Manage access policies
Principals Service
Manage principals (users and services)
API Overview
Access control architecture