i1Conflicts method

Map<String, List<String>> i1Conflicts()

The I1 conflicts of the world (10 5.4): for every active agent on personal whose trigger set (agentTriggerers) is not exactly its credential holder, the other principals of the set, by agent ID in the order of agents.

As on the server a missing holder, or a holder who cannot trigger the agent, is a conflict too, then with an empty list.

Implementation

Map<String, List<String>> i1Conflicts() {
  final out = <String, List<String>>{};
  for (final a in agents.values) {
    if (a.billingMode != 'personal' || people[a.id]?.status != 'active') {
      continue;
    }
    final set = agentTriggerers(a.id);
    final holder = a.credentialHolderId;
    if (holder != null && set.length == 1 && set.single == holder) continue;
    out[a.id] = [
      for (final p in set)
        if (p != holder) p,
    ];
  }
  return out;
}