Skip to content

Commit 66f03e9

Browse files
Return error when group does not exist
1 parent e627294 commit 66f03e9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

azureAD/azureAD.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package azureAD
22

33
import (
44
"encoding/json"
5+
"fmt"
56
"io"
67
"net/http"
78
"net/url"
@@ -58,7 +59,7 @@ func (m *Manager) GraphGetGroupMembers(token, groupName string) ([]string, error
5859
return nil, err
5960
}
6061

61-
requestURL := GraphURL + "groups/" + groupId + "/members"
62+
requestURL := GraphURL + "groups/" + groupId + "/transitiveMembers"
6263

6364
headers := make(map[string]string)
6465
headers["Authorization"] = "Bearer " + token
@@ -106,7 +107,7 @@ func graphGetIdFromName(token, name string) (string, error) {
106107

107108
if len(result.Value) != 1 {
108109
lo.G.Errorf("Number of Id's returned for groupname (%s) search should be exactly one, not %d!", name, result.Value)
109-
return "", err
110+
return "", fmt.Errorf("Number of Id's returned for groupname (%s) search should be exactly one, not %d!", name, len(result.Value))
110111
}
111112

112113
return result.Value[0].Id, nil

0 commit comments

Comments
 (0)