mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
internal/types/blacklist.go: add BlacklistWildcard constant
This commit is contained in:
parent
eb2032e233
commit
2006da6a19
1 changed files with 4 additions and 2 deletions
|
|
@ -1,5 +1,7 @@
|
|||
package types
|
||||
|
||||
const BlacklistWildcard = "*"
|
||||
|
||||
type Blacklist struct {
|
||||
table map[string][]string
|
||||
isWhitelist bool
|
||||
|
|
@ -42,9 +44,9 @@ func (bl Blacklist) list(contracts ...string) [][]string {
|
|||
}
|
||||
|
||||
func (bl Blacklist) IsAllowed(contract string, action string) bool {
|
||||
for _, v := range bl.list(contract, "*") {
|
||||
for _, v := range bl.list(contract, BlacklistWildcard) {
|
||||
for _, act := range v {
|
||||
if act == action || act == "*" {
|
||||
if act == action || act == BlacklistWildcard {
|
||||
return bl.isWhitelist == true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue