From a7a14f2243c1340af4381e00a0ee9401dce7b92e Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 28 Jan 2025 09:51:18 +0530 Subject: [PATCH] feat: add api to list service user projects --- raystack/frontier/v1beta1/frontier.proto | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/raystack/frontier/v1beta1/frontier.proto b/raystack/frontier/v1beta1/frontier.proto index c8c929b1..e6c076db 100644 --- a/raystack/frontier/v1beta1/frontier.proto +++ b/raystack/frontier/v1beta1/frontier.proto @@ -435,6 +435,15 @@ service FrontierService { }; } + rpc ListServiceUserProjects(ListServiceUserProjectRequest) returns (ListServiceUserProjectResponse) { + option (google.api.http) = {get: "/v1beta1/organizations/{org_id}/serviceusers/{id}/projects"}; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "ServiceUser"; + summary: "List service sser projects" + description: "List all projects the service user belongs to"; + }; + } + // Group rpc ListOrganizationGroups(ListOrganizationGroupsRequest) returns (ListOrganizationGroupsResponse) { option (google.api.http) = {get: "/v1beta1/organizations/{org_id}/groups"}; @@ -2941,6 +2950,29 @@ message DeleteServiceUserTokenRequest { message DeleteServiceUserTokenResponse {} +message ListServiceUserProjectRequest { + string id = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The unique ID of the service user to list projects for."}]; + string org_id = 2 [ + (validate.rules).string.min_len = 3, + (google.api.field_behavior) = REQUIRED, + (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {description: "The organization ID to which the service user belongs to."} + ]; + // list of permissions needs to be checked against each project + // query params are set as with_permissions=get&with_permissions=delete + // to be represented as array + repeated string with_permissions = 3; +} + +message ListServiceUserProjectResponse { + repeated Project projects = 1; + + message AccessPair { + string project_id = 1; + repeated string permissions = 2; + } + repeated AccessPair access_pairs = 2; +} + // Organization message ListOrganizationGroupsRequest {