Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-go
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-go
Commits
7cc9d6f4
Commit
7cc9d6f4
authored
1 year ago
by
ko_oler
Browse files
Options
Downloads
Patches
Plain Diff
правки после обновления perxis-proto
parent
f9d12b77
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/permission/ruleset.go
+2
-2
2 additions, 2 deletions
pkg/permission/ruleset.go
pkg/permission/ruleset_test.go
+4
-4
4 additions, 4 deletions
pkg/permission/ruleset_test.go
with
6 additions
and
6 deletions
pkg/permission/ruleset.go
+
2
−
2
View file @
7cc9d6f4
...
@@ -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
.
Deny
Write
Fields
...
)
p
.
UnallowedFields
=
append
(
p
.
UnallowedFields
,
r
.
Deny
Read
Fields
...
)
case
ActionCreate
,
ActionUpdate
,
ActionDelete
:
case
ActionCreate
,
ActionUpdate
,
ActionDelete
:
p
.
Filter
=
r
.
WriteFilter
p
.
Filter
=
r
.
WriteFilter
p
.
UnallowedFields
=
append
(
p
.
UnallowedFields
,
r
.
Deny
Read
Fields
...
)
p
.
UnallowedFields
=
append
(
p
.
UnallowedFields
,
r
.
Deny
Write
Fields
...
)
}
}
p
.
UnallowedFields
=
data
.
SetFromSlice
(
p
.
UnallowedFields
)
p
.
UnallowedFields
=
data
.
SetFromSlice
(
p
.
UnallowedFields
)
...
...
This diff is collapsed.
Click to expand it.
pkg/permission/ruleset_test.go
+
4
−
4
View file @
7cc9d6f4
...
@@ -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
},
Deny
Read
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Write
Fields
:
[]
string
{
"f3"
}},
rule
:
Rule
{
Actions
:
[]
Action
{
ActionRead
,
ActionUpdate
},
Deny
Write
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Read
Fields
:
[]
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
},
Deny
Read
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Write
Fields
:
[]
string
{
"f1"
}},
rule
:
Rule
{
Actions
:
[]
Action
{
ActionRead
,
ActionUpdate
},
Deny
Write
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Read
Fields
:
[]
string
{
"f1"
}},
unallowedFields
:
[]
string
{
"f1"
,
"f2"
},
unallowedFields
:
[]
string
{
"f1"
,
"f2"
},
},
},
{
{
name
:
"ActionUpdate"
,
name
:
"ActionUpdate"
,
action
:
ActionUpdate
,
action
:
ActionUpdate
,
rule
:
Rule
{
Actions
:
[]
Action
{
ActionRead
,
ActionUpdate
},
Deny
Read
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Write
Fields
:
[]
string
{
"f3"
}},
rule
:
Rule
{
Actions
:
[]
Action
{
ActionRead
,
ActionUpdate
},
Deny
Write
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Read
Fields
:
[]
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
},
Deny
Read
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Write
Fields
:
[]
string
{
"f1"
}},
rule
:
Rule
{
Actions
:
[]
Action
{
ActionRead
,
ActionUpdate
},
Deny
Write
Fields
:
[]
string
{
"f1"
},
HiddenFields
:
[]
string
{
"f2"
},
Deny
Read
Fields
:
[]
string
{
"f1"
}},
unallowedFields
:
[]
string
{
"f1"
},
unallowedFields
:
[]
string
{
"f1"
},
},
},
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment