Skip to content

Commit

Permalink
moving BulkCheckPermissions API out of experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
alecmerdler committed Feb 14, 2024
1 parent 1485497 commit 1730b60
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions authzed/api/v1/permission_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ service PermissionsService {
};
}

// BulkCheckPermission accepts a list of permission checks and returns
// the results of those checks in a single response.
rpc BulkCheckPermission(BulkCheckPermissionRequest)
returns (BulkCheckPermissionResponse) {
option (google.api.http) = {
post: "/v1/permissions/bulkcheckpermission"
body: "*"
};
}

// ExpandPermissionTree reveals the graph structure for a resource's
// permission or relation. This RPC does not recurse infinitely deep and may
// require multiple calls to fully unnest a deeply nested graph.
Expand Down Expand Up @@ -349,6 +359,46 @@ message CheckPermissionResponse {
PartialCaveatInfo partial_caveat_info = 3 [ (validate.rules).message.required = false ];
}

message BulkCheckPermissionRequest {
Consistency consistency = 1;

repeated BulkCheckPermissionRequestItem items = 2 [ (validate.rules).repeated .items.message.required = true ];
}

message BulkCheckPermissionRequestItem {
ObjectReference resource = 1 [ (validate.rules).message.required = true ];

string permission = 2 [ (validate.rules).string = {
pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$",
max_bytes : 64,
} ];

SubjectReference subject = 3 [ (validate.rules).message.required = true ];

google.protobuf.Struct context = 4 [ (validate.rules).message.required = false ];
}

message BulkCheckPermissionResponse {
ZedToken checked_at = 1 [ (validate.rules).message.required = false ];

repeated BulkCheckPermissionPair pairs = 2 [ (validate.rules).repeated .items.message.required = true ];
}

message BulkCheckPermissionPair {
BulkCheckPermissionRequestItem request = 1;

oneof response {
BulkCheckPermissionResponseItem item = 2;
google.rpc.Status error = 3;

Check failure on line 392 in authzed/api/v1/permission_service.proto

View workflow job for this annotation

GitHub Actions / Lint

field authzed.api.v1.BulkCheckPermissionPair.error: unknown type google.rpc.Status
}
}

message BulkCheckPermissionResponseItem {
CheckPermissionResponse.Permissionship permissionship = 1 [ (validate.rules).enum = {defined_only: true, not_in: [0]} ];

PartialCaveatInfo partial_caveat_info = 2 [ (validate.rules).message.required = false ];
}

// ExpandPermissionTreeRequest returns a tree representing the expansion of all
// relationships found accessible from a permission or relation on a particular
// resource.
Expand Down

0 comments on commit 1730b60

Please sign in to comment.