Check the groups
user is in and make sure the user is in the desired group. I think you want to check if the user belongs to "admin", but instead you can check for other, more specific access. Why do you still want to check the admin? As a rule, itβs better to try to try to complete the task, and not check the wide level of access and failure if the user does not have such access, but he has the specific access that you need.
source share