Limit 1 ticket per client, as anonymous user

context: currently working on a very simple app that provide a tickets in order to give service to customers.    Example: you go to the supermarket and need a number to buy seafood. this app will be a digital solution. people scan a QR code an press a get a ticket button. This is already made but what I want to know is, how can I limit the ticket to 1 per client if they are anonymous users.    with what can I associate the ticket in order to achieve this?     
1 answers

Hi Constanza,


What you are looking for is the user session object from the system module.  Anonymous users(and logged in users) are given a session when they connect to your app and this session object is available to you in microflows via $currentSession.  You can create an association from the ticket object to the session object and be able to check that association if the user tries to create another ticket.


This isn’t a perfect solution as a user could open another browser and be able to open another ticket as a separate anonymous user(because of the separate cookies) but this will get you started in limiting the number of tickets that one anonymous user session can create.


Hope this helps