Skip to content

Commit

Permalink
Add most test cases, 404 and last 6 in spreadsheet left
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed-madi committed May 15, 2024
1 parent a753f2e commit 34e1726
Show file tree
Hide file tree
Showing 3 changed files with 627 additions and 7 deletions.
7 changes: 3 additions & 4 deletions rest/diagnostic_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@ func (h *handler) handleGetAllChannels() error {
keyspace := dsName.ScopeName() + "." + dsName.CollectionName()

resp[keyspace] = make(map[string]auth.GrantHistory)
channels := user.CollectionChannels(dsName.ScopeName(), dsName.CollectionName())
channels := user.InheritedCollectionChannels(dsName.ScopeName(), dsName.CollectionName())
chanHistory := user.CollectionChannelHistory(dsName.ScopeName(), dsName.CollectionName())
for chanName, chanEntry := range channels {
resp[keyspace][chanName] = auth.GrantHistory{Entries: []auth.GrantHistorySequencePair{{StartSeq: chanEntry.Sequence, EndSeq: 0}}}
}
for chanName, chanEntry := range chanHistory {
chanHistoryEntry := auth.GrantHistory{Entries: chanEntry.Entries, UpdatedAt: chanEntry.UpdatedAt}
// if channel is also in history, append current entry to history entries
if _, chanCurrentlyAssigned := resp[chanName]; chanCurrentlyAssigned {
if _, chanCurrentlyAssigned := resp[keyspace][chanName]; chanCurrentlyAssigned {
var newEntries []auth.GrantHistorySequencePair
copy(newEntries, chanHistory[chanName].Entries)
newEntries = append(newEntries, chanEntry.Entries...)
newEntries = append(chanEntry.Entries, resp[keyspace][chanName].Entries...)
chanHistoryEntry.Entries = newEntries
}
resp[keyspace][chanName] = chanHistoryEntry
Expand Down
Loading

0 comments on commit 34e1726

Please sign in to comment.