Search Permissions

R

ragtek

Guest
Where is the best place, to check the permissions for own search handlers?

In the search controller it's only checking for the global search permissions
PHP:
		if (!XenForo_Visitor::getInstance()->canSearch())
		{
			throw $this->getNoPermissionResponseException();
		}
That's why i think that i have to check them in getSearchFormControllerResponse.
Is this ok, or is there a other place?
 

Onimua

Well-known member
I believe you're looking for canViewResult().

Check line ~126 in XenForo_Search_DataHandler_Thread for example.
 
R

ragtek

Guest
CanVIewResult runs AFAIK "while" the search, to see if a result can be shown or not.
So that's IMHO too late, if the user have no permission to "search my articles", why would he been allowed to use the search formular^^
 

Mike

XenForo developer
Staff member
I personally don't see significant value in preventing a user from searching specific types of content.
 
R

ragtek

Guest
Why? if somebody isn't allowed to use the new contenttype (in my case article), IMHO he shouldn't be able to see the search form.
 

Mike

XenForo developer
Staff member
Sorry, I thought you meant a permission for searching articles.

Where you suggested makes the most sense.
 
Top