diff --git a/pkg/model/project.pb.go b/pkg/model/project.pb.go index b9f9492e86..f61260e8ab 100644 --- a/pkg/model/project.pb.go +++ b/pkg/model/project.pb.go @@ -88,6 +88,125 @@ func (ProjectSSOConfig_Provider) EnumDescriptor() ([]byte, []int) { return file_pkg_model_project_proto_rawDescGZIP(), []int{2, 0} } +type ProjectRBACResource_ResourceType int32 + +const ( + ProjectRBACResource_APPLICATION ProjectRBACResource_ResourceType = 0 + ProjectRBACResource_DEPLOYMENT ProjectRBACResource_ResourceType = 1 + ProjectRBACResource_EVENT ProjectRBACResource_ResourceType = 2 + ProjectRBACResource_PIPED ProjectRBACResource_ResourceType = 3 + ProjectRBACResource_DEPLOYMENT_CHAIN ProjectRBACResource_ResourceType = 4 + ProjectRBACResource_PROJECT ProjectRBACResource_ResourceType = 5 + ProjectRBACResource_API_KEY ProjectRBACResource_ResourceType = 6 + ProjectRBACResource_INSIGHT ProjectRBACResource_ResourceType = 7 +) + +// Enum value maps for ProjectRBACResource_ResourceType. +var ( + ProjectRBACResource_ResourceType_name = map[int32]string{ + 0: "APPLICATION", + 1: "DEPLOYMENT", + 2: "EVENT", + 3: "PIPED", + 4: "DEPLOYMENT_CHAIN", + 5: "PROJECT", + 6: "API_KEY", + 7: "INSIGHT", + } + ProjectRBACResource_ResourceType_value = map[string]int32{ + "APPLICATION": 0, + "DEPLOYMENT": 1, + "EVENT": 2, + "PIPED": 3, + "DEPLOYMENT_CHAIN": 4, + "PROJECT": 5, + "API_KEY": 6, + "INSIGHT": 7, + } +) + +func (x ProjectRBACResource_ResourceType) Enum() *ProjectRBACResource_ResourceType { + p := new(ProjectRBACResource_ResourceType) + *p = x + return p +} + +func (x ProjectRBACResource_ResourceType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ProjectRBACResource_ResourceType) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_model_project_proto_enumTypes[1].Descriptor() +} + +func (ProjectRBACResource_ResourceType) Type() protoreflect.EnumType { + return &file_pkg_model_project_proto_enumTypes[1] +} + +func (x ProjectRBACResource_ResourceType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ProjectRBACResource_ResourceType.Descriptor instead. +func (ProjectRBACResource_ResourceType) EnumDescriptor() ([]byte, []int) { + return file_pkg_model_project_proto_rawDescGZIP(), []int{6, 0} +} + +type ProjectRBACPolicy_Action int32 + +const ( + ProjectRBACPolicy_GET ProjectRBACPolicy_Action = 0 + ProjectRBACPolicy_LIST ProjectRBACPolicy_Action = 1 + ProjectRBACPolicy_CREATE ProjectRBACPolicy_Action = 2 + ProjectRBACPolicy_UPDATE ProjectRBACPolicy_Action = 3 + ProjectRBACPolicy_DELETE ProjectRBACPolicy_Action = 4 +) + +// Enum value maps for ProjectRBACPolicy_Action. +var ( + ProjectRBACPolicy_Action_name = map[int32]string{ + 0: "GET", + 1: "LIST", + 2: "CREATE", + 3: "UPDATE", + 4: "DELETE", + } + ProjectRBACPolicy_Action_value = map[string]int32{ + "GET": 0, + "LIST": 1, + "CREATE": 2, + "UPDATE": 3, + "DELETE": 4, + } +) + +func (x ProjectRBACPolicy_Action) Enum() *ProjectRBACPolicy_Action { + p := new(ProjectRBACPolicy_Action) + *p = x + return p +} + +func (x ProjectRBACPolicy_Action) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ProjectRBACPolicy_Action) Descriptor() protoreflect.EnumDescriptor { + return file_pkg_model_project_proto_enumTypes[2].Descriptor() +} + +func (ProjectRBACPolicy_Action) Type() protoreflect.EnumType { + return &file_pkg_model_project_proto_enumTypes[2] +} + +func (x ProjectRBACPolicy_Action) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ProjectRBACPolicy_Action.Descriptor instead. +func (ProjectRBACPolicy_Action) EnumDescriptor() ([]byte, []int) { + return file_pkg_model_project_proto_rawDescGZIP(), []int{7, 0} +} + // Project contains needed data for a PipeCD project. // Each project can have multiple pipeds, enviroments, applications. // And each project can be controlled by a group of admin users. @@ -116,6 +235,10 @@ type Project struct { // Enable this field will allow users not belonging // to any registered teams to log in with Viewer role. AllowStrayAsViewer bool `protobuf:"varint,8,opt,name=allow_stray_as_viewer,json=allowStrayAsViewer,proto3" json:"allow_stray_as_viewer,omitempty"` + // RBAC roles for this project. + RbacRoles []*ProjectRBACRole `protobuf:"bytes,9,rep,name=rbac_roles,json=rbacRoles,proto3" json:"rbac_roles,omitempty"` + // Mapping SSO group and RBAC role. + UserGroups []*ProjectUserGroup `protobuf:"bytes,10,rep,name=user_groups,json=userGroups,proto3" json:"user_groups,omitempty"` // Unix time when the project is created. CreatedAt int64 `protobuf:"varint,14,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // Unix time of the last time when the project is updated. @@ -210,6 +333,20 @@ func (x *Project) GetAllowStrayAsViewer() bool { return false } +func (x *Project) GetRbacRoles() []*ProjectRBACRole { + if x != nil { + return x.RbacRoles + } + return nil +} + +func (x *Project) GetUserGroups() []*ProjectUserGroup { + if x != nil { + return x.UserGroups + } + return nil +} + func (x *Project) GetCreatedAt() int64 { if x != nil { return x.CreatedAt @@ -408,6 +545,237 @@ func (x *ProjectRBACConfig) GetViewer() string { return "" } +// ProjectUserGroup represents a user group. +type ProjectUserGroup struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of sso group. + SsoGroup string `protobuf:"bytes,1,opt,name=sso_group,json=ssoGroup,proto3" json:"sso_group,omitempty"` + // The name of rbac role. + Role string `protobuf:"bytes,2,opt,name=role,proto3" json:"role,omitempty"` +} + +func (x *ProjectUserGroup) Reset() { + *x = ProjectUserGroup{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_model_project_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProjectUserGroup) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProjectUserGroup) ProtoMessage() {} + +func (x *ProjectUserGroup) ProtoReflect() protoreflect.Message { + mi := &file_pkg_model_project_proto_msgTypes[4] + 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 ProjectUserGroup.ProtoReflect.Descriptor instead. +func (*ProjectUserGroup) Descriptor() ([]byte, []int) { + return file_pkg_model_project_proto_rawDescGZIP(), []int{4} +} + +func (x *ProjectUserGroup) GetSsoGroup() string { + if x != nil { + return x.SsoGroup + } + return "" +} + +func (x *ProjectUserGroup) GetRole() string { + if x != nil { + return x.Role + } + return "" +} + +// ProjectRBACRole represents a RBAC role. +type ProjectRBACRole struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of role. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The policy of role. + Policy []*ProjectRBACPolicy `protobuf:"bytes,2,rep,name=policy,proto3" json:"policy,omitempty"` +} + +func (x *ProjectRBACRole) Reset() { + *x = ProjectRBACRole{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_model_project_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProjectRBACRole) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProjectRBACRole) ProtoMessage() {} + +func (x *ProjectRBACRole) ProtoReflect() protoreflect.Message { + mi := &file_pkg_model_project_proto_msgTypes[5] + 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 ProjectRBACRole.ProtoReflect.Descriptor instead. +func (*ProjectRBACRole) Descriptor() ([]byte, []int) { + return file_pkg_model_project_proto_rawDescGZIP(), []int{5} +} + +func (x *ProjectRBACRole) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *ProjectRBACRole) GetPolicy() []*ProjectRBACPolicy { + if x != nil { + return x.Policy + } + return nil +} + +// ProjectResource represents a RBAC resource. +type ProjectRBACResource struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The type of resource. + Type ProjectRBACResource_ResourceType `protobuf:"varint,1,opt,name=type,proto3,enum=model.ProjectRBACResource_ResourceType" json:"type,omitempty"` + // Custom attributes to identify resource. + Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (x *ProjectRBACResource) Reset() { + *x = ProjectRBACResource{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_model_project_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProjectRBACResource) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProjectRBACResource) ProtoMessage() {} + +func (x *ProjectRBACResource) ProtoReflect() protoreflect.Message { + mi := &file_pkg_model_project_proto_msgTypes[6] + 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 ProjectRBACResource.ProtoReflect.Descriptor instead. +func (*ProjectRBACResource) Descriptor() ([]byte, []int) { + return file_pkg_model_project_proto_rawDescGZIP(), []int{6} +} + +func (x *ProjectRBACResource) GetType() ProjectRBACResource_ResourceType { + if x != nil { + return x.Type + } + return ProjectRBACResource_APPLICATION +} + +func (x *ProjectRBACResource) GetLabels() map[string]string { + if x != nil { + return x.Labels + } + return nil +} + +type ProjectRBACPolicy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The resources of this project. + Resources []*ProjectRBACResource `protobuf:"bytes,1,rep,name=resources,proto3" json:"resources,omitempty"` + // The types of action. + Actions []ProjectRBACPolicy_Action `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=model.ProjectRBACPolicy_Action" json:"actions,omitempty"` +} + +func (x *ProjectRBACPolicy) Reset() { + *x = ProjectRBACPolicy{} + if protoimpl.UnsafeEnabled { + mi := &file_pkg_model_project_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ProjectRBACPolicy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ProjectRBACPolicy) ProtoMessage() {} + +func (x *ProjectRBACPolicy) ProtoReflect() protoreflect.Message { + mi := &file_pkg_model_project_proto_msgTypes[7] + 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 ProjectRBACPolicy.ProtoReflect.Descriptor instead. +func (*ProjectRBACPolicy) Descriptor() ([]byte, []int) { + return file_pkg_model_project_proto_rawDescGZIP(), []int{7} +} + +func (x *ProjectRBACPolicy) GetResources() []*ProjectRBACResource { + if x != nil { + return x.Resources + } + return nil +} + +func (x *ProjectRBACPolicy) GetActions() []ProjectRBACPolicy_Action { + if x != nil { + return x.Actions + } + return nil +} + type ProjectSSOConfig_GitHub struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -428,7 +796,7 @@ type ProjectSSOConfig_GitHub struct { func (x *ProjectSSOConfig_GitHub) Reset() { *x = ProjectSSOConfig_GitHub{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_model_project_proto_msgTypes[4] + mi := &file_pkg_model_project_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -441,7 +809,7 @@ func (x *ProjectSSOConfig_GitHub) String() string { func (*ProjectSSOConfig_GitHub) ProtoMessage() {} func (x *ProjectSSOConfig_GitHub) ProtoReflect() protoreflect.Message { - mi := &file_pkg_model_project_proto_msgTypes[4] + mi := &file_pkg_model_project_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -506,7 +874,7 @@ type ProjectSSOConfig_Google struct { func (x *ProjectSSOConfig_Google) Reset() { *x = ProjectSSOConfig_Google{} if protoimpl.UnsafeEnabled { - mi := &file_pkg_model_project_proto_msgTypes[5] + mi := &file_pkg_model_project_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -519,7 +887,7 @@ func (x *ProjectSSOConfig_Google) String() string { func (*ProjectSSOConfig_Google) ProtoMessage() {} func (x *ProjectSSOConfig_Google) ProtoReflect() protoreflect.Message { - mi := &file_pkg_model_project_proto_msgTypes[5] + mi := &file_pkg_model_project_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -555,7 +923,7 @@ var file_pkg_model_project_proto_rawDesc = []byte{ 0x0a, 0x17, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, - 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb5, 0x03, 0x0a, 0x07, 0x50, 0x72, + 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa6, 0x04, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x17, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x65, 0x73, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x65, @@ -578,61 +946,116 @@ var file_pkg_model_project_proto_rawDesc = []byte{ 0x0a, 0x15, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x72, 0x61, 0x79, 0x5f, 0x61, 0x73, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x74, 0x72, 0x61, 0x79, 0x41, 0x73, 0x56, 0x69, 0x65, 0x77, 0x65, - 0x72, 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, - 0x0e, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x09, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x75, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x22, 0x66, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x69, 0x63, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, - 0x01, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x0d, 0x70, - 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x06, 0x52, 0x0c, 0x70, 0x61, 0x73, - 0x73, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x61, 0x73, 0x68, 0x22, 0x9d, 0x04, 0x0a, 0x10, 0x50, 0x72, - 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x53, 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x46, - 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x20, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x53, 0x53, 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x08, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x06, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x53, 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x47, 0x69, 0x74, 0x48, 0x75, 0x62, 0x52, 0x06, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x12, 0x36, - 0x0a, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x53, - 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x52, 0x06, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x1a, 0xb3, 0x01, 0x0a, 0x06, 0x47, 0x69, 0x74, 0x48, 0x75, - 0x62, 0x12, 0x24, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x08, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, - 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, - 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x75, 0x72, - 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x55, 0x72, 0x6c, - 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x72, 0x6c, 0x12, - 0x1b, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x72, 0x6c, 0x1a, 0x5c, 0x0a, 0x06, - 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, - 0x10, 0x01, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0d, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0x3d, 0x0a, 0x08, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, - 0x10, 0x00, 0x12, 0x19, 0x0a, 0x11, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x5f, 0x45, 0x4e, 0x54, - 0x45, 0x52, 0x50, 0x52, 0x49, 0x53, 0x45, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x0a, 0x0a, - 0x06, 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x45, 0x10, 0x02, 0x22, 0x62, 0x0a, 0x11, 0x50, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1d, - 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, - 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x16, 0x0a, - 0x06, 0x65, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x65, - 0x64, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x42, 0x25, 0x5a, - 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x69, 0x70, 0x65, - 0x2d, 0x63, 0x64, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x63, 0x64, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, - 0x6f, 0x64, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x12, 0x35, 0x0a, 0x0a, 0x72, 0x62, 0x61, 0x63, 0x5f, 0x72, 0x6f, 0x6c, 0x65, 0x73, 0x18, + 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, 0x52, 0x6f, 0x6c, 0x65, 0x52, 0x09, 0x72, + 0x62, 0x61, 0x63, 0x52, 0x6f, 0x6c, 0x65, 0x73, 0x12, 0x38, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x72, + 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x73, 0x65, + 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, 0x75, + 0x70, 0x73, 0x12, 0x26, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, + 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, + 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x26, 0x0a, 0x0a, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x22, 0x02, 0x20, 0x00, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x41, 0x74, 0x22, 0x66, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x74, 0x61, + 0x74, 0x69, 0x63, 0x55, 0x73, 0x65, 0x72, 0x12, 0x23, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, + 0x10, 0x01, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2c, 0x0a, 0x0d, + 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x06, 0x52, 0x0c, 0x70, 0x61, + 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x48, 0x61, 0x73, 0x68, 0x22, 0x9d, 0x04, 0x0a, 0x10, 0x50, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x53, 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x46, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x20, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x53, 0x53, 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, + 0x64, 0x65, 0x72, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x08, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x36, 0x0a, 0x06, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, + 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, 0x53, 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x2e, 0x47, 0x69, 0x74, 0x48, 0x75, 0x62, 0x52, 0x06, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x12, + 0x36, 0x0a, 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1e, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x53, + 0x53, 0x4f, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x52, + 0x06, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x1a, 0xb3, 0x01, 0x0a, 0x06, 0x47, 0x69, 0x74, 0x48, + 0x75, 0x62, 0x12, 0x24, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x08, + 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0d, 0x63, 0x6c, 0x69, 0x65, + 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x75, + 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x73, 0x65, 0x55, 0x72, + 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x75, 0x72, 0x6c, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x55, 0x72, 0x6c, + 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x55, 0x72, 0x6c, 0x1a, 0x5c, 0x0a, + 0x06, 0x47, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, + 0x02, 0x10, 0x01, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x2c, 0x0a, + 0x0d, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x22, 0x3d, 0x0a, 0x08, 0x50, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x0a, 0x0a, 0x06, 0x47, 0x49, 0x54, 0x48, 0x55, + 0x42, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x11, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x5f, 0x45, 0x4e, + 0x54, 0x45, 0x52, 0x50, 0x52, 0x49, 0x53, 0x45, 0x10, 0x01, 0x1a, 0x02, 0x08, 0x01, 0x12, 0x0a, + 0x0a, 0x06, 0x47, 0x4f, 0x4f, 0x47, 0x4c, 0x45, 0x10, 0x02, 0x22, 0x62, 0x0a, 0x11, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, + 0x1d, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, + 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x12, 0x16, + 0x0a, 0x06, 0x65, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x65, 0x64, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x76, 0x69, 0x65, 0x77, 0x65, 0x72, 0x22, 0x55, + 0x0a, 0x10, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x72, 0x6f, + 0x75, 0x70, 0x12, 0x24, 0x0a, 0x09, 0x73, 0x73, 0x6f, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x08, + 0x73, 0x73, 0x6f, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0x60, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x52, 0x42, 0x41, 0x43, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, + 0x06, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x22, 0xf6, 0x02, 0x0a, 0x13, 0x50, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, + 0x45, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, + 0x43, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x82, 0x01, 0x02, 0x10, 0x01, + 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x18, + 0xfa, 0x42, 0x09, 0x9a, 0x01, 0x06, 0x22, 0x04, 0x72, 0x02, 0x10, 0x01, 0xfa, 0x42, 0x09, 0x9a, + 0x01, 0x06, 0x2a, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, + 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, + 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, + 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x82, 0x01, 0x0a, 0x0c, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, + 0x41, 0x50, 0x50, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x0e, 0x0a, + 0x0a, 0x44, 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x4d, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, 0x09, 0x0a, + 0x05, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x49, 0x50, 0x45, + 0x44, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x44, 0x45, 0x50, 0x4c, 0x4f, 0x59, 0x4d, 0x45, 0x4e, + 0x54, 0x5f, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x4f, + 0x4a, 0x45, 0x43, 0x54, 0x10, 0x05, 0x12, 0x0b, 0x0a, 0x07, 0x41, 0x50, 0x49, 0x5f, 0x4b, 0x45, + 0x59, 0x10, 0x06, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x53, 0x49, 0x47, 0x48, 0x54, 0x10, 0x07, + 0x22, 0xc9, 0x01, 0x0a, 0x11, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, + 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x38, 0x0a, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x42, 0x41, 0x43, 0x52, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x12, 0x39, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0e, 0x32, 0x1f, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, + 0x74, 0x52, 0x42, 0x41, 0x43, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x2e, 0x41, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x3f, 0x0a, 0x06, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x00, 0x12, 0x08, + 0x0a, 0x04, 0x4c, 0x49, 0x53, 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x52, 0x45, 0x41, + 0x54, 0x45, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, + 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x04, 0x42, 0x25, 0x5a, 0x23, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x2d, + 0x63, 0x64, 0x2f, 0x70, 0x69, 0x70, 0x65, 0x63, 0x64, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -647,29 +1070,43 @@ func file_pkg_model_project_proto_rawDescGZIP() []byte { return file_pkg_model_project_proto_rawDescData } -var file_pkg_model_project_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_pkg_model_project_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_pkg_model_project_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_pkg_model_project_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_pkg_model_project_proto_goTypes = []interface{}{ - (ProjectSSOConfig_Provider)(0), // 0: model.ProjectSSOConfig.Provider - (*Project)(nil), // 1: model.Project - (*ProjectStaticUser)(nil), // 2: model.ProjectStaticUser - (*ProjectSSOConfig)(nil), // 3: model.ProjectSSOConfig - (*ProjectRBACConfig)(nil), // 4: model.ProjectRBACConfig - (*ProjectSSOConfig_GitHub)(nil), // 5: model.ProjectSSOConfig.GitHub - (*ProjectSSOConfig_Google)(nil), // 6: model.ProjectSSOConfig.Google + (ProjectSSOConfig_Provider)(0), // 0: model.ProjectSSOConfig.Provider + (ProjectRBACResource_ResourceType)(0), // 1: model.ProjectRBACResource.ResourceType + (ProjectRBACPolicy_Action)(0), // 2: model.ProjectRBACPolicy.Action + (*Project)(nil), // 3: model.Project + (*ProjectStaticUser)(nil), // 4: model.ProjectStaticUser + (*ProjectSSOConfig)(nil), // 5: model.ProjectSSOConfig + (*ProjectRBACConfig)(nil), // 6: model.ProjectRBACConfig + (*ProjectUserGroup)(nil), // 7: model.ProjectUserGroup + (*ProjectRBACRole)(nil), // 8: model.ProjectRBACRole + (*ProjectRBACResource)(nil), // 9: model.ProjectRBACResource + (*ProjectRBACPolicy)(nil), // 10: model.ProjectRBACPolicy + (*ProjectSSOConfig_GitHub)(nil), // 11: model.ProjectSSOConfig.GitHub + (*ProjectSSOConfig_Google)(nil), // 12: model.ProjectSSOConfig.Google + nil, // 13: model.ProjectRBACResource.LabelsEntry } var file_pkg_model_project_proto_depIdxs = []int32{ - 2, // 0: model.Project.static_admin:type_name -> model.ProjectStaticUser - 3, // 1: model.Project.sso:type_name -> model.ProjectSSOConfig - 4, // 2: model.Project.rbac:type_name -> model.ProjectRBACConfig - 0, // 3: model.ProjectSSOConfig.provider:type_name -> model.ProjectSSOConfig.Provider - 5, // 4: model.ProjectSSOConfig.github:type_name -> model.ProjectSSOConfig.GitHub - 6, // 5: model.ProjectSSOConfig.google:type_name -> model.ProjectSSOConfig.Google - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 4, // 0: model.Project.static_admin:type_name -> model.ProjectStaticUser + 5, // 1: model.Project.sso:type_name -> model.ProjectSSOConfig + 6, // 2: model.Project.rbac:type_name -> model.ProjectRBACConfig + 8, // 3: model.Project.rbac_roles:type_name -> model.ProjectRBACRole + 7, // 4: model.Project.user_groups:type_name -> model.ProjectUserGroup + 0, // 5: model.ProjectSSOConfig.provider:type_name -> model.ProjectSSOConfig.Provider + 11, // 6: model.ProjectSSOConfig.github:type_name -> model.ProjectSSOConfig.GitHub + 12, // 7: model.ProjectSSOConfig.google:type_name -> model.ProjectSSOConfig.Google + 10, // 8: model.ProjectRBACRole.policy:type_name -> model.ProjectRBACPolicy + 1, // 9: model.ProjectRBACResource.type:type_name -> model.ProjectRBACResource.ResourceType + 13, // 10: model.ProjectRBACResource.labels:type_name -> model.ProjectRBACResource.LabelsEntry + 9, // 11: model.ProjectRBACPolicy.resources:type_name -> model.ProjectRBACResource + 2, // 12: model.ProjectRBACPolicy.actions:type_name -> model.ProjectRBACPolicy.Action + 13, // [13:13] is the sub-list for method output_type + 13, // [13:13] is the sub-list for method input_type + 13, // [13:13] is the sub-list for extension type_name + 13, // [13:13] is the sub-list for extension extendee + 0, // [0:13] is the sub-list for field type_name } func init() { file_pkg_model_project_proto_init() } @@ -727,7 +1164,7 @@ func file_pkg_model_project_proto_init() { } } file_pkg_model_project_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProjectSSOConfig_GitHub); i { + switch v := v.(*ProjectUserGroup); i { case 0: return &v.state case 1: @@ -739,6 +1176,54 @@ func file_pkg_model_project_proto_init() { } } file_pkg_model_project_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProjectRBACRole); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_model_project_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProjectRBACResource); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_model_project_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProjectRBACPolicy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_model_project_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ProjectSSOConfig_GitHub); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pkg_model_project_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ProjectSSOConfig_Google); i { case 0: return &v.state @@ -756,8 +1241,8 @@ func file_pkg_model_project_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pkg_model_project_proto_rawDesc, - NumEnums: 1, - NumMessages: 6, + NumEnums: 3, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/pkg/model/project.pb.validate.go b/pkg/model/project.pb.validate.go index 59626c2c44..0b7e1d0c04 100644 --- a/pkg/model/project.pb.validate.go +++ b/pkg/model/project.pb.validate.go @@ -173,6 +173,74 @@ func (m *Project) validate(all bool) error { // no validation rules for AllowStrayAsViewer + for idx, item := range m.GetRbacRoles() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ProjectValidationError{ + field: fmt.Sprintf("RbacRoles[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ProjectValidationError{ + field: fmt.Sprintf("RbacRoles[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ProjectValidationError{ + field: fmt.Sprintf("RbacRoles[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + for idx, item := range m.GetUserGroups() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ProjectValidationError{ + field: fmt.Sprintf("UserGroups[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ProjectValidationError{ + field: fmt.Sprintf("UserGroups[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ProjectValidationError{ + field: fmt.Sprintf("UserGroups[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + if m.GetCreatedAt() <= 0 { err := ProjectValidationError{ field: "CreatedAt", @@ -682,6 +750,559 @@ var _ interface { ErrorName() string } = ProjectRBACConfigValidationError{} +// Validate checks the field values on ProjectUserGroup with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ProjectUserGroup) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ProjectUserGroup with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ProjectUserGroupMultiError, or nil if none found. +func (m *ProjectUserGroup) ValidateAll() error { + return m.validate(true) +} + +func (m *ProjectUserGroup) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetSsoGroup()) < 1 { + err := ProjectUserGroupValidationError{ + field: "SsoGroup", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(m.GetRole()) < 1 { + err := ProjectUserGroupValidationError{ + field: "Role", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if len(errors) > 0 { + return ProjectUserGroupMultiError(errors) + } + + return nil +} + +// ProjectUserGroupMultiError is an error wrapping multiple validation errors +// returned by ProjectUserGroup.ValidateAll() if the designated constraints +// aren't met. +type ProjectUserGroupMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ProjectUserGroupMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ProjectUserGroupMultiError) AllErrors() []error { return m } + +// ProjectUserGroupValidationError is the validation error returned by +// ProjectUserGroup.Validate if the designated constraints aren't met. +type ProjectUserGroupValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProjectUserGroupValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProjectUserGroupValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProjectUserGroupValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProjectUserGroupValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProjectUserGroupValidationError) ErrorName() string { return "ProjectUserGroupValidationError" } + +// Error satisfies the builtin error interface +func (e ProjectUserGroupValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sProjectUserGroup.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProjectUserGroupValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProjectUserGroupValidationError{} + +// Validate checks the field values on ProjectRBACRole with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ProjectRBACRole) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ProjectRBACRole with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ProjectRBACRoleMultiError, or nil if none found. +func (m *ProjectRBACRole) ValidateAll() error { + return m.validate(true) +} + +func (m *ProjectRBACRole) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if utf8.RuneCountInString(m.GetName()) < 1 { + err := ProjectRBACRoleValidationError{ + field: "Name", + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + for idx, item := range m.GetPolicy() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ProjectRBACRoleValidationError{ + field: fmt.Sprintf("Policy[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ProjectRBACRoleValidationError{ + field: fmt.Sprintf("Policy[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ProjectRBACRoleValidationError{ + field: fmt.Sprintf("Policy[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ProjectRBACRoleMultiError(errors) + } + + return nil +} + +// ProjectRBACRoleMultiError is an error wrapping multiple validation errors +// returned by ProjectRBACRole.ValidateAll() if the designated constraints +// aren't met. +type ProjectRBACRoleMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ProjectRBACRoleMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ProjectRBACRoleMultiError) AllErrors() []error { return m } + +// ProjectRBACRoleValidationError is the validation error returned by +// ProjectRBACRole.Validate if the designated constraints aren't met. +type ProjectRBACRoleValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProjectRBACRoleValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProjectRBACRoleValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProjectRBACRoleValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProjectRBACRoleValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProjectRBACRoleValidationError) ErrorName() string { return "ProjectRBACRoleValidationError" } + +// Error satisfies the builtin error interface +func (e ProjectRBACRoleValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sProjectRBACRole.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProjectRBACRoleValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProjectRBACRoleValidationError{} + +// Validate checks the field values on ProjectRBACResource with the rules +// defined in the proto definition for this message. If any rules are +// violated, the first error encountered is returned, or nil if there are no violations. +func (m *ProjectRBACResource) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ProjectRBACResource with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ProjectRBACResourceMultiError, or nil if none found. +func (m *ProjectRBACResource) ValidateAll() error { + return m.validate(true) +} + +func (m *ProjectRBACResource) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + if _, ok := ProjectRBACResource_ResourceType_name[int32(m.GetType())]; !ok { + err := ProjectRBACResourceValidationError{ + field: "Type", + reason: "value must be one of the defined enum values", + } + if !all { + return err + } + errors = append(errors, err) + } + + { + sorted_keys := make([]string, len(m.GetLabels())) + i := 0 + for key := range m.GetLabels() { + sorted_keys[i] = key + i++ + } + sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) + for _, key := range sorted_keys { + val := m.GetLabels()[key] + _ = val + + if utf8.RuneCountInString(key) < 1 { + err := ProjectRBACResourceValidationError{ + field: fmt.Sprintf("Labels[%v]", key), + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + if utf8.RuneCountInString(val) < 1 { + err := ProjectRBACResourceValidationError{ + field: fmt.Sprintf("Labels[%v]", key), + reason: "value length must be at least 1 runes", + } + if !all { + return err + } + errors = append(errors, err) + } + + } + } + + if len(errors) > 0 { + return ProjectRBACResourceMultiError(errors) + } + + return nil +} + +// ProjectRBACResourceMultiError is an error wrapping multiple validation +// errors returned by ProjectRBACResource.ValidateAll() if the designated +// constraints aren't met. +type ProjectRBACResourceMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ProjectRBACResourceMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ProjectRBACResourceMultiError) AllErrors() []error { return m } + +// ProjectRBACResourceValidationError is the validation error returned by +// ProjectRBACResource.Validate if the designated constraints aren't met. +type ProjectRBACResourceValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProjectRBACResourceValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProjectRBACResourceValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProjectRBACResourceValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProjectRBACResourceValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProjectRBACResourceValidationError) ErrorName() string { + return "ProjectRBACResourceValidationError" +} + +// Error satisfies the builtin error interface +func (e ProjectRBACResourceValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sProjectRBACResource.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProjectRBACResourceValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProjectRBACResourceValidationError{} + +// Validate checks the field values on ProjectRBACPolicy with the rules defined +// in the proto definition for this message. If any rules are violated, the +// first error encountered is returned, or nil if there are no violations. +func (m *ProjectRBACPolicy) Validate() error { + return m.validate(false) +} + +// ValidateAll checks the field values on ProjectRBACPolicy with the rules +// defined in the proto definition for this message. If any rules are +// violated, the result is a list of violation errors wrapped in +// ProjectRBACPolicyMultiError, or nil if none found. +func (m *ProjectRBACPolicy) ValidateAll() error { + return m.validate(true) +} + +func (m *ProjectRBACPolicy) validate(all bool) error { + if m == nil { + return nil + } + + var errors []error + + for idx, item := range m.GetResources() { + _, _ = idx, item + + if all { + switch v := interface{}(item).(type) { + case interface{ ValidateAll() error }: + if err := v.ValidateAll(); err != nil { + errors = append(errors, ProjectRBACPolicyValidationError{ + field: fmt.Sprintf("Resources[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + case interface{ Validate() error }: + if err := v.Validate(); err != nil { + errors = append(errors, ProjectRBACPolicyValidationError{ + field: fmt.Sprintf("Resources[%v]", idx), + reason: "embedded message failed validation", + cause: err, + }) + } + } + } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { + if err := v.Validate(); err != nil { + return ProjectRBACPolicyValidationError{ + field: fmt.Sprintf("Resources[%v]", idx), + reason: "embedded message failed validation", + cause: err, + } + } + } + + } + + if len(errors) > 0 { + return ProjectRBACPolicyMultiError(errors) + } + + return nil +} + +// ProjectRBACPolicyMultiError is an error wrapping multiple validation errors +// returned by ProjectRBACPolicy.ValidateAll() if the designated constraints +// aren't met. +type ProjectRBACPolicyMultiError []error + +// Error returns a concatenation of all the error messages it wraps. +func (m ProjectRBACPolicyMultiError) Error() string { + var msgs []string + for _, err := range m { + msgs = append(msgs, err.Error()) + } + return strings.Join(msgs, "; ") +} + +// AllErrors returns a list of validation violation errors. +func (m ProjectRBACPolicyMultiError) AllErrors() []error { return m } + +// ProjectRBACPolicyValidationError is the validation error returned by +// ProjectRBACPolicy.Validate if the designated constraints aren't met. +type ProjectRBACPolicyValidationError struct { + field string + reason string + cause error + key bool +} + +// Field function returns field value. +func (e ProjectRBACPolicyValidationError) Field() string { return e.field } + +// Reason function returns reason value. +func (e ProjectRBACPolicyValidationError) Reason() string { return e.reason } + +// Cause function returns cause value. +func (e ProjectRBACPolicyValidationError) Cause() error { return e.cause } + +// Key function returns key value. +func (e ProjectRBACPolicyValidationError) Key() bool { return e.key } + +// ErrorName returns error name. +func (e ProjectRBACPolicyValidationError) ErrorName() string { + return "ProjectRBACPolicyValidationError" +} + +// Error satisfies the builtin error interface +func (e ProjectRBACPolicyValidationError) Error() string { + cause := "" + if e.cause != nil { + cause = fmt.Sprintf(" | caused by: %v", e.cause) + } + + key := "" + if e.key { + key = "key for " + } + + return fmt.Sprintf( + "invalid %sProjectRBACPolicy.%s: %s%s", + key, + e.field, + e.reason, + cause) +} + +var _ error = ProjectRBACPolicyValidationError{} + +var _ interface { + Field() string + Reason() string + Key() bool + Cause() error + ErrorName() string +} = ProjectRBACPolicyValidationError{} + // Validate checks the field values on ProjectSSOConfig_GitHub with the rules // defined in the proto definition for this message. If any rules are // violated, the first error encountered is returned, or nil if there are no violations. diff --git a/pkg/model/project.proto b/pkg/model/project.proto index 803b56b4c8..59c41ed33f 100644 --- a/pkg/model/project.proto +++ b/pkg/model/project.proto @@ -46,6 +46,12 @@ message Project { // to any registered teams to log in with Viewer role. bool allow_stray_as_viewer = 8; + // RBAC roles for this project. + repeated ProjectRBACRole rbac_roles = 9; + + // Mapping SSO group and RBAC role. + repeated ProjectUserGroup user_groups = 10; + // Unix time when the project is created. int64 created_at = 14 [(validate.rules).int64.gt = 0]; // Unix time of the last time when the project is updated. @@ -99,3 +105,53 @@ message ProjectRBACConfig { string editor = 2; string viewer = 3; } + +// ProjectUserGroup represents a user group. +message ProjectUserGroup { + // The name of sso group. + string sso_group = 1 [(validate.rules).string.min_len = 1]; + // The name of rbac role. + string role = 2 [(validate.rules).string.min_len = 1]; +} + +// ProjectRBACRole represents a RBAC role. +message ProjectRBACRole { + // The name of role. + string name = 1 [(validate.rules).string.min_len = 1]; + // The policy of role. + repeated ProjectRBACPolicy policy = 2; +} + +// ProjectResource represents a RBAC resource. +message ProjectRBACResource { + enum ResourceType { + APPLICATION = 0; + DEPLOYMENT = 1; + EVENT = 2; + PIPED = 3; + DEPLOYMENT_CHAIN = 4; + PROJECT = 5; + API_KEY = 6; + INSIGHT = 7; + } + + // The type of resource. + ResourceType type = 1 [(validate.rules).enum.defined_only = true]; + // Custom attributes to identify resource. + map labels = 2 [(validate.rules).map.keys.string.min_len = 1, (validate.rules).map.values.string.min_len = 1]; +} + +message ProjectRBACPolicy { + enum Action { + GET = 0; + LIST = 1; + CREATE = 2; + UPDATE = 3; + DELETE = 4; + } + + // The resources of this project. + repeated ProjectRBACResource resources = 1; + // The types of action. + repeated Action actions = 2; +} diff --git a/web/model/project_pb.d.ts b/web/model/project_pb.d.ts index 4ed71659fa..ee07029f0f 100644 --- a/web/model/project_pb.d.ts +++ b/web/model/project_pb.d.ts @@ -34,6 +34,16 @@ export class Project extends jspb.Message { getAllowStrayAsViewer(): boolean; setAllowStrayAsViewer(value: boolean): Project; + getRbacRolesList(): Array; + setRbacRolesList(value: Array): Project; + clearRbacRolesList(): Project; + addRbacRoles(value?: ProjectRBACRole, index?: number): ProjectRBACRole; + + getUserGroupsList(): Array; + setUserGroupsList(value: Array): Project; + clearUserGroupsList(): Project; + addUserGroups(value?: ProjectUserGroup, index?: number): ProjectUserGroup; + getCreatedAt(): number; setCreatedAt(value: number): Project; @@ -58,6 +68,8 @@ export namespace Project { rbac?: ProjectRBACConfig.AsObject, sharedSsoName: string, allowStrayAsViewer: boolean, + rbacRolesList: Array, + userGroupsList: Array, createdAt: number, updatedAt: number, } @@ -205,3 +217,116 @@ export namespace ProjectRBACConfig { } } +export class ProjectUserGroup extends jspb.Message { + getSsoGroup(): string; + setSsoGroup(value: string): ProjectUserGroup; + + getRole(): string; + setRole(value: string): ProjectUserGroup; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProjectUserGroup.AsObject; + static toObject(includeInstance: boolean, msg: ProjectUserGroup): ProjectUserGroup.AsObject; + static serializeBinaryToWriter(message: ProjectUserGroup, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProjectUserGroup; + static deserializeBinaryFromReader(message: ProjectUserGroup, reader: jspb.BinaryReader): ProjectUserGroup; +} + +export namespace ProjectUserGroup { + export type AsObject = { + ssoGroup: string, + role: string, + } +} + +export class ProjectRBACRole extends jspb.Message { + getName(): string; + setName(value: string): ProjectRBACRole; + + getPolicyList(): Array; + setPolicyList(value: Array): ProjectRBACRole; + clearPolicyList(): ProjectRBACRole; + addPolicy(value?: ProjectRBACPolicy, index?: number): ProjectRBACPolicy; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProjectRBACRole.AsObject; + static toObject(includeInstance: boolean, msg: ProjectRBACRole): ProjectRBACRole.AsObject; + static serializeBinaryToWriter(message: ProjectRBACRole, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProjectRBACRole; + static deserializeBinaryFromReader(message: ProjectRBACRole, reader: jspb.BinaryReader): ProjectRBACRole; +} + +export namespace ProjectRBACRole { + export type AsObject = { + name: string, + policyList: Array, + } +} + +export class ProjectRBACResource extends jspb.Message { + getType(): ProjectRBACResource.ResourceType; + setType(value: ProjectRBACResource.ResourceType): ProjectRBACResource; + + getLabelsMap(): jspb.Map; + clearLabelsMap(): ProjectRBACResource; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProjectRBACResource.AsObject; + static toObject(includeInstance: boolean, msg: ProjectRBACResource): ProjectRBACResource.AsObject; + static serializeBinaryToWriter(message: ProjectRBACResource, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProjectRBACResource; + static deserializeBinaryFromReader(message: ProjectRBACResource, reader: jspb.BinaryReader): ProjectRBACResource; +} + +export namespace ProjectRBACResource { + export type AsObject = { + type: ProjectRBACResource.ResourceType, + labelsMap: Array<[string, string]>, + } + + export enum ResourceType { + APPLICATION = 0, + DEPLOYMENT = 1, + EVENT = 2, + PIPED = 3, + DEPLOYMENT_CHAIN = 4, + PROJECT = 5, + API_KEY = 6, + INSIGHT = 7, + } +} + +export class ProjectRBACPolicy extends jspb.Message { + getResourcesList(): Array; + setResourcesList(value: Array): ProjectRBACPolicy; + clearResourcesList(): ProjectRBACPolicy; + addResources(value?: ProjectRBACResource, index?: number): ProjectRBACResource; + + getActionsList(): Array; + setActionsList(value: Array): ProjectRBACPolicy; + clearActionsList(): ProjectRBACPolicy; + addActions(value: ProjectRBACPolicy.Action, index?: number): ProjectRBACPolicy; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ProjectRBACPolicy.AsObject; + static toObject(includeInstance: boolean, msg: ProjectRBACPolicy): ProjectRBACPolicy.AsObject; + static serializeBinaryToWriter(message: ProjectRBACPolicy, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ProjectRBACPolicy; + static deserializeBinaryFromReader(message: ProjectRBACPolicy, reader: jspb.BinaryReader): ProjectRBACPolicy; +} + +export namespace ProjectRBACPolicy { + export type AsObject = { + resourcesList: Array, + actionsList: Array, + } + + export enum Action { + GET = 0, + LIST = 1, + CREATE = 2, + UPDATE = 3, + DELETE = 4, + } +} + diff --git a/web/model/project_pb.js b/web/model/project_pb.js index 9365cb71f6..73226059cd 100644 --- a/web/model/project_pb.js +++ b/web/model/project_pb.js @@ -25,11 +25,17 @@ var global = (function() { goog.exportSymbol('proto.model.Project', null, global); goog.exportSymbol('proto.model.ProjectRBACConfig', null, global); +goog.exportSymbol('proto.model.ProjectRBACPolicy', null, global); +goog.exportSymbol('proto.model.ProjectRBACPolicy.Action', null, global); +goog.exportSymbol('proto.model.ProjectRBACResource', null, global); +goog.exportSymbol('proto.model.ProjectRBACResource.ResourceType', null, global); +goog.exportSymbol('proto.model.ProjectRBACRole', null, global); goog.exportSymbol('proto.model.ProjectSSOConfig', null, global); goog.exportSymbol('proto.model.ProjectSSOConfig.GitHub', null, global); goog.exportSymbol('proto.model.ProjectSSOConfig.Google', null, global); goog.exportSymbol('proto.model.ProjectSSOConfig.Provider', null, global); goog.exportSymbol('proto.model.ProjectStaticUser', null, global); +goog.exportSymbol('proto.model.ProjectUserGroup', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -41,7 +47,7 @@ goog.exportSymbol('proto.model.ProjectStaticUser', null, global); * @constructor */ proto.model.Project = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); + jspb.Message.initialize(this, opt_data, 0, -1, proto.model.Project.repeatedFields_, null); }; goog.inherits(proto.model.Project, jspb.Message); if (goog.DEBUG && !COMPILED) { @@ -156,6 +162,97 @@ if (goog.DEBUG && !COMPILED) { */ proto.model.ProjectRBACConfig.displayName = 'proto.model.ProjectRBACConfig'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.model.ProjectUserGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.model.ProjectUserGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.model.ProjectUserGroup.displayName = 'proto.model.ProjectUserGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.model.ProjectRBACRole = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.model.ProjectRBACRole.repeatedFields_, null); +}; +goog.inherits(proto.model.ProjectRBACRole, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.model.ProjectRBACRole.displayName = 'proto.model.ProjectRBACRole'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.model.ProjectRBACResource = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.model.ProjectRBACResource, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.model.ProjectRBACResource.displayName = 'proto.model.ProjectRBACResource'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.model.ProjectRBACPolicy = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.model.ProjectRBACPolicy.repeatedFields_, null); +}; +goog.inherits(proto.model.ProjectRBACPolicy, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.model.ProjectRBACPolicy.displayName = 'proto.model.ProjectRBACPolicy'; +} + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.model.Project.repeatedFields_ = [9,10]; @@ -196,6 +293,10 @@ proto.model.Project.toObject = function(includeInstance, msg) { rbac: (f = msg.getRbac()) && proto.model.ProjectRBACConfig.toObject(includeInstance, f), sharedSsoName: jspb.Message.getFieldWithDefault(msg, 7, ""), allowStrayAsViewer: jspb.Message.getBooleanFieldWithDefault(msg, 8, false), + rbacRolesList: jspb.Message.toObjectList(msg.getRbacRolesList(), + proto.model.ProjectRBACRole.toObject, includeInstance), + userGroupsList: jspb.Message.toObjectList(msg.getUserGroupsList(), + proto.model.ProjectUserGroup.toObject, includeInstance), createdAt: jspb.Message.getFieldWithDefault(msg, 14, 0), updatedAt: jspb.Message.getFieldWithDefault(msg, 15, 0) }; @@ -269,6 +370,16 @@ proto.model.Project.deserializeBinaryFromReader = function(msg, reader) { var value = /** @type {boolean} */ (reader.readBool()); msg.setAllowStrayAsViewer(value); break; + case 9: + var value = new proto.model.ProjectRBACRole; + reader.readMessage(value,proto.model.ProjectRBACRole.deserializeBinaryFromReader); + msg.addRbacRoles(value); + break; + case 10: + var value = new proto.model.ProjectUserGroup; + reader.readMessage(value,proto.model.ProjectUserGroup.deserializeBinaryFromReader); + msg.addUserGroups(value); + break; case 14: var value = /** @type {number} */ (reader.readInt64()); msg.setCreatedAt(value); @@ -365,6 +476,22 @@ proto.model.Project.serializeBinaryToWriter = function(message, writer) { f ); } + f = message.getRbacRolesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 9, + f, + proto.model.ProjectRBACRole.serializeBinaryToWriter + ); + } + f = message.getUserGroupsList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 10, + f, + proto.model.ProjectUserGroup.serializeBinaryToWriter + ); + } f = message.getCreatedAt(); if (f !== 0) { writer.writeInt64( @@ -583,6 +710,82 @@ proto.model.Project.prototype.setAllowStrayAsViewer = function(value) { }; +/** + * repeated ProjectRBACRole rbac_roles = 9; + * @return {!Array} + */ +proto.model.Project.prototype.getRbacRolesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.model.ProjectRBACRole, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.model.Project} returns this +*/ +proto.model.Project.prototype.setRbacRolesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 9, value); +}; + + +/** + * @param {!proto.model.ProjectRBACRole=} opt_value + * @param {number=} opt_index + * @return {!proto.model.ProjectRBACRole} + */ +proto.model.Project.prototype.addRbacRoles = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 9, opt_value, proto.model.ProjectRBACRole, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.model.Project} returns this + */ +proto.model.Project.prototype.clearRbacRolesList = function() { + return this.setRbacRolesList([]); +}; + + +/** + * repeated ProjectUserGroup user_groups = 10; + * @return {!Array} + */ +proto.model.Project.prototype.getUserGroupsList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.model.ProjectUserGroup, 10)); +}; + + +/** + * @param {!Array} value + * @return {!proto.model.Project} returns this +*/ +proto.model.Project.prototype.setUserGroupsList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 10, value); +}; + + +/** + * @param {!proto.model.ProjectUserGroup=} opt_value + * @param {number=} opt_index + * @return {!proto.model.ProjectUserGroup} + */ +proto.model.Project.prototype.addUserGroups = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 10, opt_value, proto.model.ProjectUserGroup, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.model.Project} returns this + */ +proto.model.Project.prototype.clearUserGroupsList = function() { + return this.setUserGroupsList([]); +}; + + /** * optional int64 created_at = 14; * @return {number} @@ -1620,4 +1823,753 @@ proto.model.ProjectRBACConfig.prototype.setViewer = function(value) { }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.model.ProjectUserGroup.prototype.toObject = function(opt_includeInstance) { + return proto.model.ProjectUserGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.model.ProjectUserGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectUserGroup.toObject = function(includeInstance, msg) { + var f, obj = { + ssoGroup: jspb.Message.getFieldWithDefault(msg, 1, ""), + role: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.model.ProjectUserGroup} + */ +proto.model.ProjectUserGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.model.ProjectUserGroup; + return proto.model.ProjectUserGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.model.ProjectUserGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.model.ProjectUserGroup} + */ +proto.model.ProjectUserGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setSsoGroup(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setRole(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.model.ProjectUserGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.model.ProjectUserGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.model.ProjectUserGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectUserGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSsoGroup(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getRole(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string sso_group = 1; + * @return {string} + */ +proto.model.ProjectUserGroup.prototype.getSsoGroup = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.model.ProjectUserGroup} returns this + */ +proto.model.ProjectUserGroup.prototype.setSsoGroup = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string role = 2; + * @return {string} + */ +proto.model.ProjectUserGroup.prototype.getRole = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.model.ProjectUserGroup} returns this + */ +proto.model.ProjectUserGroup.prototype.setRole = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.model.ProjectRBACRole.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.model.ProjectRBACRole.prototype.toObject = function(opt_includeInstance) { + return proto.model.ProjectRBACRole.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.model.ProjectRBACRole} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectRBACRole.toObject = function(includeInstance, msg) { + var f, obj = { + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + policyList: jspb.Message.toObjectList(msg.getPolicyList(), + proto.model.ProjectRBACPolicy.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.model.ProjectRBACRole} + */ +proto.model.ProjectRBACRole.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.model.ProjectRBACRole; + return proto.model.ProjectRBACRole.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.model.ProjectRBACRole} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.model.ProjectRBACRole} + */ +proto.model.ProjectRBACRole.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + case 2: + var value = new proto.model.ProjectRBACPolicy; + reader.readMessage(value,proto.model.ProjectRBACPolicy.deserializeBinaryFromReader); + msg.addPolicy(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.model.ProjectRBACRole.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.model.ProjectRBACRole.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.model.ProjectRBACRole} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectRBACRole.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getPolicyList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 2, + f, + proto.model.ProjectRBACPolicy.serializeBinaryToWriter + ); + } +}; + + +/** + * optional string name = 1; + * @return {string} + */ +proto.model.ProjectRBACRole.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.model.ProjectRBACRole} returns this + */ +proto.model.ProjectRBACRole.prototype.setName = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * repeated ProjectRBACPolicy policy = 2; + * @return {!Array} + */ +proto.model.ProjectRBACRole.prototype.getPolicyList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.model.ProjectRBACPolicy, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.model.ProjectRBACRole} returns this +*/ +proto.model.ProjectRBACRole.prototype.setPolicyList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 2, value); +}; + + +/** + * @param {!proto.model.ProjectRBACPolicy=} opt_value + * @param {number=} opt_index + * @return {!proto.model.ProjectRBACPolicy} + */ +proto.model.ProjectRBACRole.prototype.addPolicy = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 2, opt_value, proto.model.ProjectRBACPolicy, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.model.ProjectRBACRole} returns this + */ +proto.model.ProjectRBACRole.prototype.clearPolicyList = function() { + return this.setPolicyList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.model.ProjectRBACResource.prototype.toObject = function(opt_includeInstance) { + return proto.model.ProjectRBACResource.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.model.ProjectRBACResource} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectRBACResource.toObject = function(includeInstance, msg) { + var f, obj = { + type: jspb.Message.getFieldWithDefault(msg, 1, 0), + labelsMap: (f = msg.getLabelsMap()) ? f.toObject(includeInstance, undefined) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.model.ProjectRBACResource} + */ +proto.model.ProjectRBACResource.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.model.ProjectRBACResource; + return proto.model.ProjectRBACResource.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.model.ProjectRBACResource} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.model.ProjectRBACResource} + */ +proto.model.ProjectRBACResource.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.model.ProjectRBACResource.ResourceType} */ (reader.readEnum()); + msg.setType(value); + break; + case 2: + var value = msg.getLabelsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.model.ProjectRBACResource.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.model.ProjectRBACResource.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.model.ProjectRBACResource} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectRBACResource.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getType(); + if (f !== 0.0) { + writer.writeEnum( + 1, + f + ); + } + f = message.getLabelsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } +}; + + +/** + * @enum {number} + */ +proto.model.ProjectRBACResource.ResourceType = { + APPLICATION: 0, + DEPLOYMENT: 1, + EVENT: 2, + PIPED: 3, + DEPLOYMENT_CHAIN: 4, + PROJECT: 5, + API_KEY: 6, + INSIGHT: 7 +}; + +/** + * optional ResourceType type = 1; + * @return {!proto.model.ProjectRBACResource.ResourceType} + */ +proto.model.ProjectRBACResource.prototype.getType = function() { + return /** @type {!proto.model.ProjectRBACResource.ResourceType} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {!proto.model.ProjectRBACResource.ResourceType} value + * @return {!proto.model.ProjectRBACResource} returns this + */ +proto.model.ProjectRBACResource.prototype.setType = function(value) { + return jspb.Message.setProto3EnumField(this, 1, value); +}; + + +/** + * map labels = 2; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.model.ProjectRBACResource.prototype.getLabelsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 2, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.model.ProjectRBACResource} returns this + */ +proto.model.ProjectRBACResource.prototype.clearLabelsMap = function() { + this.getLabelsMap().clear(); + return this;}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.model.ProjectRBACPolicy.repeatedFields_ = [1,2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.model.ProjectRBACPolicy.prototype.toObject = function(opt_includeInstance) { + return proto.model.ProjectRBACPolicy.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.model.ProjectRBACPolicy} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectRBACPolicy.toObject = function(includeInstance, msg) { + var f, obj = { + resourcesList: jspb.Message.toObjectList(msg.getResourcesList(), + proto.model.ProjectRBACResource.toObject, includeInstance), + actionsList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.model.ProjectRBACPolicy} + */ +proto.model.ProjectRBACPolicy.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.model.ProjectRBACPolicy; + return proto.model.ProjectRBACPolicy.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.model.ProjectRBACPolicy} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.model.ProjectRBACPolicy} + */ +proto.model.ProjectRBACPolicy.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.model.ProjectRBACResource; + reader.readMessage(value,proto.model.ProjectRBACResource.deserializeBinaryFromReader); + msg.addResources(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readPackedEnum() : [reader.readEnum()]); + for (var i = 0; i < values.length; i++) { + msg.addActions(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.model.ProjectRBACPolicy.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.model.ProjectRBACPolicy.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.model.ProjectRBACPolicy} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.model.ProjectRBACPolicy.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getResourcesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.model.ProjectRBACResource.serializeBinaryToWriter + ); + } + f = message.getActionsList(); + if (f.length > 0) { + writer.writePackedEnum( + 2, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.model.ProjectRBACPolicy.Action = { + GET: 0, + LIST: 1, + CREATE: 2, + UPDATE: 3, + DELETE: 4 +}; + +/** + * repeated ProjectRBACResource resources = 1; + * @return {!Array} + */ +proto.model.ProjectRBACPolicy.prototype.getResourcesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.model.ProjectRBACResource, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.model.ProjectRBACPolicy} returns this +*/ +proto.model.ProjectRBACPolicy.prototype.setResourcesList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.model.ProjectRBACResource=} opt_value + * @param {number=} opt_index + * @return {!proto.model.ProjectRBACResource} + */ +proto.model.ProjectRBACPolicy.prototype.addResources = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.model.ProjectRBACResource, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.model.ProjectRBACPolicy} returns this + */ +proto.model.ProjectRBACPolicy.prototype.clearResourcesList = function() { + return this.setResourcesList([]); +}; + + +/** + * repeated Action actions = 2; + * @return {!Array} + */ +proto.model.ProjectRBACPolicy.prototype.getActionsList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.model.ProjectRBACPolicy} returns this + */ +proto.model.ProjectRBACPolicy.prototype.setActionsList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {!proto.model.ProjectRBACPolicy.Action} value + * @param {number=} opt_index + * @return {!proto.model.ProjectRBACPolicy} returns this + */ +proto.model.ProjectRBACPolicy.prototype.addActions = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.model.ProjectRBACPolicy} returns this + */ +proto.model.ProjectRBACPolicy.prototype.clearActionsList = function() { + return this.setActionsList([]); +}; + + goog.object.extend(exports, proto.model); diff --git a/web/src/__fixtures__/dummy-project.ts b/web/src/__fixtures__/dummy-project.ts index 0733035c76..d477c6b61e 100644 --- a/web/src/__fixtures__/dummy-project.ts +++ b/web/src/__fixtures__/dummy-project.ts @@ -25,6 +25,8 @@ export const dummyProject: Project.AsObject = { editor: "editor-team", viewer: "viewer-team", }, + rbacRolesList: [], + userGroupsList: [], staticAdmin: { username: "static-admin-user", passwordHash: randomKeyHash(),