It looks like you're new here. If you want to get involved, click one of these buttons!
I am trying to make a custom page (Custom Page plugin) only visible to a specific set of roles. Otherwise, it should show the 'no permission' page.
Whats the best way to go about this?
hbf
wiki guy? MVP
in addition you can find out a bit more here;
http://vanillawiki.homebrewforums.net/index.php/Roles_&_Permissions
Answers
you should check for a permission not a role. assign users to roles, provide permissions to roles.
if (!Gdn::Session()->CheckPermission('Plugins.Pockets.Manage')) return FALSE;
this statement checks whether the user has Plugins.Pockets.Manage permission. if not it bounces out.
you just need to echo back the message you wish if they dont have the appropriate permission. you can find examples of this type of check in many plugins and controllers. just do a search on check permission.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •Thank you!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Awesome LOL •