Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How do I check user permissions?
I'm looking to display information based on the user's permissions, for example something like:
I have been looking, but unable to find the class/function to check a user's role or permissions, or what the proper syntax is.
if ($Context->User->Role == "admin") {
echo "Fancy admin things!";
} else {
echo "Lame user things. :(";
}
I have been looking, but unable to find the class/function to check a user's role or permissions, or what the proper syntax is.
0
This discussion has been closed.
Comments
For others looking for information on this:
$Context->Session->User->Permission('PERMISSION_NAME_IS_ENTERED_HERE')
Example:
<?php include("./appg/settings.php"); include("./appg/init_people.php"); if ($Context->Session->User->Permission('I_CAN_HAS_CHEEZBURGER')){ echo "u can has cheezburger"; } else { echo "You cannot have a cheeseburger."; } ?>
Now, I'd like to learn how to add a custom permission.