Trying to extend XenForo_Permission

Jake B.

Well-known member
I am trying to extend XenForo_Permission, more specifically the 'hasPermission' function in it, however it does not seem to be working, What I have is below:

Permission.php:
Code:
<?php
class XXX_Permission extends XFCP_XXX_Permission
{
public static function hasPermission(array $permissions, $group, $permission)
{
die;
}
}

So the page shouldn't load after the first time a permission is checked, though it does not seem to be working. I was just wondering if for some reason it is not possible to extend this class, as I do not have issues with any of the other classes being extended in the same manner using the same loadClass function. Help would be greatly appreciated.

Also, my code loadClass function is similar to the following:

Code:
public static function loadClass($class, array &$extend)
{
switch ($class)
{
case 'XenForo_Permission':
$extend[] = 'XXX_Permission';
break;}
}

If this is not possible, do you happen to have any idea of how to extend this functionality?
 
Looks like the only classes that are loaded (on the index page by default) are
XenForo_Route_Prefix_Index
XenForo_ControllerPublic_Index
XenForo_Session
XenForo_Model_User
XenForo_Visitor
XenForo_Route_Prefix_Forums
XenForo_ControllerPublic_Forum
XenForo_Model_ProfilePost
XenForo_Model_Node
XenForo_NodeHandler_Category
XenForo_NodeHandler_Forum
XenForo_Model_Category
XenForo_Model_Forum
XenForo_Model_Session
XenForo_Model_DataRegistry
XenForo_ViewPublic_Forum_List
XenForo_Route_Prefix_Members
XenForo_Route_Prefix_Categories
XenForo_Route_Prefix_Posts
Odd. Guess I can extend the hasPermission in XenForo_Visitor, that *should* be all that I need.
 
XenForo_Permission is a core class; it cannot be extended. (There's no point either; it's a bunch of helper functions)

You may want to instead modify the permission array itself.
 
XenForo_Permission is a core class; it cannot be extended. (There's no point either; it's a bunch of helper functions)

You may want to instead modify the permission array itself.

It's not feasible to do that, due to the number of calls to hasPermission. It works fine for my needs by extending XenForo_Visitor::hasPermission()
 
Back
Top Bottom