Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Permission to view a "Custom Page"
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?
Tagged:
0
Best Answer
-
hbf MVP
in addition you can find out a bit more here;
http://vanillawiki.homebrewforums.net/index.php/Roles_&_Permissions
0
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. || Plugin Development Explained
in addition you can find out a bit more here;
http://vanillawiki.homebrewforums.net/index.php/Roles_&_Permissions
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
Thank you!