Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John 6 posts 26 karma points
    Jun 15, 2010 @ 12:25
    John
    0

    Umbraco Examine - protected pages

    Hi,

    We have a site that has vairous membership restricted areas.  Currently we are using Umbraco Examine to search the site, but we don't want to return results from pages that are not accessible by the current user.

    Is this possible, and how would I go about it?

    Thanks,

    john.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Jun 15, 2010 @ 15:19
    Aaron Powell
    0

    Are the protected pages meant to be included in the index or not?
    Examine can be configured to include or exclude protected pages (by default they are excluded) but it doesn't flag them in any way to indicate that they are protected. This is by design and wont be changed in (at least, not in v1).

    If you need them to be included in the same index as the unprotected pages you'll have to inject your own fields to indicate that they are protected or not. This can be done by adding a handler to the GatheringNodeData event on the BaseIndexProvider. This passes in a dictionary of fields that represents all the data, to include in the index. You can then add items to it if you need custom ones.

    The it's just a matter of including the filter in your search.

  • Murray Roke 503 posts 966 karma points c-trib
    May 14, 2013 @ 23:30
    Murray Roke
    0

    In my GatheringNodeData I wish to add isProtected info to the index , so I have code like so:

    bool isProtected = umbraco.library.IsProtected(int.Parse(node.Attribute("id").Value), node.Attribute("path").Value);

    However this throws a System.ArgumentNullException {"Value cannot be null.\r\nParameter name: umbracoContext"}

    Presumably because the umbracoContext is stored in the HttpContext, which is null because the indexing is running on a separate thread without an HttpContext

     

  • Murray Roke 503 posts 966 karma points c-trib
    May 15, 2013 @ 02:14
    Murray Roke
    1

    ahh, use this intead

    umbraco.cms.businesslogic.web.Access.IsProtected(int.Parse(e.Node.Attribute("id").Value), e.Node.Attribute("path").Value);
Please Sign in or register to post replies

Write your reply to:

Draft