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

After February 6, this site will no longer have Facebook, Twitter, or OpenID sign-in options. Read our announcement about social media SSO support in 2.8 for more info.

Make sure you have a current, valid email address set in your profile and set a password so you can login without it. If you get locked out after that time, you can choose "Forgot Password" to fix it as long as a valid email is on your account.

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.