From cb3980cb8ce18372c7711f5c4eda964135f7572f Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 5 Feb 2021 14:01:03 -0500 Subject: [PATCH] Remove list:self from main (#915) * Remove list:self from main As per futher discussions, we won't be supporting this, in favor of simply read:self and cancel:self (since listing now already filters out items on which you have no permissions). This doesn't remove list:self entirely from the code base as much of that will simply be converted to read:self and cancel:self -- that will be in a later PR. However, with this removed if we want to release we won't expose an API publicly that isn't going to stick around. --- internal/gen/controller.swagger.json | 42 --- .../api/services/session_service.pb.go | 349 +++++------------- .../api/services/session_service.pb.gw.go | 83 ----- .../api/services/session_service_grpc.pb.go | 44 --- internal/iam/repository_scope.go | 6 - internal/perms/acl.go | 5 +- internal/perms/grants_test.go | 3 +- .../api/services/v1/session_service.proto | 22 -- internal/servers/controller/handler_test.go | 1 - .../handlers/scopes/scope_service_test.go | 1 - .../handlers/sessions/session_service.go | 48 +-- .../handlers/sessions/session_service_test.go | 145 -------- internal/types/action/action.go | 5 +- internal/types/action/action_test.go | 4 - internal/website/permstable/permstable.go | 7 - .../docs/concepts/security/permissions.mdx | 6 - 16 files changed, 108 insertions(+), 663 deletions(-) diff --git a/internal/gen/controller.swagger.json b/internal/gen/controller.swagger.json index e588c90ba..d0c4f2d6e 100644 --- a/internal/gen/controller.swagger.json +++ b/internal/gen/controller.swagger.json @@ -1833,37 +1833,6 @@ ] } }, - "/v1/sessions:list:self": { - "get": { - "summary": "Lists all Sessions owned by the requester.", - "operationId": "SessionService_ListSelfSessions", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/controller.api.services.v1.ListSelfSessionsResponse" - } - } - }, - "parameters": [ - { - "name": "scope_id", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "recursive", - "in": "query", - "required": false, - "type": "boolean" - } - ], - "tags": [ - "controller.api.services.v1.SessionService" - ] - } - }, "/v1/targets": { "get": { "summary": "Lists all Targets.", @@ -4141,17 +4110,6 @@ } } }, - "controller.api.services.v1.ListSelfSessionsResponse": { - "type": "object", - "properties": { - "items": { - "type": "array", - "items": { - "$ref": "#/definitions/controller.api.resources.sessions.v1.Session" - } - } - } - }, "controller.api.services.v1.ListSessionsResponse": { "type": "object", "properties": { diff --git a/internal/gen/controller/api/services/session_service.pb.go b/internal/gen/controller/api/services/session_service.pb.go index 004907e90..559cb1a82 100644 --- a/internal/gen/controller/api/services/session_service.pb.go +++ b/internal/gen/controller/api/services/session_service.pb.go @@ -118,108 +118,6 @@ func (x *GetSessionResponse) GetItem() *sessions.Session { return nil } -type ListSelfSessionsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty"` - Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"` -} - -func (x *ListSelfSessionsRequest) Reset() { - *x = ListSelfSessionsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListSelfSessionsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListSelfSessionsRequest) ProtoMessage() {} - -func (x *ListSelfSessionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListSelfSessionsRequest.ProtoReflect.Descriptor instead. -func (*ListSelfSessionsRequest) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{2} -} - -func (x *ListSelfSessionsRequest) GetScopeId() string { - if x != nil { - return x.ScopeId - } - return "" -} - -func (x *ListSelfSessionsRequest) GetRecursive() bool { - if x != nil { - return x.Recursive - } - return false -} - -type ListSelfSessionsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Items []*sessions.Session `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"` -} - -func (x *ListSelfSessionsResponse) Reset() { - *x = ListSelfSessionsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListSelfSessionsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ListSelfSessionsResponse) ProtoMessage() {} - -func (x *ListSelfSessionsResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ListSelfSessionsResponse.ProtoReflect.Descriptor instead. -func (*ListSelfSessionsResponse) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{3} -} - -func (x *ListSelfSessionsResponse) GetItems() []*sessions.Session { - if x != nil { - return x.Items - } - return nil -} - type ListSessionsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -232,7 +130,7 @@ type ListSessionsRequest struct { func (x *ListSessionsRequest) Reset() { *x = ListSessionsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -245,7 +143,7 @@ func (x *ListSessionsRequest) String() string { func (*ListSessionsRequest) ProtoMessage() {} func (x *ListSessionsRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -258,7 +156,7 @@ func (x *ListSessionsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSessionsRequest.ProtoReflect.Descriptor instead. func (*ListSessionsRequest) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{4} + return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{2} } func (x *ListSessionsRequest) GetScopeId() string { @@ -286,7 +184,7 @@ type ListSessionsResponse struct { func (x *ListSessionsResponse) Reset() { *x = ListSessionsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -299,7 +197,7 @@ func (x *ListSessionsResponse) String() string { func (*ListSessionsResponse) ProtoMessage() {} func (x *ListSessionsResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -312,7 +210,7 @@ func (x *ListSessionsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ListSessionsResponse.ProtoReflect.Descriptor instead. func (*ListSessionsResponse) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{5} + return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{3} } func (x *ListSessionsResponse) GetItems() []*sessions.Session { @@ -334,7 +232,7 @@ type CancelSessionRequest struct { func (x *CancelSessionRequest) Reset() { *x = CancelSessionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[6] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -347,7 +245,7 @@ func (x *CancelSessionRequest) String() string { func (*CancelSessionRequest) ProtoMessage() {} func (x *CancelSessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[6] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -360,7 +258,7 @@ func (x *CancelSessionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CancelSessionRequest.ProtoReflect.Descriptor instead. func (*CancelSessionRequest) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{6} + return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{4} } func (x *CancelSessionRequest) GetId() string { @@ -388,7 +286,7 @@ type CancelSessionResponse struct { func (x *CancelSessionResponse) Reset() { *x = CancelSessionResponse{} if protoimpl.UnsafeEnabled { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[7] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -401,7 +299,7 @@ func (x *CancelSessionResponse) String() string { func (*CancelSessionResponse) ProtoMessage() {} func (x *CancelSessionResponse) ProtoReflect() protoreflect.Message { - mi := &file_controller_api_services_v1_session_service_proto_msgTypes[7] + mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -414,7 +312,7 @@ func (x *CancelSessionResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CancelSessionResponse.ProtoReflect.Descriptor instead. func (*CancelSessionResponse) Descriptor() ([]byte, []int) { - return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{7} + return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{5} } func (x *CancelSessionResponse) GetItem() *sessions.Session { @@ -450,90 +348,66 @@ var file_controller_api_services_v1_session_service_proto_rawDesc = []byte{ 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x22, 0x52, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, - 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, - 0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, - 0x73, 0x69, 0x76, 0x65, 0x22, 0x5f, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x43, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05, - 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x4e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, - 0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x73, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, - 0x73, 0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, - 0x72, 0x73, 0x69, 0x76, 0x65, 0x22, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, - 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x69, 0x74, 0x65, - 0x6d, 0x73, 0x22, 0x40, 0x0a, 0x14, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x15, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, - 0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x32, 0xe4, 0x05, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0xa7, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, - 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, - 0x65, 0x6d, 0x92, 0x41, 0x18, 0x12, 0x16, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, - 0x6e, 0x67, 0x6c, 0x65, 0x20, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x12, 0x9f, 0x01, - 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2f, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x73, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x92, 0x41, 0x15, 0x12, 0x13, 0x4c, 0x69, 0x73, 0x74, - 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x12, - 0xcc, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, - 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74, + 0x22, 0x4e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65, + 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18, + 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, + 0x22, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, + 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x40, 0x0a, + 0x14, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, + 0x5a, 0x0a, 0x15, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0x95, 0x04, 0x0a, 0x0e, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa7, + 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x2e, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, + 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x19, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x18, + 0x12, 0x16, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x12, 0x9f, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73, + 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x4d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x73, 0x65, 0x6c, 0x66, 0x92, - 0x41, 0x2c, 0x12, 0x2a, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x65, - 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20, - 0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x12, 0xb6, - 0x01, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, - 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x18, 0x2f, - 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, - 0x3a, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, - 0x92, 0x41, 0x14, 0x12, 0x12, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x73, 0x20, 0x61, 0x20, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, - 0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x6e, + 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, + 0x6e, 0x73, 0x92, 0x41, 0x15, 0x12, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, + 0x20, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x12, 0xb6, 0x01, 0x0a, 0x0d, 0x43, + 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x63, + 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, + 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, + 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x63, + 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x73, + 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x63, 0x61, 0x6e, + 0x63, 0x65, 0x6c, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x14, 0x12, + 0x12, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x73, 0x20, 0x61, 0x20, 0x53, 0x65, 0x73, 0x73, 0x69, + 0x6f, 0x6e, 0x2e, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e, + 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65, + 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -548,36 +422,31 @@ func file_controller_api_services_v1_session_service_proto_rawDescGZIP() []byte return file_controller_api_services_v1_session_service_proto_rawDescData } -var file_controller_api_services_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_controller_api_services_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_controller_api_services_v1_session_service_proto_goTypes = []interface{}{ - (*GetSessionRequest)(nil), // 0: controller.api.services.v1.GetSessionRequest - (*GetSessionResponse)(nil), // 1: controller.api.services.v1.GetSessionResponse - (*ListSelfSessionsRequest)(nil), // 2: controller.api.services.v1.ListSelfSessionsRequest - (*ListSelfSessionsResponse)(nil), // 3: controller.api.services.v1.ListSelfSessionsResponse - (*ListSessionsRequest)(nil), // 4: controller.api.services.v1.ListSessionsRequest - (*ListSessionsResponse)(nil), // 5: controller.api.services.v1.ListSessionsResponse - (*CancelSessionRequest)(nil), // 6: controller.api.services.v1.CancelSessionRequest - (*CancelSessionResponse)(nil), // 7: controller.api.services.v1.CancelSessionResponse - (*sessions.Session)(nil), // 8: controller.api.resources.sessions.v1.Session + (*GetSessionRequest)(nil), // 0: controller.api.services.v1.GetSessionRequest + (*GetSessionResponse)(nil), // 1: controller.api.services.v1.GetSessionResponse + (*ListSessionsRequest)(nil), // 2: controller.api.services.v1.ListSessionsRequest + (*ListSessionsResponse)(nil), // 3: controller.api.services.v1.ListSessionsResponse + (*CancelSessionRequest)(nil), // 4: controller.api.services.v1.CancelSessionRequest + (*CancelSessionResponse)(nil), // 5: controller.api.services.v1.CancelSessionResponse + (*sessions.Session)(nil), // 6: controller.api.resources.sessions.v1.Session } var file_controller_api_services_v1_session_service_proto_depIdxs = []int32{ - 8, // 0: controller.api.services.v1.GetSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session - 8, // 1: controller.api.services.v1.ListSelfSessionsResponse.items:type_name -> controller.api.resources.sessions.v1.Session - 8, // 2: controller.api.services.v1.ListSessionsResponse.items:type_name -> controller.api.resources.sessions.v1.Session - 8, // 3: controller.api.services.v1.CancelSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session - 0, // 4: controller.api.services.v1.SessionService.GetSession:input_type -> controller.api.services.v1.GetSessionRequest - 4, // 5: controller.api.services.v1.SessionService.ListSessions:input_type -> controller.api.services.v1.ListSessionsRequest - 2, // 6: controller.api.services.v1.SessionService.ListSelfSessions:input_type -> controller.api.services.v1.ListSelfSessionsRequest - 6, // 7: controller.api.services.v1.SessionService.CancelSession:input_type -> controller.api.services.v1.CancelSessionRequest - 1, // 8: controller.api.services.v1.SessionService.GetSession:output_type -> controller.api.services.v1.GetSessionResponse - 5, // 9: controller.api.services.v1.SessionService.ListSessions:output_type -> controller.api.services.v1.ListSessionsResponse - 3, // 10: controller.api.services.v1.SessionService.ListSelfSessions:output_type -> controller.api.services.v1.ListSelfSessionsResponse - 7, // 11: controller.api.services.v1.SessionService.CancelSession:output_type -> controller.api.services.v1.CancelSessionResponse - 8, // [8:12] is the sub-list for method output_type - 4, // [4:8] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 6, // 0: controller.api.services.v1.GetSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session + 6, // 1: controller.api.services.v1.ListSessionsResponse.items:type_name -> controller.api.resources.sessions.v1.Session + 6, // 2: controller.api.services.v1.CancelSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session + 0, // 3: controller.api.services.v1.SessionService.GetSession:input_type -> controller.api.services.v1.GetSessionRequest + 2, // 4: controller.api.services.v1.SessionService.ListSessions:input_type -> controller.api.services.v1.ListSessionsRequest + 4, // 5: controller.api.services.v1.SessionService.CancelSession:input_type -> controller.api.services.v1.CancelSessionRequest + 1, // 6: controller.api.services.v1.SessionService.GetSession:output_type -> controller.api.services.v1.GetSessionResponse + 3, // 7: controller.api.services.v1.SessionService.ListSessions:output_type -> controller.api.services.v1.ListSessionsResponse + 5, // 8: controller.api.services.v1.SessionService.CancelSession:output_type -> controller.api.services.v1.CancelSessionResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_controller_api_services_v1_session_service_proto_init() } @@ -611,30 +480,6 @@ func file_controller_api_services_v1_session_service_proto_init() { } } file_controller_api_services_v1_session_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSelfSessionsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_controller_api_services_v1_session_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListSelfSessionsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_controller_api_services_v1_session_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListSessionsRequest); i { case 0: return &v.state @@ -646,7 +491,7 @@ func file_controller_api_services_v1_session_service_proto_init() { return nil } } - file_controller_api_services_v1_session_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_controller_api_services_v1_session_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ListSessionsResponse); i { case 0: return &v.state @@ -658,7 +503,7 @@ func file_controller_api_services_v1_session_service_proto_init() { return nil } } - file_controller_api_services_v1_session_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_controller_api_services_v1_session_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CancelSessionRequest); i { case 0: return &v.state @@ -670,7 +515,7 @@ func file_controller_api_services_v1_session_service_proto_init() { return nil } } - file_controller_api_services_v1_session_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_controller_api_services_v1_session_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CancelSessionResponse); i { case 0: return &v.state @@ -689,7 +534,7 @@ func file_controller_api_services_v1_session_service_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_controller_api_services_v1_session_service_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/internal/gen/controller/api/services/session_service.pb.gw.go b/internal/gen/controller/api/services/session_service.pb.gw.go index a011d7dd1..256c211cc 100644 --- a/internal/gen/controller/api/services/session_service.pb.gw.go +++ b/internal/gen/controller/api/services/session_service.pb.gw.go @@ -119,42 +119,6 @@ func local_request_SessionService_ListSessions_0(ctx context.Context, marshaler } -var ( - filter_SessionService_ListSelfSessions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_SessionService_ListSelfSessions_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListSelfSessionsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SessionService_ListSelfSessions_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.ListSelfSessions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_SessionService_ListSelfSessions_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ListSelfSessionsRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SessionService_ListSelfSessions_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.ListSelfSessions(ctx, &protoReq) - return msg, metadata, err - -} - func request_SessionService_CancelSession_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq CancelSessionRequest var metadata runtime.ServerMetadata @@ -275,29 +239,6 @@ func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.Serve }) - mux.Handle("GET", pattern_SessionService_ListSelfSessions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSelfSessions") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_SessionService_ListSelfSessions_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SessionService_ListSelfSessions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("POST", pattern_SessionService_CancelSession_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -402,26 +343,6 @@ func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.Serve }) - mux.Handle("GET", pattern_SessionService_ListSelfSessions_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSelfSessions") - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_SessionService_ListSelfSessions_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_SessionService_ListSelfSessions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("POST", pattern_SessionService_CancelSession_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -468,8 +389,6 @@ var ( pattern_SessionService_ListSessions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "sessions"}, "")) - pattern_SessionService_ListSelfSessions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "sessions:list"}, "self")) - pattern_SessionService_CancelSession_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "sessions", "id"}, "cancel")) ) @@ -478,7 +397,5 @@ var ( forward_SessionService_ListSessions_0 = runtime.ForwardResponseMessage - forward_SessionService_ListSelfSessions_0 = runtime.ForwardResponseMessage - forward_SessionService_CancelSession_0 = runtime.ForwardResponseMessage ) diff --git a/internal/gen/controller/api/services/session_service_grpc.pb.go b/internal/gen/controller/api/services/session_service_grpc.pb.go index 00dbdbcae..f0cc6e1fe 100644 --- a/internal/gen/controller/api/services/session_service_grpc.pb.go +++ b/internal/gen/controller/api/services/session_service_grpc.pb.go @@ -27,11 +27,6 @@ type SessionServiceClient interface { // the Sessions being retrieved. If the scope ID is missing, malformed, or // reference a non existing scope, an error is returned. ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error) - // ListSelfSessions returns a list of stored Sessions for the requester. - // The request must include the scope ID for the Sessions being retrieved. - // If the scope ID is missing, malformed, or reference a non existing scope, - // an error is returned. - ListSelfSessions(ctx context.Context, in *ListSelfSessionsRequest, opts ...grpc.CallOption) (*ListSelfSessionsResponse, error) // CancelSession cancels an existing Session in boundary. An error // is returned if the request attempts to cancel a Session that does // not exist. @@ -64,15 +59,6 @@ func (c *sessionServiceClient) ListSessions(ctx context.Context, in *ListSession return out, nil } -func (c *sessionServiceClient) ListSelfSessions(ctx context.Context, in *ListSelfSessionsRequest, opts ...grpc.CallOption) (*ListSelfSessionsResponse, error) { - out := new(ListSelfSessionsResponse) - err := c.cc.Invoke(ctx, "/controller.api.services.v1.SessionService/ListSelfSessions", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *sessionServiceClient) CancelSession(ctx context.Context, in *CancelSessionRequest, opts ...grpc.CallOption) (*CancelSessionResponse, error) { out := new(CancelSessionResponse) err := c.cc.Invoke(ctx, "/controller.api.services.v1.SessionService/CancelSession", in, out, opts...) @@ -96,11 +82,6 @@ type SessionServiceServer interface { // the Sessions being retrieved. If the scope ID is missing, malformed, or // reference a non existing scope, an error is returned. ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error) - // ListSelfSessions returns a list of stored Sessions for the requester. - // The request must include the scope ID for the Sessions being retrieved. - // If the scope ID is missing, malformed, or reference a non existing scope, - // an error is returned. - ListSelfSessions(context.Context, *ListSelfSessionsRequest) (*ListSelfSessionsResponse, error) // CancelSession cancels an existing Session in boundary. An error // is returned if the request attempts to cancel a Session that does // not exist. @@ -118,9 +99,6 @@ func (UnimplementedSessionServiceServer) GetSession(context.Context, *GetSession func (UnimplementedSessionServiceServer) ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListSessions not implemented") } -func (UnimplementedSessionServiceServer) ListSelfSessions(context.Context, *ListSelfSessionsRequest) (*ListSelfSessionsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListSelfSessions not implemented") -} func (UnimplementedSessionServiceServer) CancelSession(context.Context, *CancelSessionRequest) (*CancelSessionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CancelSession not implemented") } @@ -173,24 +151,6 @@ func _SessionService_ListSessions_Handler(srv interface{}, ctx context.Context, return interceptor(ctx, in, info, handler) } -func _SessionService_ListSelfSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListSelfSessionsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(SessionServiceServer).ListSelfSessions(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/controller.api.services.v1.SessionService/ListSelfSessions", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SessionServiceServer).ListSelfSessions(ctx, req.(*ListSelfSessionsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _SessionService_CancelSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(CancelSessionRequest) if err := dec(in); err != nil { @@ -221,10 +181,6 @@ var _SessionService_serviceDesc = grpc.ServiceDesc{ MethodName: "ListSessions", Handler: _SessionService_ListSessions_Handler, }, - { - MethodName: "ListSelfSessions", - Handler: _SessionService_ListSelfSessions_Handler, - }, { MethodName: "CancelSession", Handler: _SessionService_CancelSession_Handler, diff --git a/internal/iam/repository_scope.go b/internal/iam/repository_scope.go index 6397516e6..ddcd659f5 100644 --- a/internal/iam/repository_scope.go +++ b/internal/iam/repository_scope.go @@ -286,12 +286,6 @@ func (r *Repository) CreateScope(ctx context.Context, s *Scope, userId string, o } grants = append(grants, roleGrant) - roleGrant, err = NewRoleGrant(defaultRolePublicId, "id=*;type=scope;actions=list:self") - if err != nil { - return errors.Wrap(err, op, errors.WithMsg("unable to create in memory role grant")) - } - grants = append(grants, roleGrant) - roleGrant, err = NewRoleGrant(defaultRolePublicId, "id=*;type=auth-method;actions=authenticate,list") if err != nil { return errors.Wrap(err, op, errors.WithMsg("unable to create in memory role grant")) diff --git a/internal/perms/acl.go b/internal/perms/acl.go index bee2805df..59081e940 100644 --- a/internal/perms/acl.go +++ b/internal/perms/acl.go @@ -84,8 +84,8 @@ func (a ACL) Allowed(r Resource, aType action.Type) (results ACLResults) { // We have this action case grant.actions[parentAction]: // We don't have this action, but it's a subaction and we have the - // parent action. As an example, if we are looking for "list:self" - // and have "list", this is sufficient. + // parent action. As an example, if we are looking for "read:self" + // and have "read", this is sufficient. case grant.actions[action.All]: // All actions are allowed default: @@ -114,7 +114,6 @@ func (a ACL) Allowed(r Resource, aType action.Type) (results ACLResults) { grant.typ != resource.Unknown && topLevelType(r.Type) && (aType == action.List || - aType == action.ListSelf || aType == action.Create): results.Allowed = true diff --git a/internal/perms/grants_test.go b/internal/perms/grants_test.go index 2d9a6aeec..644ef080b 100644 --- a/internal/perms/grants_test.go +++ b/internal/perms/grants_test.go @@ -60,7 +60,7 @@ func Test_ActionParsingValidation(t *testing.T) { { name: "all valid", input: Grant{ - actionsBeingParsed: []string{"list", "create", "update", "list:self", "read", "delete", "authenticate", "authorize-session"}, + actionsBeingParsed: []string{"list", "create", "update", "read", "delete", "authenticate", "authorize-session"}, }, result: Grant{ actions: map[action.Type]bool{ @@ -71,7 +71,6 @@ func Test_ActionParsingValidation(t *testing.T) { action.Delete: true, action.Authenticate: true, action.AuthorizeSession: true, - action.ListSelf: true, }, }, }, diff --git a/internal/proto/local/controller/api/services/v1/session_service.proto b/internal/proto/local/controller/api/services/v1/session_service.proto index fb075238d..25c912ab3 100644 --- a/internal/proto/local/controller/api/services/v1/session_service.proto +++ b/internal/proto/local/controller/api/services/v1/session_service.proto @@ -37,19 +37,6 @@ service SessionService { }; } - // ListSelfSessions returns a list of stored Sessions for the requester. - // The request must include the scope ID for the Sessions being retrieved. - // If the scope ID is missing, malformed, or reference a non existing scope, - // an error is returned. - rpc ListSelfSessions(ListSelfSessionsRequest) returns (ListSelfSessionsResponse) { - option (google.api.http) = { - get: "/v1/sessions:list:self" - }; - option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { - summary: "Lists all Sessions owned by the requester." - }; - } - // CancelSession cancels an existing Session in boundary. An error // is returned if the request attempts to cancel a Session that does // not exist. @@ -73,15 +60,6 @@ message GetSessionResponse { resources.sessions.v1.Session item = 1; } -message ListSelfSessionsRequest { - string scope_id = 1; - bool recursive = 20 [json_name="recursive"]; -} - -message ListSelfSessionsResponse { - repeated resources.sessions.v1.Session items = 1; -} - message ListSessionsRequest { string scope_id = 1; bool recursive = 20 [json_name="recursive"]; diff --git a/internal/servers/controller/handler_test.go b/internal/servers/controller/handler_test.go index 9b2bc5f18..7379dff65 100644 --- a/internal/servers/controller/handler_test.go +++ b/internal/servers/controller/handler_test.go @@ -114,7 +114,6 @@ func TestHandleImplementedPaths(t *testing.T) { "200_v1/scopes", "v1/scopes/someid", "v1/sessions", - "v1/sessions:list:self", "v1/sessions/someid", "v1/targets", "v1/targets/someid", diff --git a/internal/servers/controller/handlers/scopes/scope_service_test.go b/internal/servers/controller/handlers/scopes/scope_service_test.go index 200f73e69..5069ba52b 100644 --- a/internal/servers/controller/handlers/scopes/scope_service_test.go +++ b/internal/servers/controller/handlers/scopes/scope_service_test.go @@ -89,7 +89,6 @@ var orgAuthorizedCollectionActions = map[string]*structpb.ListValue{ "sessions": { Values: []*structpb.Value{ structpb.NewStringValue("list"), - structpb.NewStringValue("list:self"), }, }, "users": { diff --git a/internal/servers/controller/handlers/sessions/session_service.go b/internal/servers/controller/handlers/sessions/session_service.go index 192ccfced..e29ab422f 100644 --- a/internal/servers/controller/handlers/sessions/session_service.go +++ b/internal/servers/controller/handlers/sessions/session_service.go @@ -32,7 +32,6 @@ var ( // this collection CollectionActions = action.ActionSet{ action.List, - action.ListSelf, } ) @@ -80,39 +79,17 @@ func (s Service) ListSessions(ctx context.Context, req *pbs.ListSessionsRequest) if err := validateListRequest(req); err != nil { return nil, err } - sl, err := s.listSessions(ctx, action.List, req.GetScopeId(), req.GetRecursive()) - if err != nil { - return nil, err - } - return &pbs.ListSessionsResponse{Items: sl}, nil -} -// ListSelfSessions implements the interface pbs.SessionServiceServer. -func (s Service) ListSelfSessions(ctx context.Context, req *pbs.ListSelfSessionsRequest) (*pbs.ListSelfSessionsResponse, error) { - if err := validateListSelfRequest(req); err != nil { - return nil, err - } - sl, err := s.listSessions(ctx, action.ListSelf, req.GetScopeId(), req.GetRecursive()) - if err != nil { - return nil, err - } - return &pbs.ListSelfSessionsResponse{Items: sl}, nil -} - -func (s Service) listSessions(ctx context.Context, a action.Type, scopeId string, recursive bool) ([]*pb.Session, error) { - authResults := s.authResult(ctx, scopeId, a) + authResults := s.authResult(ctx, req.GetScopeId(), action.List) if authResults.Error != nil { return nil, authResults.Error } - scopeIds, scopeInfoMap, err := scopeids.GetScopeIds(ctx, s.iamRepoFn, authResults, scopeId, recursive) + scopeIds, scopeInfoMap, err := scopeids.GetScopeIds(ctx, s.iamRepoFn, authResults, req.GetScopeId(), req.GetRecursive()) if err != nil { return nil, err } - opts := []session.Option{session.WithScopeIds(scopeIds)} - if a == action.ListSelf { - opts = append(opts, session.WithUserId(authResults.UserId)) - } - seslist, err := s.listFromRepo(ctx, opts...) + + seslist, err := s.listFromRepo(ctx, session.WithScopeIds(scopeIds)) if err != nil { return nil, err } @@ -129,7 +106,8 @@ func (s Service) listSessions(ctx context.Context, a action.Type, scopeId string finalItems = append(finalItems, item) } } - return finalItems, err + + return &pbs.ListSessionsResponse{Items: finalItems}, nil } // CancelSession implements the interface pbs.SessionServiceServer. @@ -202,7 +180,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth. var parentId string opts := []auth.Option{auth.WithType(resource.Session), auth.WithAction(a)} switch a { - case action.List, action.ListSelf: + case action.List: parentId = id iamRepo, err := s.iamRepoFn() if err != nil { @@ -302,18 +280,6 @@ func validateListRequest(req *pbs.ListSessionsRequest) error { return nil } -func validateListSelfRequest(req *pbs.ListSelfSessionsRequest) error { - badFields := map[string]string{} - if !handlers.ValidId(scope.Project.Prefix(), req.GetScopeId()) && - !req.GetRecursive() { - badFields["scope_id"] = "This field must be a valid project scope ID or the list operation must be recursive." - } - if len(badFields) > 0 { - return handlers.InvalidArgumentErrorf("Improperly formatted identifier.", badFields) - } - return nil -} - func validateCancelRequest(req *pbs.CancelSessionRequest) error { badFields := map[string]string{} if !handlers.ValidId(session.SessionPrefix, req.GetId()) { diff --git a/internal/servers/controller/handlers/sessions/session_service_test.go b/internal/servers/controller/handlers/sessions/session_service_test.go index d044e6cde..edee282ed 100644 --- a/internal/servers/controller/handlers/sessions/session_service_test.go +++ b/internal/servers/controller/handlers/sessions/session_service_test.go @@ -292,151 +292,6 @@ func TestList(t *testing.T) { } } -func TestListSelf(t *testing.T) { - conn, _ := db.TestSetup(t, "postgres") - wrap := db.TestWrapper(t) - kms := kms.TestKms(t, conn, wrap) - - iamRepo := iam.TestRepo(t, conn, wrap) - - rw := db.New(conn) - sessRepo, err := session.NewRepository(rw, rw, kms) - require.NoError(t, err) - - iamRepoFn := func() (*iam.Repository, error) { - return iamRepo, nil - } - sessRepoFn := func() (*session.Repository, error) { - return sessRepo, nil - } - - _, pNoSessions := iam.TestScopes(t, iamRepo) - o, pWithSessions := iam.TestScopes(t, iamRepo) - - at1 := authtoken.TestAuthToken(t, conn, kms, o.GetPublicId()) - hc := static.TestCatalogs(t, conn, pWithSessions.GetPublicId(), 1)[0] - hs := static.TestSets(t, conn, hc.GetPublicId(), 1)[0] - h := static.TestHosts(t, conn, hc.GetPublicId(), 1)[0] - static.TestSetMembers(t, conn, hs.GetPublicId(), []*static.Host{h}) - tar := target.TestTcpTarget(t, conn, pWithSessions.GetPublicId(), "test", target.WithHostSets([]string{hs.GetPublicId()})) - - var wantSession []*pb.Session - for i := 0; i < 10; i++ { - sess := session.TestSession(t, conn, wrap, session.ComposedOf{ - UserId: at1.GetIamUserId(), - HostId: h.GetPublicId(), - TargetId: tar.GetPublicId(), - HostSetId: hs.GetPublicId(), - AuthTokenId: at1.GetPublicId(), - ScopeId: pWithSessions.GetPublicId(), - Endpoint: "tcp://127.0.0.1:22", - }) - - status, states := convertStates(sess.States) - - wantSession = append(wantSession, &pb.Session{ - Id: sess.GetPublicId(), - ScopeId: pWithSessions.GetPublicId(), - AuthTokenId: sess.AuthTokenId, - UserId: sess.UserId, - TargetId: sess.TargetId, - Endpoint: sess.Endpoint, - HostSetId: sess.HostSetId, - HostId: sess.HostId, - Version: sess.Version, - UpdatedTime: sess.UpdateTime.GetTimestamp(), - CreatedTime: sess.CreateTime.GetTimestamp(), - ExpirationTime: sess.ExpirationTime.GetTimestamp(), - Scope: &scopes.ScopeInfo{Id: pWithSessions.GetPublicId(), Type: scope.Project.String()}, - Status: status, - States: states, - Certificate: sess.Certificate, - Type: target.TcpSubType.String(), - AuthorizedActions: []string{"read", "cancel"}, - }) - } - - at2 := authtoken.TestAuthToken(t, conn, kms, o.GetPublicId()) - sess := session.TestSession(t, conn, wrap, session.ComposedOf{ - UserId: at2.GetIamUserId(), - HostId: h.GetPublicId(), - TargetId: tar.GetPublicId(), - HostSetId: hs.GetPublicId(), - AuthTokenId: at2.GetPublicId(), - ScopeId: pWithSessions.GetPublicId(), - Endpoint: "tcp://127.0.0.1:22", - }) - status, states := convertStates(sess.States) - wantSession2 := []*pb.Session{{ - Id: sess.GetPublicId(), - ScopeId: pWithSessions.GetPublicId(), - AuthTokenId: sess.AuthTokenId, - UserId: sess.UserId, - TargetId: sess.TargetId, - Endpoint: sess.Endpoint, - HostSetId: sess.HostSetId, - HostId: sess.HostId, - Version: sess.Version, - UpdatedTime: sess.UpdateTime.GetTimestamp(), - CreatedTime: sess.CreateTime.GetTimestamp(), - ExpirationTime: sess.ExpirationTime.GetTimestamp(), - Scope: &scopes.ScopeInfo{Id: pWithSessions.GetPublicId(), Type: scope.Project.String()}, - Status: status, - States: states, - Certificate: sess.Certificate, - Type: target.TcpSubType.String(), - AuthorizedActions: []string{"read", "cancel"}, - }} - - cases := []struct { - name string - userId string - req *pbs.ListSelfSessionsRequest - res *pbs.ListSelfSessionsResponse - err error - }{ - { - name: "List Many Sessions", - userId: at1.GetIamUserId(), - req: &pbs.ListSelfSessionsRequest{ScopeId: pWithSessions.GetPublicId()}, - res: &pbs.ListSelfSessionsResponse{Items: wantSession}, - }, - { - name: "List 1 Session", - userId: at2.GetIamUserId(), - req: &pbs.ListSelfSessionsRequest{ScopeId: pWithSessions.GetPublicId()}, - res: &pbs.ListSelfSessionsResponse{Items: wantSession2}, - }, - { - name: "List No Sessions", - userId: at1.GetIamUserId(), - req: &pbs.ListSelfSessionsRequest{ScopeId: pNoSessions.GetPublicId()}, - res: &pbs.ListSelfSessionsResponse{}, - }, - } - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - s, err := sessions.NewService(sessRepoFn, iamRepoFn) - require.NoError(t, err, "Couldn't create new session service.") - - got, gErr := s.ListSelfSessions(auth.DisabledAuthTestContext(auth.WithScopeId(tc.req.GetScopeId()), auth.WithUserId(tc.userId)), tc.req) - if tc.err != nil { - require.Error(t, gErr) - assert.True(t, errors.Is(gErr, tc.err), "ListSelfSessions(%+v) got error %v, wanted %v", tc.req, gErr, tc.err) - } - require.NoError(t, gErr) - if tc.res != nil { - require.Len(t, got.GetItems(), len(tc.res.GetItems())) - for i, wantSess := range tc.res.GetItems() { - assert.True(t, got.GetItems()[i].GetExpirationTime().AsTime().Sub(wantSess.GetExpirationTime().AsTime()) < 10*time.Millisecond) - wantSess.ExpirationTime = got.GetItems()[i].GetExpirationTime() - } - } - assert.Empty(t, cmp.Diff(got, tc.res, protocmp.Transform()), "ListSessions(%q) got response %q, wanted %q", tc.req, got, tc.res) - }) - } -} - func convertStates(in []*session.State) (string, []*pb.SessionState) { out := make([]*pb.SessionState, 0, len(in)) for _, s := range in { diff --git a/internal/types/action/action.go b/internal/types/action/action.go index 170a25f41..7cf8a8547 100644 --- a/internal/types/action/action.go +++ b/internal/types/action/action.go @@ -38,8 +38,7 @@ const ( SetAccounts Type = 29 RemoveAccounts Type = 30 ReadSelf Type = 31 - ListSelf Type = 32 - CancelSelf Type = 33 + CancelSelf Type = 32 ) var Map = map[string]Type{ @@ -74,7 +73,6 @@ var Map = map[string]Type{ SetAccounts.String(): SetAccounts, RemoveAccounts.String(): RemoveAccounts, ReadSelf.String(): ReadSelf, - ListSelf.String(): ListSelf, CancelSelf.String(): CancelSelf, } @@ -112,7 +110,6 @@ func (a Type) String() string { "set-accounts", "remove-accounts", "read:self", - "list:self", "cancel:self", }[a] } diff --git a/internal/types/action/action_test.go b/internal/types/action/action_test.go index bbb8f6fff..14ebe0088 100644 --- a/internal/types/action/action_test.go +++ b/internal/types/action/action_test.go @@ -83,10 +83,6 @@ func TestAction(t *testing.T) { action: CancelSelf, want: "cancel:self", }, - { - action: ListSelf, - want: "list:self", - }, } for _, tt := range tests { t.Run(tt.want, func(t *testing.T) { diff --git a/internal/website/permstable/permstable.go b/internal/website/permstable/permstable.go index dfc989cd8..9c72eff12 100644 --- a/internal/website/permstable/permstable.go +++ b/internal/website/permstable/permstable.go @@ -694,13 +694,6 @@ var session = &Resource{ "id=*;type=session;actions=read:self", }, }, - { - Name: "list:self", - Description: "List sessions that belong to the calling user", - Examples: []string{ - "type=session;actions=list:self", - }, - }, { Name: "cancel:self", Description: "Cancel a session, which must belong to the calling user", diff --git a/website/content/docs/concepts/security/permissions.mdx b/website/content/docs/concepts/security/permissions.mdx index 6fcc291b3..795fe9e32 100644 --- a/website/content/docs/concepts/security/permissions.mdx +++ b/website/content/docs/concepts/security/permissions.mdx @@ -1101,12 +1101,6 @@ wildcard or templated grant strings. -
  • - list:self: List sessions that belong to the calling user -
  • -
  • cancel:self: Cancel a session, which must belong to the calling user