features/working-on-scopes #13

Merged
jtom38 merged 28 commits from features/working-on-scopes into main 2024-04-04 15:31:54 -07:00
1 changed files with 5 additions and 5 deletions
Showing only changes of commit 69fb7a683b - Show all commits

View File

@ -63,15 +63,15 @@ func (us UserService) AddScopes(username string, scopes []string) error {
return errors.New(repositories.ErrUserNotFound)
}
newScopes := strings.Split(usr.Scopes, ",")
currentScopes := strings.Split(usr.Scopes, ",")
// check the current scopes
for _, item := range strings.Split(usr.Scopes, ",") {
if !us.doesScopeExist(scopes, item) {
newScopes = append(newScopes, item)
for _, item := range scopes {
if !strings.Contains(usr.Scopes, 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 {