From b233f89dbf40f68eac060266501a330ae226f6f7 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Thu, 21 May 2015 19:50:09 -0400 Subject: [PATCH] left pad role names :( --- permission/types/permissions.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/permission/types/permissions.go b/permission/types/permissions.go index dd13a04e..6310a675 100644 --- a/permission/types/permissions.go +++ b/permission/types/permissions.go @@ -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{}