xf_phantom
Well-known member
Based on http://xenforo.com/community/threads/permission-analysis.51255/ and my reply http://xenforo.com/community/threads/permission-analysis.51255/#post-549102
I would love to see something to log the permission changes happening via the addon system.
And that's the point
What if i have 2 addons installed (e.g. an addon changing the view permission based on the age+ e.g. an addon which allows you to create only 2 new threads per day.
XF permission analysis would still show "YES" because of the general permission, but it would be NO for several users because of the addon code, right?
Where to search for the problem?
Some addons have their settings in the acp options, some in the forum options form and some have their own acp controllers.. It can get a real nightmare.... Specially if you have no clue what you're looking for. You just know, SOMETHING isn't right here and you have to deactivate 150 addons and active them to find the problem.
That's why I as admin would love to see in the detailswindow of the new permission analysis at least a notice, addon "X" is manipulating the return value based on XYZ...
What about an own Logger for this, which can/have to be used by addmins
in the default frontend calls, nothing would happen, XenForo_Model_PermissionChangeLogger wouldn't log anything for better performance.
If it's called via the acp controller and the "permission <-> method" map, it would log the changes and show them in the details window.
1. => REAL VALUE would be shown
2. => it would be easier to see what changed the value
My idea is just a quick codesnipper and i know it's not the perfect solution because addons would need to use this, but it would be a great start and help with debugging
I would love to see something to log the permission changes happening via the addon system.
Let's say you've created a premium membership and you want to confirm user A (promoted) can view and post in forum Y but user B (not promoted) cannot view or post in forum Y. This let's you do that.
And that's the point
What if i have 2 addons installed (e.g. an addon changing the view permission based on the age+ e.g. an addon which allows you to create only 2 new threads per day.
XF permission analysis would still show "YES" because of the general permission, but it would be NO for several users because of the addon code, right?
Where to search for the problem?
Some addons have their settings in the acp options, some in the forum options form and some have their own acp controllers.. It can get a real nightmare.... Specially if you have no clue what you're looking for. You just know, SOMETHING isn't right here and you have to deactivate 150 addons and active them to find the problem.
That's why I as admin would love to see in the detailswindow of the new permission analysis at least a notice, addon "X" is manipulating the return value based on XYZ...
What about an own Logger for this, which can/have to be used by addmins
PHP:
// this is the addon code
public function canViewForum(array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null)
{
$parentReturn = parent::canViewForum($forum, $errorPhraseKey, $nodePermissions, $viewingUser);
if ($parentReturn && false == $this->checkSomething()){
XenForo_Model_PermissionChangeLogger::log('forum', 'canViewForum', 'addonX changed this based on ...', true);
$errorPhraseKey = 'addonx_no_view_forum_perm';
return false;
}
XenForo_Model_PermissionChangeLogger::log('forum', 'canViewForum', 'addonX could change this based on ...', false); //just a notice to show that it COULD change something
return $parentReturn;
}
in the default frontend calls, nothing would happen, XenForo_Model_PermissionChangeLogger wouldn't log anything for better performance.
If it's called via the acp controller and the "permission <-> method" map, it would log the changes and show them in the details window.
1. => REAL VALUE would be shown
2. => it would be easier to see what changed the value
My idea is just a quick codesnipper and i know it's not the perfect solution because addons would need to use this, but it would be a great start and help with debugging
Upvote
0