Fix nil account bug

This commit is contained in:
Ben Toogood
2020-05-20 16:11:34 +01:00
parent f6d9416a9e
commit 5d14970a55
3 changed files with 8 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ package auth
import (
"context"
"errors"
"strings"
"time"
)
@@ -60,13 +61,13 @@ type Account struct {
}
// HasScope returns a boolean indicating if the account has the given scope
func (a *Account) HasScope(scope string) bool {
func (a *Account) HasScope(scopes ...string) bool {
if a.Scopes == nil {
return false
}
for _, s := range a.Scopes {
if s == scope {
if s == strings.Join(scopes, ".") {
return true
}
}