Skip to content

Commit

Permalink
feat(shield): add get resource of a user
Browse files Browse the repository at this point in the history
  • Loading branch information
FemiNoviaLina committed Sep 5, 2024
1 parent 293abec commit 1ed2c9e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
41 changes: 41 additions & 0 deletions gotocompany/shield/v1beta1/public.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
syntax = "proto3";

package gotocompany.shield.v1beta1;

import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/protobuf/struct.proto";

option go_package = "github.com/goto/proton/shield/v1;shieldv1beta1";
option java_outer_classname = "Public";
option java_package = "com.gotocompany.proton.shield.v1beta1";
// These annotations are used when generating the OpenAPI file.
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Public",
version: "0.1.0";
};
schemes: HTTP;
};

service PublicService {
rpc ListResourceOfUser(ListResourceOfUserRequest) returns (ListResourceOfUserResponse) {
option (google.api.http) = {
get: "/v1beta1/users/{user_id}/resources/{namespace}/{type}",
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Public";
summary: "Get Resources with Authorized Principal Access";
};
}
}

message ListResourceOfUserRequest {
string user_id = 1;
string namespace = 2;
string type = 3;
}

message ListResourceOfUserResponse {
google.protobuf.Struct resources = 1;
}
19 changes: 19 additions & 0 deletions gotocompany/shield/v1beta1/shield.proto
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,16 @@ service ShieldService {
};
}

rpc ListResourceOfUserGlobal(ListResourceOfUserGlobalRequest) returns (ListResourceOfUserGlobalResponse) {
option (google.api.http) = {
get: "/v1beta1/users/{user_id}/resources",
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Public";
summary: "Get Resources with Authorized User Access";
};
}

// Authz
rpc CheckResourcePermission(CheckResourcePermissionRequest) returns (CheckResourcePermissionResponse) {
option (google.api.http) = {
Expand Down Expand Up @@ -1115,6 +1125,15 @@ message CheckResourceUserPermissionResponse {
repeated ResourcePermissionResponse resource_permissions = 1;
}

message ListResourceOfUserGlobalRequest {
string user_id = 1;
repeated string types = 2;
}

message ListResourceOfUserGlobalResponse {
repeated google.protobuf.Struct resources = 1;
}

message Activity {
string actor = 1;
string action = 2;
Expand Down

0 comments on commit 1ed2c9e

Please sign in to comment.