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 { ...@@ -124,7 +124,7 @@ type AccountPermissions struct {
// Returns true if the role is found // Returns true if the role is found
func (aP *AccountPermissions) HasRole(role string) bool { func (aP *AccountPermissions) HasRole(role string) bool {
role = string(LeftPadBytes([]byte(role), 32)) role = string(RightPadBytes([]byte(role), 32))
for _, r := range aP.Roles { for _, r := range aP.Roles {
if r == role { if r == role {
return true return true
...@@ -135,7 +135,7 @@ func (aP *AccountPermissions) HasRole(role string) bool { ...@@ -135,7 +135,7 @@ func (aP *AccountPermissions) HasRole(role string) bool {
// Returns true if the role is added, and false if it already exists // Returns true if the role is added, and false if it already exists
func (aP *AccountPermissions) AddRole(role string) bool { func (aP *AccountPermissions) AddRole(role string) bool {
role = string(LeftPadBytes([]byte(role), 32)) role = string(RightPadBytes([]byte(role), 32))
for _, r := range aP.Roles { for _, r := range aP.Roles {
if r == role { if r == role {
return false return false
...@@ -147,7 +147,7 @@ func (aP *AccountPermissions) AddRole(role string) bool { ...@@ -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 // Returns true if the role is removed, and false if it is not found
func (aP *AccountPermissions) RmRole(role string) bool { 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 { for i, r := range aP.Roles {
if r == role { if r == role {
post := []string{} 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