Generating sequential numbers in multi-user saas application

后端 未结 6 1878
野趣味
野趣味 2021-02-08 20:52

How do people generate auto_incrementing integers for a particular user in a typical saas application?

For example, the invoice numbers for all the invoices for a partic

6条回答
  •  天命终不由人
    2021-02-08 21:23

    Do you really want to generate the invoice IDs in an incremental format? Would this not open security holes (where in, if a user can guess the invoice number generation, they can change it in the request and may lead to information disclosure). I would ideally generate the numbers randomly (and keep track of used numbers). This prevents collisions as well (Chances of collision are reduced as the numbers are allocated randomly over a range).

提交回复
热议问题