Skip to content
Snippets Groups Projects
Unverified Commit 08162806 authored by Silas Davis's avatar Silas Davis
Browse files

Merge remote-tracking branch 'origin/feature-tendermint_0.8.0' into feature-tendermint_0.8.0

parents 43f2647f 5df19394
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,7 @@ package types ...@@ -16,6 +16,7 @@ package types
import ( import (
"fmt" "fmt"
"strings"
"github.com/eris-ltd/eris-db/word256" "github.com/eris-ltd/eris-db/word256"
) )
...@@ -237,35 +238,37 @@ func PermFlagToString(pf PermFlag) (perm string) { ...@@ -237,35 +238,37 @@ func PermFlagToString(pf PermFlag) (perm string) {
return return
} }
// PermStringToFlag maps camel- and snake case strings to the
// the corresponding permission flag.
func PermStringToFlag(perm string) (pf PermFlag, err error) { func PermStringToFlag(perm string) (pf PermFlag, err error) {
switch perm { switch strings.ToLower(perm) {
case "root": case "root":
pf = Root pf = Root
case "send": case "send":
pf = Send pf = Send
case "call": case "call":
pf = Call pf = Call
case "create_contract": case "createcontract", "create_contract":
pf = CreateContract pf = CreateContract
case "create_account": case "createaccount", "create_account":
pf = CreateAccount pf = CreateAccount
case "bond": case "bond":
pf = Bond pf = Bond
case "name": case "name":
pf = Name pf = Name
case "hasBase": case "hasbase", "has_base":
pf = HasBase pf = HasBase
case "setBase": case "setbase", "set_base":
pf = SetBase pf = SetBase
case "unsetBase": case "unsetbase", "unset_base":
pf = UnsetBase pf = UnsetBase
case "setGlobal": case "setglobal", "set_global":
pf = SetGlobal pf = SetGlobal
case "hasRole": case "hasrole", "has_role":
pf = HasRole pf = HasRole
case "addRole": case "addrole", "add_role":
pf = AddRole pf = AddRole
case "removeRole": case "removerole", "rmrole", "rm_role":
pf = RmRole pf = RmRole
default: default:
err = fmt.Errorf("Unknown permission %s", perm) err = fmt.Errorf("Unknown permission %s", perm)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment