MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / getCurrentRoleChanEntryOverlap

Function getCurrentRoleChanEntryOverlap

rest/diagnostic_api.go:151–168  ·  view source on GitHub ↗

Only used for deleted role, logic is for channels in channel_history and roles in role_history

(roleVbSeq uint64, chanEntries []auth.GrantHistorySequencePair)

Source from the content-addressed store, hash-verified

149
150// Only used for deleted role, logic is for channels in channel_history and roles in role_history
151func getCurrentRoleChanEntryOverlap(roleVbSeq uint64, chanEntries []auth.GrantHistorySequencePair) []auth.GrantHistorySequencePair {
152 var overlapEntries []auth.GrantHistorySequencePair
153 var entry auth.GrantHistorySequencePair
154 for _, chanEntry := range chanEntries {
155 // default
156 entry = auth.GrantHistorySequencePair{StartSeq: roleVbSeq, EndSeq: chanEntry.EndSeq}
157 // role was assigned to user after chan was removed from role, no entry
158 if roleVbSeq > chanEntry.EndSeq {
159 continue
160 // role was assigned to user before chan was assigned to role
161 } else if roleVbSeq < chanEntry.StartSeq {
162 entry = auth.GrantHistorySequencePair{StartSeq: chanEntry.StartSeq, EndSeq: chanEntry.EndSeq}
163 }
164 overlapEntries = append(overlapEntries, entry)
165 }
166
167 return overlapEntries
168}
169
170// Only used for deleted role, logic is for channels in channel_history and roles in role_history
171func getHistoricRoleChanEntryOverlap(roleEntries []auth.GrantHistorySequencePair, chanEntries []auth.GrantHistorySequencePair) []auth.GrantHistorySequencePair {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected