Skip to content
Snippets Groups Projects
Commit 9cfd2f34 authored by Benjamin Bollen's avatar Benjamin Bollen
Browse files

permissions: RightPadBytes for Permissions on role

parent d8add273
No related branches found
No related tags found
No related merge requests found
......@@ -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{}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment