mirror of
https://github.com/tendermint/tendermint.git
synced 2026-05-30 19:06:21 +00:00
left pad role names :(
This commit is contained in:
@@ -108,6 +108,7 @@ func NewAccountPermissions() *AccountPermissions {
|
||||
|
||||
// Returns true if the role is found
|
||||
func (aP *AccountPermissions) HasRole(role string) bool {
|
||||
role = string(LeftPadBytes([]byte(role), 32))
|
||||
for _, r := range aP.Roles {
|
||||
if r == role {
|
||||
return true
|
||||
@@ -118,6 +119,7 @@ func (aP *AccountPermissions) HasRole(role string) bool {
|
||||
|
||||
// Returns true if the role is added, and false if it already exists
|
||||
func (aP *AccountPermissions) AddRole(role string) bool {
|
||||
role = string(LeftPadBytes([]byte(role), 32))
|
||||
for _, r := range aP.Roles {
|
||||
if r == role {
|
||||
return false
|
||||
@@ -129,6 +131,7 @@ func (aP *AccountPermissions) AddRole(role string) bool {
|
||||
|
||||
// Returns true if the role is removed, and false if it is not found
|
||||
func (aP *AccountPermissions) RmRole(role string) bool {
|
||||
role = string(LeftPadBytes([]byte(role), 32))
|
||||
for i, r := range aP.Roles {
|
||||
if r == role {
|
||||
post := []string{}
|
||||
|
||||
Reference in New Issue
Block a user