Skip to content

Commit

Permalink
🧹 apply changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock committed Aug 12, 2024
1 parent c531f96 commit 7548494
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 2 additions & 2 deletions providers/ms365/resources/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (a *mqlMicrosoftGroup) members() ([]interface{}, error) {
}

// if the user is already indexed, we can reuse it
userResource, ok := mqlMicrsoftResource.userById(*memberId)
userResource, ok := mqlMicrosoftResource.userById(*memberId)
if ok {
res = append(res, userResource)
continue
Expand All @@ -66,7 +66,7 @@ func (a *mqlMicrosoftGroup) members() ([]interface{}, error) {
if err != nil {
return nil, err
}
mqlMicrsoftResource.index(newUserResource.(*mqlMicrosoftUser))
mqlMicrosoftResource.index(newUserResource.(*mqlMicrosoftUser))
res = append(res, newUserResource)
}
return res, nil
Expand Down
6 changes: 0 additions & 6 deletions providers/ms365/resources/microsoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
type mqlMicrosoftInternal struct {
// index users by id
idxUsersById map[string]*mqlMicrosoftUser
// index users by principal name
idxUsersByPrincipalName map[string]*mqlMicrosoftUser
}

// initIndex ensures the user indexes are initialized,
Expand All @@ -23,16 +21,12 @@ func (a *mqlMicrosoft) initIndex() {
if a.idxUsersById == nil {
a.idxUsersById = make(map[string]*mqlMicrosoftUser)
}
if a.idxUsersByPrincipalName == nil {
a.idxUsersByPrincipalName = make(map[string]*mqlMicrosoftUser)
}
}

// index adds a user to the internal indexes
func (a *mqlMicrosoft) index(user *mqlMicrosoftUser) {
a.initIndex()
a.idxUsersById[user.Id.Data] = user
a.idxUsersByPrincipalName[user.UserPrincipalName.Data] = user
}

// userById returns a user by id if it exists in the index
Expand Down

0 comments on commit 7548494

Please sign in to comment.