mirror of
https://github.com/foomo/contentserver.git
synced 2025-10-16 12:25:44 +00:00
code clean up and fix of access rule for groups : allowing access, if nodes groups are empty
This commit is contained in:
parent
c6f44766c2
commit
d31f10ef33
@ -57,19 +57,18 @@ func (node *RepoNode) InPath(path []*Item) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (node *RepoNode) InState(state string) bool {
|
func (node *RepoNode) InState(state string) bool {
|
||||||
if(len(node.States) == 0) {
|
if len(node.States) == 0 {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
for _, nodeState := range node.States {
|
for _, nodeState := range node.States {
|
||||||
if(state == nodeState) {
|
if state == nodeState {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (node *RepoNode) InRegion(region string) bool {
|
func (node *RepoNode) InRegion(region string) bool {
|
||||||
for _, nodeRegion := range node.Regions {
|
for _, nodeRegion := range node.Regions {
|
||||||
if nodeRegion == region {
|
if nodeRegion == region {
|
||||||
@ -148,7 +147,7 @@ func (node *RepoNode) IsOneOfTheseMimeTypes(mimeTypes []string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (node *RepoNode) CanBeAccessedByGroups(groups []string) bool {
|
func (node *RepoNode) CanBeAccessedByGroups(groups []string) bool {
|
||||||
if len(groups) == 0 {
|
if len(groups) == 0 || len(node.Groups) == 0 {
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
// @todo is there sth like in_array ... or some array intersection
|
// @todo is there sth like in_array ... or some array intersection
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user