How to restrict device functions according to user