Auth: Cleanup duplicate isGroupMember methods from OAuth connectors (#115786)
Remove duplicate isGroupMember methods from OAuth connectors
This commit is contained in:
@@ -162,23 +162,6 @@ func (s *SocialGenericOAuth) Reload(ctx context.Context, settings ssoModels.SSOS
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODOD: remove this in the next PR and use the isGroupMember from social.go
|
|
||||||
func (s *SocialGenericOAuth) isGroupMember(groups []string) bool {
|
|
||||||
if len(s.info.AllowedGroups) == 0 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, allowedGroup := range s.info.AllowedGroups {
|
|
||||||
for _, group := range groups {
|
|
||||||
if group == allowedGroup {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *SocialGenericOAuth) isTeamMember(ctx context.Context, client *http.Client) bool {
|
func (s *SocialGenericOAuth) isTeamMember(ctx context.Context, client *http.Client) bool {
|
||||||
if len(s.teamIds) == 0 {
|
if len(s.teamIds) == 0 {
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -205,20 +205,3 @@ func (s *SocialOkta) getGroups(data *OktaUserInfoJson) []string {
|
|||||||
}
|
}
|
||||||
return groups
|
return groups
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: remove this in a separate PR and use the isGroupMember from the social.go
|
|
||||||
func (s *SocialOkta) isGroupMember(groups []string) bool {
|
|
||||||
if len(s.info.AllowedGroups) == 0 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, allowedGroup := range s.info.AllowedGroups {
|
|
||||||
for _, group := range groups {
|
|
||||||
if group == allowedGroup {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user