code: func PermStringToFlag(perm string) (PermFlag, error) {
  	switch strings.ToLower(perm) {
  	case AllString:
  		return AllPermFlags, nil
  	case RootString:
  		return Root, nil
  	case SendString:
  		return Send, nil
  	case CallString:
  		return Call, nil
  	case CreateContractString, "createcontract", "create_contract":
  		return CreateContract, nil
  	case CreateAccountString, "createaccount", "create_account":
  		return CreateAccount, nil
  	case BondString:
  		return Bond, nil
  	case NameString:
  		return Name, nil
  	case ProposalString:
  		return Proposal, nil
  	case InputString:
  		return Input, nil
  	case BatchString:
  		return Batch, nil
  	case HasBaseString, "hasbase", "has_base":
  		return HasBase, nil
  	case SetBaseString, "setbase", "set_base":
  		return SetBase, nil
  	case UnsetBaseString, "unsetbase", "unset_base":
  		return UnsetBase, nil
  	case SetGlobalString, "setglobal", "set_global":
  		return SetGlobal, nil
  	case HasRoleString, "hasrole", "has_role":
  		return HasRole, nil
  	case AddRoleString, "addrole", "add_role":
  		return AddRole, nil
  	case RemoveRoleString, "removerole", "rmrole", "rm_role":
  		return RemoveRole, nil
  	default:
  		return 0, fmt.Errorf("unknown permission %s", perm)
  	}
  }
docs: // PermStringToFlag maps camel- and snake case strings to the
  // the corresponding permission flag.