Commit Graph
2 Commits
  • fix(ldap): convert default total GB to bytes when auto-creating clients (#5854)
    * fix(ldap): convert default total GB to bytes when auto-creating clients
    
    LdapSyncJob.buildClient stored ldapDefaultTotalGB directly into
    Client.TotalGB without the GB-to-bytes conversion every other client
    creation path applies (client form's gbToBytes, tgbot's
    limitTraffic*1024^3, client_inbound_apply.go's totalGB*1024^3). A
    "Default total (GB)" of 10 was persisted as 10 bytes, depleting the
    client almost immediately.
    
    Closes #5852
    
    * test(ldap): pin the GB-to-bytes conversion in buildClient
    
    Per review feedback on #5854: the existing test only exercised
    defGB=0, so it wouldn't have caught the missing conversion.
  • fix(ldap): attach auto-created clients to every configured inbound tag
    The sync job built an independent client per configured tag and called
    CreateOne once per tag. Each call generated a fresh random subId, and
    the email-uniqueness check in ClientService.Create only re-admits a
    taken email when the incoming subId matches the stored one - so the
    first tag succeeded and every other tag failed with "email already in
    use", leaving new LDAP users on a single inbound.
    
    Build the client once per email and hand ClientService.Create the full
    list of resolved inbound ids, the same path the panel's own client
    create endpoint uses: one identity (email, subId) attached to all
    configured tags, with per-protocol credentials filled per inbound.
    Unknown tags are now skipped with a warning instead of building
    clients against a nil inbound.
    
    Closes #5846