diff --git a/perxis-proto b/perxis-proto index b2ac7b057b6e815506d40f9ae41ad16733859d7b..d726595953e28a01e85401dc955dd9a7009ec3cc 160000 --- a/perxis-proto +++ b/perxis-proto @@ -1 +1 @@ -Subproject commit b2ac7b057b6e815506d40f9ae41ad16733859d7b +Subproject commit d726595953e28a01e85401dc955dd9a7009ec3cc diff --git a/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go b/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go index bad21c1b4d45655d872771d3ea3656c09ff36b29..115dc059cd4cf1dd0b1712e91abe185af871a9ad 100644 --- a/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go +++ b/pkg/clients/transport/grpc/protobuf_type_converters.microgen.go @@ -142,6 +142,7 @@ func PtrPermissionRuleToProto(rule *permission.Rule) (*commonpb.Rule, error) { WriteFilter: rule.WriteFilter, DenyReadFields: rule.DenyReadFields, DenyWriteFields: rule.DenyWriteFields, + Hidden: rule.Hidden, }, nil } @@ -162,6 +163,7 @@ func ProtoToPtrPermissionRule(protoRule *commonpb.Rule) (*permission.Rule, error DenyWriteFields: protoRule.DenyWriteFields, ReadFilter: protoRule.ReadFilter, WriteFilter: protoRule.WriteFilter, + Hidden: protoRule.Hidden, } if len(r.DenyReadFields) == 0 { r.DenyReadFields = protoRule.WriteonlyFields diff --git a/pkg/permission/ruleset.go b/pkg/permission/ruleset.go index e1a02d269cd3951f782cf8aec9d661e2c8f0ceef..55c6fe6be4e152e7361fd3ec0e9cd2aefd82cbfd 100644 --- a/pkg/permission/ruleset.go +++ b/pkg/permission/ruleset.go @@ -29,6 +29,8 @@ type Rule struct { // Дополнительный фильтр ReadFilter string `json:"readFilter,omitempty" bson:"readFilter,omitempty"` WriteFilter string `json:"writeFilter,omitempty" bson:"writeFilter,omitempty"` + // Скрывать в UI + Hidden bool `json:"hidden,omitempty" bson:"hidden,omitempty"` } func NewRule(collectionID string, actions ...Action) *Rule { @@ -48,6 +50,7 @@ func (r Rule) Clone() *Rule { DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: r.ReadFilter, WriteFilter: r.WriteFilter, + Hidden: r.Hidden, } } @@ -61,6 +64,7 @@ func (r Rule) WithReadFilter(f string) *Rule { DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: f, WriteFilter: r.WriteFilter, + Hidden: r.Hidden, } } @@ -74,6 +78,7 @@ func (r Rule) WithWriteFilter(f string) *Rule { DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: r.ReadFilter, WriteFilter: f, + Hidden: r.Hidden, } } @@ -87,6 +92,7 @@ func (r Rule) WithReadWriteFilter(f string) *Rule { DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: f, WriteFilter: f, + Hidden: r.Hidden, } } @@ -100,6 +106,7 @@ func (r Rule) WithReadonlyFields(ff ...string) *Rule { DenyReadFields: append([]string(nil), r.DenyReadFields...), ReadFilter: r.ReadFilter, WriteFilter: r.WriteFilter, + Hidden: r.Hidden, } } @@ -113,6 +120,7 @@ func (r Rule) WithHiddenFields(ff ...string) *Rule { DenyWriteFields: append([]string(nil), r.DenyWriteFields...), ReadFilter: r.ReadFilter, WriteFilter: r.WriteFilter, + Hidden: r.Hidden, } } diff --git a/proto/common/common.pb.go b/proto/common/common.pb.go index 3495031fb399fabaa59992460d63f40654e69f3e..81aaac09c04ea7c95ed732e06f9fd247bf5e8b71 100644 --- a/proto/common/common.pb.go +++ b/proto/common/common.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.3 +// protoc-gen-go v1.31.0 +// protoc v5.28.1 // source: common/common.proto package common @@ -302,6 +302,8 @@ type Rule struct { WriteFilter string `protobuf:"bytes,9,opt,name=write_filter,json=writeFilter,proto3" json:"write_filter,omitempty"` DenyReadFields []string `protobuf:"bytes,10,rep,name=deny_read_fields,json=denyReadFields,proto3" json:"deny_read_fields,omitempty"` DenyWriteFields []string `protobuf:"bytes,11,rep,name=deny_write_fields,json=denyWriteFields,proto3" json:"deny_write_fields,omitempty"` + // признак надо ли скрывать поле в UI + Hidden bool `protobuf:"varint,12,opt,name=hidden,proto3" json:"hidden,omitempty"` } func (x *Rule) Reset() { @@ -406,6 +408,13 @@ func (x *Rule) GetDenyWriteFields() []string { return nil } +func (x *Rule) GetHidden() bool { + if x != nil { + return x.Hidden + } + return false +} + type Collaborator struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -573,7 +582,7 @@ var file_common_common_proto_rawDesc = []byte{ 0x65, 0x6c, 0x64, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, - 0x69, 0x74, 0x22, 0x90, 0x03, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, + 0x69, 0x74, 0x22, 0xa8, 0x03, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, @@ -598,34 +607,35 @@ var file_common_common_proto_rawDesc = []byte{ 0x65, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6e, 0x79, 0x57, 0x72, 0x69, 0x74, 0x65, 0x46, - 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, - 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, - 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0xab, - 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x69, 0x6d, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25, 0x0a, 0x06, - 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, - 0x08, 0x0a, 0x04, 0x4d, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x4f, 0x4c, - 0x45, 0x10, 0x02, 0x2a, 0x43, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, - 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x52, - 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 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, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x2e, - 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, - 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x68, 0x69, 0x64, 0x64, 0x65, 0x6e, 0x22, 0x57, 0x0a, + 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x19, 0x0a, + 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, + 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, + 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, + 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, + 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, + 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, + 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, + 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x07, + 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x49, 0x4e, 0x45, 0x10, + 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x2a, 0x43, 0x0a, 0x06, 0x41, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x08, + 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 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, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x2e, 0x72, 0x75, 0x2f, + 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2d, 0x67, 0x6f, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x3b, 0x63, 0x6f, + 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -642,7 +652,7 @@ func file_common_common_proto_rawDescGZIP() []byte { var file_common_common_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_common_common_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_common_common_proto_goTypes = []any{ +var file_common_common_proto_goTypes = []interface{}{ (Access)(0), // 0: common.Access (Action)(0), // 1: common.Action (*Filter)(nil), // 2: common.Filter @@ -669,7 +679,7 @@ func file_common_common_proto_init() { return } if !protoimpl.UnsafeEnabled { - file_common_common_proto_msgTypes[0].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Filter); i { case 0: return &v.state @@ -681,7 +691,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[1].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FindOptions); i { case 0: return &v.state @@ -693,7 +703,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[2].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Rule); i { case 0: return &v.state @@ -705,7 +715,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[3].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Collaborator); i { case 0: return &v.state @@ -717,7 +727,7 @@ func file_common_common_proto_init() { return nil } } - file_common_common_proto_msgTypes[4].Exporter = func(v any, i int) any { + file_common_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Version); i { case 0: return &v.state