From 9cfd2f346f6db9378f896c438238bbaf17e18246 Mon Sep 17 00:00:00 2001
From: Benjamin Bollen <ben@erisindustries.com>
Date: Fri, 10 Jun 2016 19:46:48 +0200
Subject: [PATCH] permissions: RightPadBytes for Permissions on role

---
 permission/types/permissions.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/permission/types/permissions.go b/permission/types/permissions.go
index 3c43ed17..cca221f8 100644
--- a/permission/types/permissions.go
+++ b/permission/types/permissions.go
@@ -124,7 +124,7 @@ type AccountPermissions struct {
 
 // Returns true if the role is found
 func (aP *AccountPermissions) HasRole(role string) bool {
-	role = string(LeftPadBytes([]byte(role), 32))
+	role = string(RightPadBytes([]byte(role), 32))
 	for _, r := range aP.Roles {
 		if r == role {
 			return true
@@ -135,7 +135,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))
+	role = string(RightPadBytes([]byte(role), 32))
 	for _, r := range aP.Roles {
 		if r == role {
 			return false
@@ -147,7 +147,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))
+	role = string(RightPadBytes([]byte(role), 32))
 	for i, r := range aP.Roles {
 		if r == role {
 			post := []string{}
-- 
GitLab