I have two possible solutions to your problem
Once I developed a hotspot that its authentication was done through a page in php, the wireless network was released (had no password), where the one who connected would have access only to the server of the authentication page.
You can set this rule on your network, release the wireless network (leave no password), where you can only access your server.
A simple way to do this is to set up a router without internet and on the same network as your server, you can do this by removing the gateway and setting the server's dns.
So everyone who connects will only have access to this server, of course if it is local, if not you would need equipment like mikrotik where you can define which ip will be free.
There are two issues when doing this lock on the person's cell phone:
- The phone will need root permission.
- And it will be a flawed system, since the lock will be on the cell phone.