MCPcopy Index your code
hub / github.com/coder/coder / Equal

Method Equal

coderd/idpsync/group.go:337–356  ·  view source on GitHub ↗

Equal compares two ExpectedGroups. The org id must be the same. If the group ID is set, it will be compared and take priority, ignoring the name value. So 2 groups with the same ID but different names will be considered equal.

(b ExpectedGroup)

Source from the content-addressed store, hash-verified

335// name value. So 2 groups with the same ID but different names will be
336// considered equal.
337func (a ExpectedGroup) Equal(b ExpectedGroup) bool {
338 // Must match
339 if a.OrganizationID != b.OrganizationID {
340 return false
341 }
342 // Only the name or the name needs to be checked, priority is given to the ID.
343 if a.GroupID != nil && b.GroupID != nil {
344 return *a.GroupID == *b.GroupID
345 }
346 if a.GroupName != nil && b.GroupName != nil {
347 return *a.GroupName == *b.GroupName
348 }
349
350 // If everything is nil, it is equal. Although a bit pointless
351 if a.GroupID == nil && b.GroupID == nil &&
352 a.GroupName == nil && b.GroupName == nil {
353 return true
354 }
355 return false
356}
357
358// ParseClaims will take the merged claims from the IDP and return the groups
359// the user is expected to be a member of. The expected group can either be a

Callers 7

SyncGroupsMethod · 0.45
SyncRolesMethod · 0.45
syncSiteWideRolesMethod · 0.45
TestParseGroupClaimsFunction · 0.45
TestExpectedGroupEqualFunction · 0.45
TestFromLegacySettingsFunction · 0.45

Calls

no outgoing calls

Tested by 4

TestParseGroupClaimsFunction · 0.36
TestExpectedGroupEqualFunction · 0.36
TestFromLegacySettingsFunction · 0.36