Unset Permission in Template

Deek

Member
I've created a permission ['developers']['canDownload'] and I'd like to check the permission in templates.

I check for the permission by using
Code:
<xen:if is="{$visitor.permissions.developer.canDownload} == 'allow'">

This will work if the permission is set to allow or never but the check does not get run properly in the default state, not set. Is there a template syntax that will check if a viewParam is unset so I can apply logic to it?
 
When I change a permission from Never to No Set and dump out XenForo_Visitor::getInstance()->getPermissions(); ['developer']['canDownload'] will still show as True. Do non-node permission only have 'allow' and 'never' states but no way to check unset?
 
I believe it's 'allow', 'deny', 'unset' and 'use_int'. (could be wrong though)

deny = never
unset = no
 
So I set the permission in 'User Permission' section for the user I'm testing in the admin section and here are the outputs:

XenForo_Visitor::getInstance()->hasPermission('developer', 'canDownload')
Not Set (No) => true
Allow => true
Never => false

Why does Not Set return true?
EDIT: Tried this with another user and didn't have the issue. Not sure what was causing it...
 
Last edited:
Back
Top Bottom