Only used for deleted role, logic is for channels in channel_history and roles in role_history
(roleEntries []auth.GrantHistorySequencePair, chanEntries []auth.GrantHistorySequencePair)
| 169 | |
| 170 | // Only used for deleted role, logic is for channels in channel_history and roles in role_history |
| 171 | func getHistoricRoleChanEntryOverlap(roleEntries []auth.GrantHistorySequencePair, chanEntries []auth.GrantHistorySequencePair) []auth.GrantHistorySequencePair { |
| 172 | var overlapEntries []auth.GrantHistorySequencePair |
| 173 | var entry auth.GrantHistorySequencePair |
| 174 | for _, roleEntry := range roleEntries { |
| 175 | for _, chanEntry := range chanEntries { |
| 176 | // default |
| 177 | entry = auth.GrantHistorySequencePair{StartSeq: chanEntry.StartSeq, EndSeq: roleEntry.EndSeq} |
| 178 | // role was assigned to user after chan was removed from role, no entry |
| 179 | if roleEntry.StartSeq > chanEntry.EndSeq { |
| 180 | continue |
| 181 | // role was removed from user before chan was assigned to role, no entry |
| 182 | } else if roleEntry.EndSeq < chanEntry.StartSeq { |
| 183 | continue |
| 184 | // chan was removed from role after role was removed from user |
| 185 | } else if chanEntry.EndSeq > roleEntry.EndSeq { |
| 186 | entry = auth.GrantHistorySequencePair{StartSeq: chanEntry.StartSeq, EndSeq: roleEntry.EndSeq} |
| 187 | // role was assigned to user after chan was assigned to role |
| 188 | } else if roleEntry.StartSeq > chanEntry.StartSeq { |
| 189 | entry = auth.GrantHistorySequencePair{StartSeq: roleEntry.StartSeq, EndSeq: chanEntry.EndSeq} |
| 190 | } |
| 191 | overlapEntries = append(overlapEntries, entry) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | return overlapEntries |
| 196 | } |
| 197 | |
| 198 | func (h *handler) handleGetAllChannels() error { |
| 199 | h.assertAdminOnly() |
no outgoing calls
no test coverage detected