Skip to content
Snippets Groups Projects
Commit fd42f285 authored by Pavel Antonov's avatar Pavel Antonov :asterisk:
Browse files

Merge branch 'feature/PRXS-1726-RulesFieldsChangeNames' into 'master'

Изменено название полей ReadonlyFields/WriteonlyFields на DenyWriteFields/DenyReadFields для Rules, перегенированы файлы

See merge request perxis/perxis-go!120
parents 64369cc6 17275cca
No related branches found
No related tags found
No related merge requests found
Showing with 699 additions and 266 deletions
Subproject commit 59b21fcd765d2a6208f65dccdd04a63e55a0016e Subproject commit ecd756865a06583ce52bff6265c0fd5e159d93b9
...@@ -136,10 +136,12 @@ func PtrPermissionRuleToProto(rule *permission.Rule) (*commonpb.Rule, error) { ...@@ -136,10 +136,12 @@ func PtrPermissionRuleToProto(rule *permission.Rule) (*commonpb.Rule, error) {
Actions: actions, Actions: actions,
Access: commonpb.Access(rule.Access), Access: commonpb.Access(rule.Access),
HiddenFields: rule.HiddenFields, HiddenFields: rule.HiddenFields,
ReadonlyFields: rule.ReadonlyFields, ReadonlyFields: rule.DenyWriteFields,
WriteonlyFields: rule.WriteonlyFields, WriteonlyFields: rule.DenyReadFields,
ReadFilter: rule.ReadFilter, ReadFilter: rule.ReadFilter,
WriteFilter: rule.WriteFilter, WriteFilter: rule.WriteFilter,
DenyReadFields: rule.DenyReadFields,
DenyWriteFields: rule.DenyWriteFields,
}, nil }, nil
} }
...@@ -151,14 +153,21 @@ func ProtoToPtrPermissionRule(protoRule *commonpb.Rule) (*permission.Rule, error ...@@ -151,14 +153,21 @@ func ProtoToPtrPermissionRule(protoRule *commonpb.Rule) (*permission.Rule, error
for _, a := range protoRule.Actions { for _, a := range protoRule.Actions {
actions = append(actions, permission.Action(a)) actions = append(actions, permission.Action(a))
} }
return &permission.Rule{ r := &permission.Rule{
CollectionID: protoRule.CollectionId, CollectionID: protoRule.CollectionId,
Actions: actions, Actions: actions,
Access: permission.Access(protoRule.Access), Access: permission.Access(protoRule.Access),
HiddenFields: protoRule.HiddenFields, HiddenFields: protoRule.HiddenFields,
ReadonlyFields: protoRule.ReadonlyFields, DenyReadFields: protoRule.DenyReadFields,
WriteonlyFields: protoRule.WriteonlyFields, DenyWriteFields: protoRule.DenyWriteFields,
ReadFilter: protoRule.ReadFilter, ReadFilter: protoRule.ReadFilter,
WriteFilter: protoRule.WriteFilter, WriteFilter: protoRule.WriteFilter,
}, nil }
if len(r.DenyReadFields) == 0 {
r.DenyReadFields = protoRule.WriteonlyFields
}
if len(r.DenyWriteFields) == 0 {
r.DenyWriteFields = protoRule.ReadonlyFields
}
return r, nil
} }
...@@ -20,8 +20,8 @@ type Config struct { ...@@ -20,8 +20,8 @@ type Config struct {
type Access struct { type Access struct {
Actions []permission.Action // Список разрешенных действия с элементами коллекции Actions []permission.Action // Список разрешенных действия с элементами коллекции
HiddenFields []string // Поля не отображаемые в интерфейсе и не возвращаемые API HiddenFields []string // Поля не отображаемые в интерфейсе и не возвращаемые API
ReadonlyFields []string // Поля недоступные для редактирования и не обновляемые через API DenyReadFields []string // Поля недоступные для редактирования и не обновляемые через API
WriteonlyFields []string // Поля отображаемые в интерфейсе, но не возвращаемые в API DenyWriteFields []string // Поля отображаемые в интерфейсе, но не возвращаемые в API
} }
func (a Access) Clone() *Access { func (a Access) Clone() *Access {
...@@ -29,14 +29,14 @@ func (a Access) Clone() *Access { ...@@ -29,14 +29,14 @@ func (a Access) Clone() *Access {
clone := &Access{ clone := &Access{
Actions: make([]permission.Action, len(a.Actions)), Actions: make([]permission.Action, len(a.Actions)),
HiddenFields: make([]string, len(a.HiddenFields)), HiddenFields: make([]string, len(a.HiddenFields)),
ReadonlyFields: make([]string, len(a.ReadonlyFields)), DenyReadFields: make([]string, len(a.DenyReadFields)),
WriteonlyFields: make([]string, len(a.WriteonlyFields)), DenyWriteFields: make([]string, len(a.DenyWriteFields)),
} }
copy(clone.Actions, a.Actions) copy(clone.Actions, a.Actions)
copy(clone.HiddenFields, a.HiddenFields) copy(clone.HiddenFields, a.HiddenFields)
copy(clone.ReadonlyFields, a.ReadonlyFields) copy(clone.DenyReadFields, a.DenyReadFields)
copy(clone.WriteonlyFields, a.WriteonlyFields) copy(clone.DenyWriteFields, a.DenyWriteFields)
return clone return clone
} }
......
...@@ -54,8 +54,10 @@ func PtrCollectionToProto(coll *service.Collection) (*pb.Collection, error) { ...@@ -54,8 +54,10 @@ func PtrCollectionToProto(coll *service.Collection) (*pb.Collection, error) {
access = &pb.Access{ access = &pb.Access{
Actions: actions, Actions: actions,
HiddenFields: coll.Access.HiddenFields, HiddenFields: coll.Access.HiddenFields,
ReadonlyFields: coll.Access.ReadonlyFields, ReadonlyFields: coll.Access.DenyReadFields,
WriteonlyFields: coll.Access.WriteonlyFields, WriteonlyFields: coll.Access.DenyWriteFields,
DenyReadFields: coll.Access.DenyReadFields,
DenyWriteFields: coll.Access.DenyWriteFields,
} }
} }
protoCollection := &pb.Collection{ protoCollection := &pb.Collection{
...@@ -112,8 +114,14 @@ func ProtoToPtrCollection(protoCollection *pb.Collection) (*service.Collection, ...@@ -112,8 +114,14 @@ func ProtoToPtrCollection(protoCollection *pb.Collection) (*service.Collection,
access = &service.Access{ access = &service.Access{
Actions: actions, Actions: actions,
HiddenFields: protoCollection.Access.HiddenFields, HiddenFields: protoCollection.Access.HiddenFields,
ReadonlyFields: protoCollection.Access.ReadonlyFields, DenyReadFields: protoCollection.Access.DenyReadFields,
WriteonlyFields: protoCollection.Access.WriteonlyFields, DenyWriteFields: protoCollection.Access.DenyWriteFields,
}
if len(access.DenyReadFields) == 0 {
access.DenyReadFields = protoCollection.Access.WriteonlyFields
}
if len(access.DenyWriteFields) == 0 {
access.DenyWriteFields = protoCollection.Access.ReadonlyFields
} }
} }
collection := &service.Collection{ collection := &service.Collection{
......
...@@ -22,10 +22,10 @@ type Rule struct { ...@@ -22,10 +22,10 @@ type Rule struct {
Access Access `json:"access" bson:"access,omitempty"` Access Access `json:"access" bson:"access,omitempty"`
// Поля не передаются API клиенту // Поля не передаются API клиенту
HiddenFields []string `json:"hiddenFields,omitempty" bson:"hiddenFields,omitempty"` HiddenFields []string `json:"hiddenFields,omitempty" bson:"hiddenFields,omitempty"`
// Клиент не может сохранять данные поля
ReadonlyFields []string `json:"readonlyFields,omitempty" bson:"readonlyFields,omitempty"`
// Клиент может сохранить данные поля, но поля не передаются в API // Клиент может сохранить данные поля, но поля не передаются в API
WriteonlyFields []string `json:"writeonlyFields,omitempty" bson:"writeonlyFields,omitempty"` DenyReadFields []string `json:"denyReadFields,omitempty" bson:"denyReadFields,omitempty"`
// Клиент не может сохранять данные поля
DenyWriteFields []string `json:"denyWriteFields,omitempty" bson:"denyWriteFields,omitempty"`
// Дополнительный фильтр // Дополнительный фильтр
ReadFilter string `json:"readFilter,omitempty" bson:"readFilter,omitempty"` ReadFilter string `json:"readFilter,omitempty" bson:"readFilter,omitempty"`
WriteFilter string `json:"writeFilter,omitempty" bson:"writeFilter,omitempty"` WriteFilter string `json:"writeFilter,omitempty" bson:"writeFilter,omitempty"`
...@@ -44,8 +44,8 @@ func (r Rule) Clone() *Rule { ...@@ -44,8 +44,8 @@ func (r Rule) Clone() *Rule {
Actions: append([]Action(nil), r.Actions...), Actions: append([]Action(nil), r.Actions...),
Access: r.Access, Access: r.Access,
HiddenFields: append([]string(nil), r.HiddenFields...), HiddenFields: append([]string(nil), r.HiddenFields...),
ReadonlyFields: append([]string(nil), r.ReadonlyFields...), DenyReadFields: append([]string(nil), r.DenyReadFields...),
WriteonlyFields: append([]string(nil), r.WriteonlyFields...), DenyWriteFields: append([]string(nil), r.DenyWriteFields...),
ReadFilter: r.ReadFilter, ReadFilter: r.ReadFilter,
WriteFilter: r.WriteFilter, WriteFilter: r.WriteFilter,
} }
...@@ -57,8 +57,8 @@ func (r Rule) WithReadFilter(f string) *Rule { ...@@ -57,8 +57,8 @@ func (r Rule) WithReadFilter(f string) *Rule {
Actions: append([]Action(nil), r.Actions...), Actions: append([]Action(nil), r.Actions...),
Access: r.Access, Access: r.Access,
HiddenFields: append([]string(nil), r.HiddenFields...), HiddenFields: append([]string(nil), r.HiddenFields...),
ReadonlyFields: append([]string(nil), r.ReadonlyFields...), DenyReadFields: append([]string(nil), r.DenyReadFields...),
WriteonlyFields: append([]string(nil), r.WriteonlyFields...), DenyWriteFields: append([]string(nil), r.DenyWriteFields...),
ReadFilter: f, ReadFilter: f,
WriteFilter: r.WriteFilter, WriteFilter: r.WriteFilter,
} }
...@@ -70,8 +70,8 @@ func (r Rule) WithWriteFilter(f string) *Rule { ...@@ -70,8 +70,8 @@ func (r Rule) WithWriteFilter(f string) *Rule {
Actions: append([]Action(nil), r.Actions...), Actions: append([]Action(nil), r.Actions...),
Access: r.Access, Access: r.Access,
HiddenFields: append([]string(nil), r.HiddenFields...), HiddenFields: append([]string(nil), r.HiddenFields...),
ReadonlyFields: append([]string(nil), r.ReadonlyFields...), DenyReadFields: append([]string(nil), r.DenyReadFields...),
WriteonlyFields: append([]string(nil), r.WriteonlyFields...), DenyWriteFields: append([]string(nil), r.DenyWriteFields...),
ReadFilter: r.ReadFilter, ReadFilter: r.ReadFilter,
WriteFilter: f, WriteFilter: f,
} }
...@@ -83,8 +83,8 @@ func (r Rule) WithReadWriteFilter(f string) *Rule { ...@@ -83,8 +83,8 @@ func (r Rule) WithReadWriteFilter(f string) *Rule {
Actions: append([]Action(nil), r.Actions...), Actions: append([]Action(nil), r.Actions...),
Access: r.Access, Access: r.Access,
HiddenFields: append([]string(nil), r.HiddenFields...), HiddenFields: append([]string(nil), r.HiddenFields...),
ReadonlyFields: append([]string(nil), r.ReadonlyFields...), DenyReadFields: append([]string(nil), r.DenyReadFields...),
WriteonlyFields: append([]string(nil), r.WriteonlyFields...), DenyWriteFields: append([]string(nil), r.DenyWriteFields...),
ReadFilter: f, ReadFilter: f,
WriteFilter: f, WriteFilter: f,
} }
...@@ -96,8 +96,8 @@ func (r Rule) WithReadonlyFields(ff ...string) *Rule { ...@@ -96,8 +96,8 @@ func (r Rule) WithReadonlyFields(ff ...string) *Rule {
Actions: append([]Action(nil), r.Actions...), Actions: append([]Action(nil), r.Actions...),
Access: r.Access, Access: r.Access,
HiddenFields: append([]string(nil), r.HiddenFields...), HiddenFields: append([]string(nil), r.HiddenFields...),
ReadonlyFields: append(ff, r.ReadonlyFields...), DenyWriteFields: append(ff, r.DenyWriteFields...),
WriteonlyFields: append([]string(nil), r.WriteonlyFields...), DenyReadFields: append([]string(nil), r.DenyReadFields...),
ReadFilter: r.ReadFilter, ReadFilter: r.ReadFilter,
WriteFilter: r.WriteFilter, WriteFilter: r.WriteFilter,
} }
...@@ -109,8 +109,8 @@ func (r Rule) WithHiddenFields(ff ...string) *Rule { ...@@ -109,8 +109,8 @@ func (r Rule) WithHiddenFields(ff ...string) *Rule {
Actions: append([]Action(nil), r.Actions...), Actions: append([]Action(nil), r.Actions...),
Access: r.Access, Access: r.Access,
HiddenFields: append(ff, r.HiddenFields...), HiddenFields: append(ff, r.HiddenFields...),
ReadonlyFields: append([]string(nil), r.ReadonlyFields...), DenyReadFields: append([]string(nil), r.DenyReadFields...),
WriteonlyFields: append([]string(nil), r.WriteonlyFields...), DenyWriteFields: append([]string(nil), r.DenyWriteFields...),
ReadFilter: r.ReadFilter, ReadFilter: r.ReadFilter,
WriteFilter: r.WriteFilter, WriteFilter: r.WriteFilter,
} }
...@@ -127,10 +127,10 @@ func (r Rule) GetPermission(action Action) *Permission { ...@@ -127,10 +127,10 @@ func (r Rule) GetPermission(action Action) *Permission {
case ActionRead: case ActionRead:
p.Filter = r.ReadFilter p.Filter = r.ReadFilter
p.UnallowedFields = append(p.UnallowedFields, r.HiddenFields...) p.UnallowedFields = append(p.UnallowedFields, r.HiddenFields...)
p.UnallowedFields = append(p.UnallowedFields, r.WriteonlyFields...) p.UnallowedFields = append(p.UnallowedFields, r.DenyReadFields...)
case ActionCreate, ActionUpdate, ActionDelete: case ActionCreate, ActionUpdate, ActionDelete:
p.Filter = r.WriteFilter p.Filter = r.WriteFilter
p.UnallowedFields = append(p.UnallowedFields, r.ReadonlyFields...) p.UnallowedFields = append(p.UnallowedFields, r.DenyWriteFields...)
} }
p.UnallowedFields = data.SetFromSlice(p.UnallowedFields) p.UnallowedFields = data.SetFromSlice(p.UnallowedFields)
...@@ -216,8 +216,8 @@ func MergeRule(rules ...*Rule) *Rule { ...@@ -216,8 +216,8 @@ func MergeRule(rules ...*Rule) *Rule {
result.Actions = data.GetIntersection(result.Actions, r.Actions) result.Actions = data.GetIntersection(result.Actions, r.Actions)
result.HiddenFields = data.SetFromSlice(append(result.HiddenFields, r.HiddenFields...)) result.HiddenFields = data.SetFromSlice(append(result.HiddenFields, r.HiddenFields...))
result.ReadonlyFields = data.SetFromSlice(append(result.ReadonlyFields, r.ReadonlyFields...)) result.DenyReadFields = data.SetFromSlice(append(result.DenyReadFields, r.DenyReadFields...))
result.WriteonlyFields = data.SetFromSlice(append(result.WriteonlyFields, r.WriteonlyFields...)) result.DenyWriteFields = data.SetFromSlice(append(result.DenyWriteFields, r.DenyWriteFields...))
if r.WriteFilter != "" { if r.WriteFilter != "" {
writeFilter = append(writeFilter, r.WriteFilter) writeFilter = append(writeFilter, r.WriteFilter)
} }
...@@ -246,8 +246,8 @@ func (r PrivilegedRuleset) GetRule(collectionID string) *Rule { ...@@ -246,8 +246,8 @@ func (r PrivilegedRuleset) GetRule(collectionID string) *Rule {
CollectionID: collectionID, CollectionID: collectionID,
Actions: []Action{ActionRead, ActionCreate, ActionUpdate, ActionDelete}, Actions: []Action{ActionRead, ActionCreate, ActionUpdate, ActionDelete},
HiddenFields: []string{}, HiddenFields: []string{},
ReadonlyFields: []string{}, DenyReadFields: []string{},
WriteonlyFields: []string{}, DenyWriteFields: []string{},
} }
} }
......
...@@ -18,21 +18,21 @@ func TestMerge(t *testing.T) { ...@@ -18,21 +18,21 @@ func TestMerge(t *testing.T) {
}{ }{
{ {
name: "simple", name: "simple",
first: &Rule{Actions: []Action{ActionUpdate, ActionCreate}, CollectionID: col1, HiddenFields: []string{"1", "2"}, WriteonlyFields: []string{"7"}, ReadonlyFields: []string{"4"}, ReadFilter: "3 != 'test'", WriteFilter: "4 == '0_0'"}, first: &Rule{Actions: []Action{ActionUpdate, ActionCreate}, CollectionID: col1, HiddenFields: []string{"1", "2"}, DenyWriteFields: []string{"7"}, DenyReadFields: []string{"4"}, ReadFilter: "3 != 'test'", WriteFilter: "4 == '0_0'"},
second: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col2, HiddenFields: []string{"3", "2"}, WriteonlyFields: []string{}, ReadonlyFields: []string{"5"}, ReadFilter: "5 != 'dev'", WriteFilter: "4 == '0_0'"}, second: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col2, HiddenFields: []string{"3", "2"}, DenyWriteFields: []string{}, DenyReadFields: []string{"5"}, ReadFilter: "5 != 'dev'", WriteFilter: "4 == '0_0'"},
expect: &Rule{Actions: []Action{ActionUpdate}, HiddenFields: []string{"1", "2", "3"}, WriteonlyFields: []string{"7"}, ReadonlyFields: []string{"4", "5"}, ReadFilter: "3 != 'test' && 5 != 'dev'", WriteFilter: "4 == '0_0'"}, expect: &Rule{Actions: []Action{ActionUpdate}, HiddenFields: []string{"1", "2", "3"}, DenyWriteFields: []string{"7"}, DenyReadFields: []string{"4", "5"}, ReadFilter: "3 != 'test' && 5 != 'dev'", WriteFilter: "4 == '0_0'"},
}, },
{ {
name: "first is privileged", name: "first is privileged",
first: PrivilegedRuleset{}.GetRule(col1), first: PrivilegedRuleset{}.GetRule(col1),
second: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col2, WriteFilter: "test"}, second: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col2, WriteFilter: "test"},
expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, WriteonlyFields: []string{}, ReadonlyFields: []string{}}, expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, DenyWriteFields: []string{}, DenyReadFields: []string{}},
}, },
{ {
name: "second is privileged", name: "second is privileged",
first: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col1, WriteFilter: "test"}, first: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, CollectionID: col1, WriteFilter: "test"},
second: PrivilegedRuleset{}.GetRule(col2), second: PrivilegedRuleset{}.GetRule(col2),
expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, WriteonlyFields: []string{}, ReadonlyFields: []string{}}, expect: &Rule{Actions: []Action{ActionUpdate, ActionDelete}, WriteFilter: "test", ReadFilter: "", HiddenFields: []string{}, DenyWriteFields: []string{}, DenyReadFields: []string{}},
}, },
{ {
name: "both is privileged", name: "both is privileged",
...@@ -61,25 +61,25 @@ func TestRule_GetPermission(t *testing.T) { ...@@ -61,25 +61,25 @@ func TestRule_GetPermission(t *testing.T) {
{ {
name: "ActionRead", name: "ActionRead",
action: ActionRead, action: ActionRead,
rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f3"}}, rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f3"}},
unallowedFields: []string{"f2", "f3"}, unallowedFields: []string{"f2", "f3"},
}, },
{ {
name: "ActionRead readonly&writeonly", name: "ActionRead readonly&writeonly",
action: ActionRead, action: ActionRead,
rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f1"}}, rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f1"}},
unallowedFields: []string{"f1", "f2"}, unallowedFields: []string{"f1", "f2"},
}, },
{ {
name: "ActionUpdate", name: "ActionUpdate",
action: ActionUpdate, action: ActionUpdate,
rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f3"}}, rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f3"}},
unallowedFields: []string{"f1"}, unallowedFields: []string{"f1"},
}, },
{ {
name: "ActionUpdate readonly&writeonly", name: "ActionUpdate readonly&writeonly",
action: ActionUpdate, action: ActionUpdate,
rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, ReadonlyFields: []string{"f1"}, HiddenFields: []string{"f2"}, WriteonlyFields: []string{"f1"}}, rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f1"}},
unallowedFields: []string{"f1"}, unallowedFields: []string{"f1"},
}, },
} }
......
...@@ -82,10 +82,12 @@ func PtrPermissionRuleToProto(rule *permission.Rule) (*commonpb.Rule, error) { ...@@ -82,10 +82,12 @@ func PtrPermissionRuleToProto(rule *permission.Rule) (*commonpb.Rule, error) {
Actions: actions, Actions: actions,
Access: commonpb.Access(rule.Access), Access: commonpb.Access(rule.Access),
HiddenFields: rule.HiddenFields, HiddenFields: rule.HiddenFields,
ReadonlyFields: rule.ReadonlyFields, ReadonlyFields: rule.DenyWriteFields,
WriteonlyFields: rule.WriteonlyFields, WriteonlyFields: rule.DenyReadFields,
ReadFilter: rule.ReadFilter, ReadFilter: rule.ReadFilter,
WriteFilter: rule.WriteFilter, WriteFilter: rule.WriteFilter,
DenyReadFields: rule.DenyReadFields,
DenyWriteFields: rule.DenyWriteFields,
}, nil }, nil
} }
...@@ -97,14 +99,21 @@ func ProtoToPtrPermissionRule(protoRule *commonpb.Rule) (*permission.Rule, error ...@@ -97,14 +99,21 @@ func ProtoToPtrPermissionRule(protoRule *commonpb.Rule) (*permission.Rule, error
for _, a := range protoRule.Actions { for _, a := range protoRule.Actions {
actions = append(actions, permission.Action(a)) actions = append(actions, permission.Action(a))
} }
return &permission.Rule{ r := &permission.Rule{
CollectionID: protoRule.CollectionId, CollectionID: protoRule.CollectionId,
Actions: actions, Actions: actions,
Access: permission.Access(protoRule.Access), Access: permission.Access(protoRule.Access),
HiddenFields: protoRule.HiddenFields, HiddenFields: protoRule.HiddenFields,
ReadonlyFields: protoRule.ReadonlyFields, DenyReadFields: protoRule.DenyReadFields,
WriteonlyFields: protoRule.WriteonlyFields, DenyWriteFields: protoRule.DenyWriteFields,
ReadFilter: protoRule.ReadFilter, ReadFilter: protoRule.ReadFilter,
WriteFilter: protoRule.WriteFilter, WriteFilter: protoRule.WriteFilter,
}, nil }
if len(r.DenyReadFields) == 0 {
r.DenyReadFields = protoRule.WriteonlyFields
}
if len(r.DenyWriteFields) == 0 {
r.DenyWriteFields = protoRule.ReadonlyFields
}
return r, nil
} }
...@@ -2,13 +2,14 @@ package setup ...@@ -2,13 +2,14 @@ package setup
import ( import (
"context" "context"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/pkg/clients" "git.perx.ru/perxis/perxis-go/pkg/clients"
"git.perx.ru/perxis/perxis-go/pkg/collections" "git.perx.ru/perxis/perxis-go/pkg/collections"
"git.perx.ru/perxis/perxis-go/pkg/content" "git.perx.ru/perxis/perxis-go/pkg/content"
"git.perx.ru/perxis/perxis-go/pkg/errors"
"git.perx.ru/perxis/perxis-go/pkg/items" "git.perx.ru/perxis/perxis-go/pkg/items"
"git.perx.ru/perxis/perxis-go/pkg/roles" "git.perx.ru/perxis/perxis-go/pkg/roles"
"git.perx.ru/perxis/perxis-go/pkg/spaces"
"go.uber.org/zap" "go.uber.org/zap"
) )
...@@ -32,6 +33,10 @@ type Setup struct { ...@@ -32,6 +33,10 @@ type Setup struct {
force bool force bool
remove bool remove bool
waitSpaceAvailable bool
//attempts uint
//delay time.Duration
errors []error errors []error
logger *zap.Logger logger *zap.Logger
} }
...@@ -48,6 +53,7 @@ func NewSetup(content *content.Content, spaceID, environmentID string, logger *z ...@@ -48,6 +53,7 @@ func NewSetup(content *content.Content, spaceID, environmentID string, logger *z
EnvironmentID: environmentID, EnvironmentID: environmentID,
content: content, content: content,
logger: logger, logger: logger,
waitSpaceAvailable: true,
} }
} }
...@@ -71,6 +77,12 @@ func (s *Setup) IsRemove() bool { ...@@ -71,6 +77,12 @@ func (s *Setup) IsRemove() bool {
return s.remove return s.remove
} }
func (s *Setup) WithoutWaitSpace() *Setup {
setup := *s
setup.waitSpaceAvailable = false
return &setup
}
func (s *Setup) HasErrors() bool { func (s *Setup) HasErrors() bool {
return len(s.errors) > 0 return len(s.errors) > 0
} }
...@@ -146,6 +158,11 @@ func (s *Setup) AddItem(item *items.Item, opt ...ItemsOption) *Setup { ...@@ -146,6 +158,11 @@ func (s *Setup) AddItem(item *items.Item, opt ...ItemsOption) *Setup {
// Install выполняет установку необходимых требований // Install выполняет установку необходимых требований
func (s *Setup) Install(ctx context.Context) error { func (s *Setup) Install(ctx context.Context) error {
if s.waitSpaceAvailable {
if err := spaces.WaitSpaceAvailable(ctx, s.content.Spaces, s.SpaceID); err != nil {
return err
}
}
if err := s.InstallRoles(ctx); err != nil { if err := s.InstallRoles(ctx); err != nil {
return err return err
} }
...@@ -163,6 +180,11 @@ func (s *Setup) Install(ctx context.Context) error { ...@@ -163,6 +180,11 @@ func (s *Setup) Install(ctx context.Context) error {
// Check выполняет проверку требований // Check выполняет проверку требований
func (s *Setup) Check(ctx context.Context) error { func (s *Setup) Check(ctx context.Context) error {
if s.waitSpaceAvailable {
if err := spaces.WaitSpaceReadable(ctx, s.content.Spaces, s.SpaceID); err != nil {
return err
}
}
if err := s.CheckRoles(ctx); err != nil { if err := s.CheckRoles(ctx); err != nil {
return err return err
} }
...@@ -180,6 +202,11 @@ func (s *Setup) Check(ctx context.Context) error { ...@@ -180,6 +202,11 @@ func (s *Setup) Check(ctx context.Context) error {
// Uninstall выполняет удаление установленных раннее требований // Uninstall выполняет удаление установленных раннее требований
func (s *Setup) Uninstall(ctx context.Context) error { func (s *Setup) Uninstall(ctx context.Context) error {
if s.waitSpaceAvailable {
if err := spaces.WaitSpaceAvailable(ctx, s.content.Spaces, s.SpaceID); err != nil {
return err
}
}
// В случае если необходимо удалить данные удаляем все что создано при установке расширения // В случае если необходимо удалить данные удаляем все что создано при установке расширения
if err := s.UninstallClients(ctx); err != nil { if err := s.UninstallClients(ctx); err != nil {
return err return err
......
This diff is collapsed.
...@@ -2,8 +2,10 @@ package spaces ...@@ -2,8 +2,10 @@ package spaces
import ( import (
"context" "context"
"time"
"github.com/pkg/errors" "git.perx.ru/perxis/perxis-go/pkg/errors"
"github.com/avast/retry-go/v4"
) )
// @microgen grpc // @microgen grpc
...@@ -50,16 +52,57 @@ type Spaces interface { ...@@ -50,16 +52,57 @@ type Spaces interface {
Move(ctx context.Context, spaceID, orgID string) (err error) Move(ctx context.Context, spaceID, orgID string) (err error)
} }
func IsSpaceAvailable(ctx context.Context, spcs Spaces, spaceId string) error { const (
spc, err := spcs.Get(ctx, spaceId) delay = 500 * time.Millisecond
attempts = 1800
)
var (
ErrSpaceNotAvailable = errors.New("space not available")
)
func IsSpaceAvailable(ctx context.Context, svc Spaces, spaceID string) error {
sp, err := svc.Get(ctx, spaceID)
if err != nil { if err != nil {
return errors.Wrap(err, "space not available") return errors.Wrap(err, "fail to get space")
} }
if sp.StateInfo == nil || sp.StateInfo != nil && (sp.StateInfo.State == StateNew || sp.StateInfo.State == StateReady) {
if spc.StateInfo != nil && spc.StateInfo.State != StateReady { return nil
return errors.New("space not available") }
return ErrSpaceNotAvailable
} }
func IsSpaceReadable(ctx context.Context, svc Spaces, spaceID string) error {
sp, err := svc.Get(ctx, spaceID)
if err != nil {
return errors.Wrap(err, "fail to get space")
}
if sp.StateInfo == nil || sp.StateInfo != nil && sp.StateInfo.State == StateNew || sp.StateInfo.State == StateReady || sp.StateInfo.State == StateMigration {
return nil return nil
} }
return errors.WithContext(ErrSpaceNotAvailable, "state", sp.StateInfo.State)
}
func WaitSpaceAvailable(ctx context.Context, svc Spaces, spaceID string) error {
return retry.Do(
func() error {
return IsSpaceAvailable(ctx, svc, spaceID)
},
retry.RetryIf(func(err error) bool { return errors.Is(err, ErrSpaceNotAvailable) }),
retry.Delay(delay),
retry.Attempts(attempts),
retry.Context(ctx),
)
}
func WaitSpaceReadable(ctx context.Context, svc Spaces, spaceID string) error {
return retry.Do(
func() error {
return IsSpaceReadable(ctx, svc, spaceID)
},
retry.RetryIf(func(err error) bool { return errors.Is(err, ErrSpaceNotAvailable) }),
retry.Delay(delay),
retry.Attempts(attempts),
retry.Context(ctx),
)
}
...@@ -50,3 +50,40 @@ func TestIsSpaceAvailable(t *testing.T) { ...@@ -50,3 +50,40 @@ func TestIsSpaceAvailable(t *testing.T) {
}) })
} }
} }
func TestIsSpaceReadable(t *testing.T) {
tests := []struct {
name string
space *Space
wantErr bool
}{
{
"Space has nil StateInfo: available",
&Space{ID: "space", OrgID: "org", Name: "test-space"},
false,
},
{
"Space state is StateReady: available",
&Space{ID: "space", OrgID: "org", Name: "test-space", StateInfo: &StateInfo{State: StateReady}},
false,
},
{
"Space state is StatePreparing: not available",
&Space{ID: "space", OrgID: "org", Name: "test-space", StateInfo: &StateInfo{State: StatePreparing}},
true,
},
{
"Space state is StateMigration: not available",
&Space{ID: "space", OrgID: "org", Name: "test-space", StateInfo: &StateInfo{State: StateMigration}},
false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
spaces := &dummySpaces{space: tt.space}
if err := IsSpaceReadable(context.Background(), spaces, "space"); (err != nil) != tt.wantErr {
t.Errorf("IsSpaceReadable() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
This diff is collapsed.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.3.0 // - protoc-gen-go-grpc v1.3.0
// - protoc v4.24.3 // - protoc v4.25.1
// source: collections/collections.proto // source: collections/collections.proto
package collections package collections
......
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.31.0 // protoc-gen-go v1.31.0
// protoc v4.24.3 // protoc v4.25.1
// source: common/common.proto // source: common/common.proto
package common package common
...@@ -276,10 +276,13 @@ type Rule struct { ...@@ -276,10 +276,13 @@ type Rule struct {
Actions []Action `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=common.Action" json:"actions,omitempty"` Actions []Action `protobuf:"varint,2,rep,packed,name=actions,proto3,enum=common.Action" json:"actions,omitempty"`
Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=common.Access" json:"access,omitempty"` Access Access `protobuf:"varint,3,opt,name=access,proto3,enum=common.Access" json:"access,omitempty"`
HiddenFields []string `protobuf:"bytes,5,rep,name=hidden_fields,json=hiddenFields,proto3" json:"hidden_fields,omitempty"` HiddenFields []string `protobuf:"bytes,5,rep,name=hidden_fields,json=hiddenFields,proto3" json:"hidden_fields,omitempty"`
// Deprecated
ReadonlyFields []string `protobuf:"bytes,6,rep,name=readonly_fields,json=readonlyFields,proto3" json:"readonly_fields,omitempty"` ReadonlyFields []string `protobuf:"bytes,6,rep,name=readonly_fields,json=readonlyFields,proto3" json:"readonly_fields,omitempty"`
WriteonlyFields []string `protobuf:"bytes,7,rep,name=writeonly_fields,json=writeonlyFields,proto3" json:"writeonly_fields,omitempty"` WriteonlyFields []string `protobuf:"bytes,7,rep,name=writeonly_fields,json=writeonlyFields,proto3" json:"writeonly_fields,omitempty"`
ReadFilter string `protobuf:"bytes,8,opt,name=read_filter,json=readFilter,proto3" json:"read_filter,omitempty"` ReadFilter string `protobuf:"bytes,8,opt,name=read_filter,json=readFilter,proto3" json:"read_filter,omitempty"`
WriteFilter string `protobuf:"bytes,9,opt,name=write_filter,json=writeFilter,proto3" json:"write_filter,omitempty"` 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"`
} }
func (x *Rule) Reset() { func (x *Rule) Reset() {
...@@ -370,6 +373,20 @@ func (x *Rule) GetWriteFilter() string { ...@@ -370,6 +373,20 @@ func (x *Rule) GetWriteFilter() string {
return "" return ""
} }
func (x *Rule) GetDenyReadFields() []string {
if x != nil {
return x.DenyReadFields
}
return nil
}
func (x *Rule) GetDenyWriteFields() []string {
if x != nil {
return x.DenyWriteFields
}
return nil
}
type Collaborator struct { type Collaborator struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
...@@ -534,7 +551,7 @@ var file_common_common_proto_rawDesc = []byte{ ...@@ -534,7 +551,7 @@ var file_common_common_proto_rawDesc = []byte{
0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x25, 0x0a, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x25, 0x0a,
0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x0e, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18,
0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x46, 0x69,
0x65, 0x6c, 0x64, 0x73, 0x22, 0xba, 0x02, 0x0a, 0x04, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x23, 0x0a, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x90, 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, 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, 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, 0x49, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20,
...@@ -554,33 +571,39 @@ var file_common_common_proto_rawDesc = []byte{ ...@@ -554,33 +571,39 @@ var file_common_common_proto_rawDesc = []byte{
0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x21, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x21,
0x0a, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x09, 0x0a, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x09,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x72, 0x69, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x77, 0x72, 0x69, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65,
0x72, 0x22, 0x57, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x28, 0x0a, 0x10, 0x64, 0x65, 0x6e, 0x79, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x66,
0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x64, 0x65, 0x6e,
0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x79, 0x52, 0x65, 0x61, 0x64, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x2a, 0x0a, 0x11, 0x64,
0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x79, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73,
0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6e, 0x79, 0x57, 0x72, 0x69, 0x74,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0xab, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0x57, 0x0a, 0x0c, 0x43, 0x6f, 0x6c, 0x6c, 0x61,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x70, 0x61, 0x63, 0x65,
0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x70, 0x61, 0x63, 0x65,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x02, 0x20,
0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04,
0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x72, 0x6f, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65,
0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x22, 0xab, 0x01, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x0a, 0x0e,
0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01,
0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x56, 0x65, 0x72, 0x73,
0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6e, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69,
0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x75, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x70, 0x69, 0x56, 0x65, 0x72,
0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x74, 0x69,
0x73, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x54,
0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x2a, 0x69, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20,
0x43, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x62,
0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28,
0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x05, 0x52, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x2a, 0x25,
0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x0a, 0x06, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4e, 0x59, 0x10,
0x54, 0x45, 0x10, 0x04, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x2e, 0x70, 0x65, 0x72, 0x78, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x4d, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52,
0x2e, 0x72, 0x75, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x73, 0x2f, 0x70, 0x65, 0x72, 0x78, 0x69, 0x4f, 0x4c, 0x45, 0x10, 0x02, 0x2a, 0x43, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12,
0x73, 0x2d, 0x67, 0x6f, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06,
0x6e, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment