Copied to clipboard

Flag this post as spam?

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


  • Marie 14 posts 36 karma points
    Apr 20, 2012 @ 13:30
    Marie
    0

    MediaProtect and Examine GatheringNodeData Event

    Hi

    I am looking into using Media Protect and linking in with indexing with Examine. I wish to index the roles of a protected node so security can be applied when querying the index. I have successfully got this working for Content nodes and also when updating/publishing a media item from the umbraco back office.

    However, with Media I have an error occuring when the index is first built from the File System Watcher, the following error occurs when checking the Library.IsProtected(node.Id, node.Path) method on the GatheringNodeData Event

    with an error relating to finding the config file... Object not set an an Instance..

       at MediaProtect.Configuration.Config.get_MediaAccessFile()
       at .()
       at .(Int32 )
       at MediaProtect.Access.MediaAccess.IsProtected(Int32 nodeId, String path)
       at MediaProtect.Library.Library.IsProtected(Int32 nodeId, String path)

    I'm not sure how the File System Watcher works but seems to be an issue with Media Protect finding the mediaaccess.config file when indexing during this method.

    Any help/advice would be appreciated from any Media Protect/Examine experts.

    For info - GatheringNodeData Event code is

    private void IndexMediaRoles(IndexingNodeDataEventArgs e, Media node)
            {
                if (e.IndexType == IndexTypes.Media)
                {
                    try
                    {
                        string searchRoles = "";
                        if (Library.IsProtected(node.Id, node.Path))
                        {
                            XPathNodeIterator groups = Library.AllowedGroups(node.Id, node.Path);
                            List<string> roleList = new List<string>();
                            foreach (XPathNavigator group in groups)
                            {
                                roleList.Add(group.Value);
                            }
                            searchRoles = string.Join(" ", roleList);
                        }

                        e.Fields.Add("Roles", searchRoles);
                    }
                    catch (Exception ex)
                    {
                        umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Error, umbraco.BusinessLogic.User.GetUser(0), -1, ex.Message);
                    }
                }
            }

    Thanks in advance.

Please Sign in or register to post replies

Write your reply to:

Draft