1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Search Permissions

Discussion in 'XenForo Development Discussions' started by ragtek, Feb 21, 2011.

  1. ragtek

    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
            if (!XenForo_Visitor::getInstance()->canSearch())

    That's why i think that i have to check them in getSearchFormControllerResponse.
    Is this ok, or is there a other place?
  2. Onimua

    Onimua Well-Known Member

    I believe you're looking for canViewResult().

    Check line ~126 in XenForo_Search_DataHandler_Thread for example.
  3. ragtek

    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^^
  4. Mike

    Mike XenForo Developer Staff Member

    I personally don't see significant value in preventing a user from searching specific types of content.
  5. ragtek

    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.
  6. Mike

    Mike XenForo Developer Staff Member

    Sorry, I thought you meant a permission for searching articles.

    Where you suggested makes the most sense.

Share This Page