Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

In this Discussion

Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.

Check a Specific User's Junction Permissions

ShadowdareShadowdare π Moderator
edited July 2016 in Development

To check if the currently logged-in user has a certain permission for at least one junction, you can use: Gdn::session()->checkPermission('Vanilla.Discussions.Add', true, 'Category', 'any');.

However, this only returns the result for the currently logged-in user. I would like to do the same thing for a specific user object/ID instead.

There's a UserModel method Gdn::userModel()->checkPermission($User, $Permission, $Options) (view on GitHub), but junction permission checking hasn't been implemented in this method yet as of Vanilla 2.2.1 (and 2.3b1) and noted with the line // TODO: Check for junction table permissions.

Is there another method already written within Vanilla 2.2.1 to do this?

Add Pages to Vanilla with the Basic Pages app | Publish articles with the Articles app


Sign In or Register to comment.