XF 2.1 Is this how I should handle permissions?

AndrewSimm

Well-known member
This is in my controller

PHP:
        $visitor = \XF::visitor();

        if (!$visitor->hasPermission('andrew_articles', 'canCreateEditArticle')) {

            throw $this->exception($this->noPermission());

        }

        if ($visitor->hasPermission('andrew_articles', 'canCreateEditArticle')) {
            
            blah blah create article

        }
 
Back
Top Bottom