@@ -20,26 +20,18 @@ import (
2020 "xorm.io/builder"
2121)
2222
23- // The two helpers below are not opposites: SameBotIdentityCond is symmetric
24- // across an owner's fleet, IsBotOwnedBy only ever points from owner to bot.
25- // Symmetry is opt-in per resource - so far only labels - and gates reads
26- // alone. Everything else, including reading bot users and their tokens, stays
27- // on the directional check.
28-
2923// IsBotOwnedBy reports whether u is a bot owned by owner.
3024func (u * User ) IsBotOwnedBy (owner * User ) bool {
3125 return u .IsBot () && u .BotOwnerID == owner .ID
3226}
3327
34- // SameBotIdentityCond matches a user id column against every user sharing u's
35- // identity root - a bot's owner, or a human themselves.
28+ // SameBotIdentityCond matches a user ID column against users sharing u's root:
29+ // a bot's owner or a human themselves. It is symmetric across an owner's fleet .
3630//
3731// The root is resolved in SQL so the result never depends on how populated the
3832// passed struct happens to be; callers routinely hold a User carrying only an ID.
3933//
40- // Chain-safe by construction rather than by invariant: the root is exactly one
41- // hop up, so even a bot owning a bot would leave the grandchild resolving to its
42- // parent bot, never reaching the human.
34+ // Resolving only one owner hop keeps accidental bot chains out of a human's identity set.
4335//
4436// column is interpolated as a raw SQL identifier and must be a trusted literal.
4537func SameBotIdentityCond (u * User , column string ) builder.Cond {
0 commit comments