HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Check if a user is in a given role
edited February 2012 in Community Addons & Development
What is the easiest way to check if a user belongs to a given role. For example in my application i want a developers role, which they will enter after agreeing to some terms. So certain pages I only want to show if they belong to that role. How would i go about doing this.
It appears its not the done thing in Vanilla, and roles are purely to define groups of permissions. So I will use that method, however for anyone wanting code to do this, there may be a better way:
I think you're going about this the wrong way. You want to check if someone has a certain permission, not role. You use the role to assign that permission, and then just check the permission when viewing the page, which is really simple.