updated how it looks to see what scopes to add
This commit is contained in:
parent
8f0e8e4d85
commit
69fb7a683b
@ -63,15 +63,15 @@ func (us UserService) AddScopes(username string, scopes []string) error {
|
|||||||
return errors.New(repositories.ErrUserNotFound)
|
return errors.New(repositories.ErrUserNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
newScopes := strings.Split(usr.Scopes, ",")
|
currentScopes := strings.Split(usr.Scopes, ",")
|
||||||
|
|
||||||
// check the current scopes
|
// check the current scopes
|
||||||
for _, item := range strings.Split(usr.Scopes, ",") {
|
for _, item := range scopes {
|
||||||
if !us.doesScopeExist(scopes, item) {
|
if !strings.Contains(usr.Scopes, item) {
|
||||||
newScopes = append(newScopes, item)
|
currentScopes = append(currentScopes, item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return us.repo.UpdateScopes(username, strings.Join(newScopes, ","))
|
return us.repo.UpdateScopes(username, strings.Join(currentScopes, ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (us UserService) RemoveScopes(username string, scopes []string) error {
|
func (us UserService) RemoveScopes(username string, scopes []string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user