{"action":"created","comment":{"url":"https://api.github.com/repos/vbernard-coveo/samples/pulls/comments/126787670","pull_request_review_id":49306595,"id":126787670,"diff_hunk":"@@ -0,0 +1,162 @@\n+﻿// Copyright (c) 2005-2017, Coveo Solutions Inc.\n+\n+using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Reflection;\n+using Coveo.AbstractLayer.RepositoryItem;\n+using Coveo.AbstractLayer.Security;\n+using Coveo.Framework.CNL;\n+using Coveo.Framework.Log;\n+using Coveo.Framework.Processor;\n+using Coveo.Framework.Fields;\n+using Coveo.SearchProvider.Pipelines;\n+using Coveo.SearchProvider;\n+using Coveo.SearchProvider.ContentSearch;\n+using Sitecore.ContentSearch;\n+using Sitecore.Data;\n+using Sitecore.Data.Items;\n+using Sitecore.Events;\n+\n+namespace CreateSecuredItemPreview\n+{\n+  /// <summary>\n+  /// <c>coveoPostItemProcessingPipeline</c> processor that creates a stripped down public copy of a marked item.\n+  /// </summary>\n+  /// <remarks>This processor assumes the HTML is using UTF8 encoding.</remarks>\n+  public class CreateSecuredItemPreviewProcessor : IProcessor<CoveoPostItemProcessingPipelineArgs>\n+  {\n+    private static readonly ILogger s_Logger = CoveoLogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);\n+    private const string CHECKBOX_FIELD_CHECKED_VALUE = \"1\";\n+    private const string STRING_SEPARATOR_FOR_FIELDS_TO_REMOVE = \";\";\n+    private const string EMPTY_SITECORE_SECURITY_DOMAIN = \"\";\n+    private const string NEW_METADATA_ITEM_IS_A_COPY = \"ItemIsACopy\";\n+    private const string NEW_METADATA_FIELDS_TO_REMOVE = \"FieldsToRemove\";\n+    private const string SITECORE_FIELDS_TO_HIDE_ID_LIST = \"fieldstoremoveids\";\n+    private const char CHAR_SEPARATOR_FOR_FIELDS_TO_REMOVE = ';';\n+\n+    /// <summary>\n+    /// ID of the field where the Field Remover is activated\n+    /// </summary>\n+    public string ActivateFieldRemoverID { get; set; }\n+\n+    /// <summary>\n+    /// ID of the field where the Preview Remover is activated\n+    /// </summary>\n+    public string ActivatePreviewRemoverID { get; set; }\n+\n+    /// <summary>\n+    /// Suffix that will be added at the end of the duplicated item URI\n+    /// </summary>\n+    public string LimitedItemSuffix { get; set; }\n+\n+    /// <inheritDoc />\n+    public void Process(CoveoPostItemProcessingPipelineArgs p_Args)\n+    {\n+      s_Logger.TraceEntering();\n+\n+      Precondition.NotNull(p_Args, () => () => p_Args);\n+      CoveoIndexableItem coveoIndexableItem = p_Args.CoveoItem;\n+      SitecoreIndexableItem sitecoreIndexableItem = p_Args.Item as SitecoreIndexableItem;\n+      ID activateFieldRemoverID = new ID(ActivateFieldRemoverID);\n+      ID activatePreviewRemoverID = new ID(ActivatePreviewRemoverID);\n+      ISearchIndex searchIndex = new CoveoIndexFetcher().GetCoveoSearchIndex(sitecoreIndexableItem);","path":"coveo-for-sitecore/solutions/CreateSecuredItemPreview/CreateSecuredItemPreview/CreateSecuredItemPreviewProcessor.cs","position":63,"original_position":63,"commit_id":"65d7fd741d46b5b5f80674b342663eb64ba49d43","original_commit_id":"65d7fd741d46b5b5f80674b342663eb64ba49d43","user":{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false},"body":"DOne","created_at":"2017-07-11T19:39:30Z","updated_at":"2017-07-11T19:39:30Z","html_url":"https://github.com/vbernard-coveo/samples/pull/1#discussion_r126787670","pull_request_url":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/vbernard-coveo/samples/pulls/comments/126787670"},"html":{"href":"https://github.com/vbernard-coveo/samples/pull/1#discussion_r126787670"},"pull_request":{"href":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1","id":129750766,"html_url":"https://github.com/vbernard-coveo/samples/pull/1","diff_url":"https://github.com/vbernard-coveo/samples/pull/1.diff","patch_url":"https://github.com/vbernard-coveo/samples/pull/1.patch","issue_url":"https://api.github.com/repos/vbernard-coveo/samples/issues/1","number":1,"state":"open","locked":false,"title":"Create Secured Item Preview processor project - First version","user":{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-10T19:04:50Z","updated_at":"2017-07-11T19:39:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f13e83c2765b8bcb51192fa3b1dd0e3cc90f5902","assignee":{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false},"assignees":[{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1/commits","review_comments_url":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1/comments","review_comment_url":"https://api.github.com/repos/vbernard-coveo/samples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vbernard-coveo/samples/issues/1/comments","statuses_url":"https://api.github.com/repos/vbernard-coveo/samples/statuses/65d7fd741d46b5b5f80674b342663eb64ba49d43","head":{"label":"vbernard-coveo:CreateSecuredItemPreview","ref":"CreateSecuredItemPreview","sha":"65d7fd741d46b5b5f80674b342663eb64ba49d43","user":{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false},"repo":{"id":96468732,"name":"samples","full_name":"vbernard-coveo/samples","owner":{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vbernard-coveo/samples","description":"Coveo snippets and samples!","fork":true,"url":"https://api.github.com/repos/vbernard-coveo/samples","forks_url":"https://api.github.com/repos/vbernard-coveo/samples/forks","keys_url":"https://api.github.com/repos/vbernard-coveo/samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vbernard-coveo/samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vbernard-coveo/samples/teams","hooks_url":"https://api.github.com/repos/vbernard-coveo/samples/hooks","issue_events_url":"https://api.github.com/repos/vbernard-coveo/samples/issues/events{/number}","events_url":"https://api.github.com/repos/vbernard-coveo/samples/events","assignees_url":"https://api.github.com/repos/vbernard-coveo/samples/assignees{/user}","branches_url":"https://api.github.com/repos/vbernard-coveo/samples/branches{/branch}","tags_url":"https://api.github.com/repos/vbernard-coveo/samples/tags","blobs_url":"https://api.github.com/repos/vbernard-coveo/samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vbernard-coveo/samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vbernard-coveo/samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/vbernard-coveo/samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vbernard-coveo/samples/statuses/{sha}","languages_url":"https://api.github.com/repos/vbernard-coveo/samples/languages","stargazers_url":"https://api.github.com/repos/vbernard-coveo/samples/stargazers","contributors_url":"https://api.github.com/repos/vbernard-coveo/samples/contributors","subscribers_url":"https://api.github.com/repos/vbernard-coveo/samples/subscribers","subscription_url":"https://api.github.com/repos/vbernard-coveo/samples/subscription","commits_url":"https://api.github.com/repos/vbernard-coveo/samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/vbernard-coveo/samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/vbernard-coveo/samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/vbernard-coveo/samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/vbernard-coveo/samples/contents/{+path}","compare_url":"https://api.github.com/repos/vbernard-coveo/samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vbernard-coveo/samples/merges","archive_url":"https://api.github.com/repos/vbernard-coveo/samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vbernard-coveo/samples/downloads","issues_url":"https://api.github.com/repos/vbernard-coveo/samples/issues{/number}","pulls_url":"https://api.github.com/repos/vbernard-coveo/samples/pulls{/number}","milestones_url":"https://api.github.com/repos/vbernard-coveo/samples/milestones{/number}","notifications_url":"https://api.github.com/repos/vbernard-coveo/samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vbernard-coveo/samples/labels{/name}","releases_url":"https://api.github.com/repos/vbernard-coveo/samples/releases{/id}","deployments_url":"https://api.github.com/repos/vbernard-coveo/samples/deployments","created_at":"2017-07-06T20:19:22Z","updated_at":"2017-07-06T20:19:24Z","pushed_at":"2017-07-10T19:04:51Z","git_url":"git://github.com/vbernard-coveo/samples.git","ssh_url":"git@github.com:vbernard-coveo/samples.git","clone_url":"https://github.com/vbernard-coveo/samples.git","svn_url":"https://github.com/vbernard-coveo/samples","homepage":null,"size":717,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"vbernard-coveo:master","ref":"master","sha":"594ea0b67f604b784ad3169ac1bd21fd68bd4416","user":{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false},"repo":{"id":96468732,"name":"samples","full_name":"vbernard-coveo/samples","owner":{"login":"vbernard-coveo","id":25225870,"avatar_url":"https://avatars2.githubusercontent.com/u/25225870?v=3","gravatar_id":"","url":"https://api.github.com/users/vbernard-coveo","html_url":"https://github.com/vbernard-coveo","followers_url":"https://api.github.com/users/vbernard-coveo/followers","following_url":"https://api.github.com/users/vbernard-coveo/following{/other_user}","gists_url":"https://api.github.com/users/vbernard-coveo/gists{/gist_id}","starred_url":"https://api.github.com/users/vbernard-coveo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vbernard-coveo/subscriptions","organizations_url":"https://api.github.com/users/vbernard-coveo/orgs","repos_url":"https://api.github.com/users/vbernard-coveo/repos","events_url":"https://api.github.com/users/vbernard-coveo/events{/privacy}","received_events_url":"https://api.github.com/users/vbernard-coveo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vbernard-coveo/samples","description":"Coveo snippets and samples!","fork":true,"url":"https://api.github.com/repos/vbernard-coveo/samples","forks_url":"https://api.github.com/repos/vbernard-coveo/samples/forks","keys_url":"https://api.github.com/repos/vbernard-coveo/samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vbernard-coveo/samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vbernard-coveo/samples/teams","hooks_url":"https://api.github.com/repos/vbernard-coveo/samples/hooks","issue_events_url":"https://api.github.com/repos/vbernard-coveo/samples/issues/events{/number}","events_url":"https://api.github.com/repos/vbernard-coveo/samples/events","assignees_url":"https://api.github.com/repos/vbernard-coveo/samples/assignees{/user}","branches_url":"https://api.github.com/repos/vbernard-coveo/samples/branches{/branch}","tags_url":"https://api.github.com/repos/vbernard-coveo/samples/tags","blobs_url":"https://api.github.com/repos/vbernard-coveo/samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vbernard-coveo/samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vbernard-coveo/samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/vbernard-coveo/samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vbernard-coveo/samples/statuses/{sha}","languages_url":"https://api.github.com/repos/vbernard-coveo/samples/languages","stargazers_url":"https://api.github.com/repos/vbernard-coveo/samples/stargazers","contributors_url":"https://api.github.com/repos/vbernard-coveo/samples/contributors","subscribers_url":"https://api.github.com/repos/vbernard-coveo/samples/subscribers","subscription_url":"https://api.github.com/repos/vbernard-coveo/samples/subscription","commits_url":"https://api.github.com/repos/vbernard-coveo/samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/vbernard-coveo/samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/vbernard-coveo/samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/vbernard-coveo/samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/vbernard-coveo/samples/contents/{+path}","compare_url":"https://api.github.com/repos/vbernard-coveo/samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vbernard-coveo/samples/merges","archive_url":"https://api.github.com/repos/vbernard-coveo/samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vbernard-coveo/samples/downloads","issues_url":"https://api.github.com/repos/vbernard-coveo/samples/issues{/number}","pulls_url":"https://api.github.com/repos/vbernard-coveo/samples/pulls{/number}","milestones_url":"https://api.github.com/repos/vbernard-coveo/samples/milestones{/number}","notifications_url":"https://api.github.com/repos/vbernard-coveo/samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vbernard-coveo/samples/labels{/name}","releases_url":"https://api.github.com/repos/vbernard-coveo/samples/releases{/id}","deployments_url":"https://api.github.com/repos/vbernard-coveo/samples/deployments","created_at":"2017-07-06T20:19:22Z","updated_at":"2017-07-06T20:19:24Z","pushed_at":"2017-07-10T19:04:51Z","git_url":"git://github.com/vbernard-coveo/samples.git","ssh_url":"git@github.com:vbernard-coveo/samples.git","clone_url":"https://github.com/vbernard-coveo/samples.git","svn_url":"https://github.com/vbernard-coveo/samples","homepage":null,"size":717,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1"},"html":{"href":"https://github.com/vbernard-coveo/samples/pull/1"},"issue":{"href":"https://api.github.com/repos/vbernard-coveo/samples/issues/1"},"comments":{"href":"https://api.github.com/repos/vbernard-coveo/samples/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/vbernard-coveo/samples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vbernard-coveo/samples/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/vbernard-coveo/samples/statuses/65d7fd741d46b5b5f80674b342663eb64ba49d43"}}}}
{"actor":{"display_login":"vbernard-coveo"}}