You can restrict the maximum number of users connecting to WiFi by using the Captive portal.
Captive portal will count the active connection to WiFi and based on that it will restrict the new connection to that captive WiFi.
Captive portal will help you to restrict the number of devices that can use your WiFi.
The captive portal is presented to the client and is stored either at the gateway or on a web server hosting the web page. After authentication the clients MAC address is stored, as a form of verification.
To upgrade the security of an account an admin can apply a limit to the number of current sessions a user may have open to between 1 and n. When a user attempts to login and open a new login session beyond the defined limit, the user will be logged out of their previous inactive session.