Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shield): add get resource of a user #125

Merged
merged 7 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: "Resource";
summary: "Get Resources with Authorized User Access Under a Resource Type";
};
}
}

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) {
FemiNoviaLina marked this conversation as resolved.
Show resolved Hide resolved
option (google.api.http) = {
get: "/v1beta1/users/{user_id}/resources",
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: "Resource";
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 {
google.protobuf.Struct resources = 1;
}

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