{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/comments/74900660","id":74900660,"diff_hunk":"@@ -0,0 +1,133 @@\n+package org.jenkinsci.plugins.edithelp;\n+\n+import java.io.File;\n+import java.io.FileNotFoundException;\n+import java.io.IOException;\n+import java.io.BufferedWriter;\n+import java.io.OutputStreamWriter;\n+import java.io.FileOutputStream;\n+import hudson.Extension;\n+import hudson.cli.PrivateKeyProvider;\n+import hudson.model.RootAction;\n+import jenkins.model.Jenkins;\n+import org.apache.commons.lang.StringUtils;\n+import org.kohsuke.accmod.Restricted;\n+import org.kohsuke.stapler.Stapler;\n+import java.nio.charset.StandardCharsets;\n+import java.util.List;\n+import java.util.Map;\n+import java.util.TreeMap;\n+import java.util.logging.Logger;\n+\n+import static java.nio.file.Files.readAllLines;\n+import static java.util.logging.Level.FINE;\n+\n+@Extension\n+public class EditHelpRootAction implements RootAction {\n+\n+    private static final Logger LOGGER = Logger.getLogger(PrivateKeyProvider.class.getName());\n+\n+    //array for cache storage\n+    private Map<String, String> arrayOfHelp = new TreeMap<String, String>();\n+\n+    //reading files into cache\n+    public EditHelpRootAction() throws IOException, FileNotFoundException {\n+        Jenkins jn = Jenkins.getActiveInstance();\n+        if (jn != null) {\n+            File dirfile = jn.getRootDir();         \n+            if(dirfile != null) {\n+                //check if the directory exists\n+                File helpManagerFile = new File(dirfile, \"helpmanager\");\n+\n+                if(!helpManagerFile.exists())\n+                    if (!helpManagerFile.mkdirs()) {\n+                        LOGGER.log(FINE,\"unable create directory\");\n+                    }\n+\n+                //reading files from the directory\n+                if (helpManagerFile.getAbsolutePath() != null) {\n+                    File dir = new File(helpManagerFile.getAbsolutePath());\n+                    File[] files = dir.listFiles();\n+                    if (files != null){\n+                        for (File file : files) {\n+                            if (file.isFile()) {\n+                                List<String> getStringList = readAllLines(file.toPath(),StandardCharsets.UTF_8);\n+                                String getListtoStr = StringUtils.join(getStringList, \"\\n\");\n+                                arrayOfHelp.put(file.getName(),getListtoStr);\n+                            }\n+                        }\n+                    }\n+                }\n+            }            \n+        }            \n+    }\n+\n+    @Override\n+    public String getIconFileName() {\n+        return null;\n+    }\n+\n+    @Override\n+    public String getDisplayName() {\n+        return null;\n+    }\n+\n+    @Override\n+    public String getUrlName() {\n+        return \"helpmanager\";\n+    }\n+\n+    //copying from array\n+    public String getHelpInfo() {\n+        //process get request\n+        String className = Stapler.getCurrentRequest().getParameter(\"class\");\n+        return arrayOfHelp.get(className+\".html\");\n+    }\n+\n+    //save text area into file and array\n+    public void doUpdateHelpInfo() {\n+        //process get request\n+        String className = Stapler.getCurrentRequest().getParameter(\"class\");","path":"src/main/java/org/jenkinsci/plugins/edithelp/EditHelpRootAction.java","position":90,"original_position":90,"commit_id":"17b31ee4229ef84ed6a4166667f4d36ce3ea50ea","original_commit_id":"17b31ee4229ef84ed6a4166667f4d36ce3ea50ea","user":{"login":"oleg-nenashev","id":3000480,"avatar_url":"https://avatars.githubusercontent.com/u/3000480?v=3","gravatar_id":"","url":"https://api.github.com/users/oleg-nenashev","html_url":"https://github.com/oleg-nenashev","followers_url":"https://api.github.com/users/oleg-nenashev/followers","following_url":"https://api.github.com/users/oleg-nenashev/following{/other_user}","gists_url":"https://api.github.com/users/oleg-nenashev/gists{/gist_id}","starred_url":"https://api.github.com/users/oleg-nenashev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleg-nenashev/subscriptions","organizations_url":"https://api.github.com/users/oleg-nenashev/orgs","repos_url":"https://api.github.com/users/oleg-nenashev/repos","events_url":"https://api.github.com/users/oleg-nenashev/events{/privacy}","received_events_url":"https://api.github.com/users/oleg-nenashev/received_events","type":"User","site_admin":false},"body":"There should be Jenkins.ADMINISTER permission check","created_at":"2016-08-16T09:13:25Z","updated_at":"2016-08-16T09:13:25Z","html_url":"https://github.com/jenkinsci/help-editor-plugin/pull/1#discussion_r74900660","pull_request_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/comments/74900660"},"html":{"href":"https://github.com/jenkinsci/help-editor-plugin/pull/1#discussion_r74900660"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1","id":80553192,"html_url":"https://github.com/jenkinsci/help-editor-plugin/pull/1","diff_url":"https://github.com/jenkinsci/help-editor-plugin/pull/1.diff","patch_url":"https://github.com/jenkinsci/help-editor-plugin/pull/1.patch","issue_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/issues/1","number":1,"state":"open","locked":false,"title":"Help editor plugin","user":{"login":"samatdav","id":9495022,"avatar_url":"https://avatars.githubusercontent.com/u/9495022?v=3","gravatar_id":"","url":"https://api.github.com/users/samatdav","html_url":"https://github.com/samatdav","followers_url":"https://api.github.com/users/samatdav/followers","following_url":"https://api.github.com/users/samatdav/following{/other_user}","gists_url":"https://api.github.com/users/samatdav/gists{/gist_id}","starred_url":"https://api.github.com/users/samatdav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samatdav/subscriptions","organizations_url":"https://api.github.com/users/samatdav/orgs","repos_url":"https://api.github.com/users/samatdav/repos","events_url":"https://api.github.com/users/samatdav/events{/privacy}","received_events_url":"https://api.github.com/users/samatdav/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-09T02:41:29Z","updated_at":"2016-08-16T09:13:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c7967ab3e2ebefd859f63ee647982856aae87d80","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/issues/1/comments","statuses_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/statuses/17b31ee4229ef84ed6a4166667f4d36ce3ea50ea","head":{"label":"samatdav:master","ref":"master","sha":"17b31ee4229ef84ed6a4166667f4d36ce3ea50ea","user":{"login":"samatdav","id":9495022,"avatar_url":"https://avatars.githubusercontent.com/u/9495022?v=3","gravatar_id":"","url":"https://api.github.com/users/samatdav","html_url":"https://github.com/samatdav","followers_url":"https://api.github.com/users/samatdav/followers","following_url":"https://api.github.com/users/samatdav/following{/other_user}","gists_url":"https://api.github.com/users/samatdav/gists{/gist_id}","starred_url":"https://api.github.com/users/samatdav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samatdav/subscriptions","organizations_url":"https://api.github.com/users/samatdav/orgs","repos_url":"https://api.github.com/users/samatdav/repos","events_url":"https://api.github.com/users/samatdav/events{/privacy}","received_events_url":"https://api.github.com/users/samatdav/received_events","type":"User","site_admin":false},"repo":{"id":65094463,"name":"help-editor-plugin","full_name":"samatdav/help-editor-plugin","owner":{"login":"samatdav","id":9495022,"avatar_url":"https://avatars.githubusercontent.com/u/9495022?v=3","gravatar_id":"","url":"https://api.github.com/users/samatdav","html_url":"https://github.com/samatdav","followers_url":"https://api.github.com/users/samatdav/followers","following_url":"https://api.github.com/users/samatdav/following{/other_user}","gists_url":"https://api.github.com/users/samatdav/gists{/gist_id}","starred_url":"https://api.github.com/users/samatdav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samatdav/subscriptions","organizations_url":"https://api.github.com/users/samatdav/orgs","repos_url":"https://api.github.com/users/samatdav/repos","events_url":"https://api.github.com/users/samatdav/events{/privacy}","received_events_url":"https://api.github.com/users/samatdav/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/samatdav/help-editor-plugin","description":null,"fork":false,"url":"https://api.github.com/repos/samatdav/help-editor-plugin","forks_url":"https://api.github.com/repos/samatdav/help-editor-plugin/forks","keys_url":"https://api.github.com/repos/samatdav/help-editor-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samatdav/help-editor-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samatdav/help-editor-plugin/teams","hooks_url":"https://api.github.com/repos/samatdav/help-editor-plugin/hooks","issue_events_url":"https://api.github.com/repos/samatdav/help-editor-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/samatdav/help-editor-plugin/events","assignees_url":"https://api.github.com/repos/samatdav/help-editor-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/samatdav/help-editor-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/samatdav/help-editor-plugin/tags","blobs_url":"https://api.github.com/repos/samatdav/help-editor-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samatdav/help-editor-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samatdav/help-editor-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/samatdav/help-editor-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samatdav/help-editor-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/samatdav/help-editor-plugin/languages","stargazers_url":"https://api.github.com/repos/samatdav/help-editor-plugin/stargazers","contributors_url":"https://api.github.com/repos/samatdav/help-editor-plugin/contributors","subscribers_url":"https://api.github.com/repos/samatdav/help-editor-plugin/subscribers","subscription_url":"https://api.github.com/repos/samatdav/help-editor-plugin/subscription","commits_url":"https://api.github.com/repos/samatdav/help-editor-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/samatdav/help-editor-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/samatdav/help-editor-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/samatdav/help-editor-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/samatdav/help-editor-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/samatdav/help-editor-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samatdav/help-editor-plugin/merges","archive_url":"https://api.github.com/repos/samatdav/help-editor-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samatdav/help-editor-plugin/downloads","issues_url":"https://api.github.com/repos/samatdav/help-editor-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/samatdav/help-editor-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/samatdav/help-editor-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/samatdav/help-editor-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samatdav/help-editor-plugin/labels{/name}","releases_url":"https://api.github.com/repos/samatdav/help-editor-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/samatdav/help-editor-plugin/deployments","created_at":"2016-08-06T17:41:58Z","updated_at":"2016-08-08T11:42:47Z","pushed_at":"2016-08-16T07:33:21Z","git_url":"git://github.com/samatdav/help-editor-plugin.git","ssh_url":"git@github.com:samatdav/help-editor-plugin.git","clone_url":"https://github.com/samatdav/help-editor-plugin.git","svn_url":"https://github.com/samatdav/help-editor-plugin","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":1,"forks":5,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"jenkinsci:pull","ref":"pull","sha":"9ac9554c3edd799db773e91ddf2edae838149b36","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":65211724,"name":"help-editor-plugin","full_name":"jenkinsci/help-editor-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/help-editor-plugin","description":null,"fork":true,"url":"https://api.github.com/repos/jenkinsci/help-editor-plugin","forks_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/help-editor-plugin/deployments","created_at":"2016-08-08T14:36:35Z","updated_at":"2016-08-08T19:49:31Z","pushed_at":"2016-08-16T07:33:22Z","git_url":"git://github.com/jenkinsci/help-editor-plugin.git","ssh_url":"git@github.com:jenkinsci/help-editor-plugin.git","clone_url":"https://github.com/jenkinsci/help-editor-plugin.git","svn_url":"https://github.com/jenkinsci/help-editor-plugin","homepage":null,"size":22,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1"},"html":{"href":"https://github.com/jenkinsci/help-editor-plugin/pull/1"},"issue":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/issues/1"},"comments":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/help-editor-plugin/statuses/17b31ee4229ef84ed6a4166667f4d36ce3ea50ea"}}}}
{"actor":{"display_login":"oleg-nenashev"}}