Skip to content
Snippets Groups Projects
Commit 7cc9d6f4 authored by ko_oler's avatar ko_oler
Browse files

правки после обновления perxis-proto

parent f9d12b77
No related branches found
No related tags found
No related merge requests found
...@@ -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.DenyWriteFields...) 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.DenyReadFields...) p.UnallowedFields = append(p.UnallowedFields, r.DenyWriteFields...)
} }
p.UnallowedFields = data.SetFromSlice(p.UnallowedFields) p.UnallowedFields = data.SetFromSlice(p.UnallowedFields)
......
...@@ -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}, DenyReadFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyWriteFields: []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}, DenyReadFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyWriteFields: []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}, DenyReadFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyWriteFields: []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}, DenyReadFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyWriteFields: []string{"f1"}}, rule: Rule{Actions: []Action{ActionRead, ActionUpdate}, DenyWriteFields: []string{"f1"}, HiddenFields: []string{"f2"}, DenyReadFields: []string{"f1"}},
unallowedFields: []string{"f1"}, unallowedFields: []string{"f1"},
}, },
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment