left pad role names :(

This commit is contained in:
Ethan Buchman
2015-05-21 19:50:09 -04:00
committed by Jae Kwon
parent b11012026d
commit b233f89dbf

View File

@@ -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{}