GitHub PullRequestReviewCommentEvent at 2014-06-27 02:27:34
Repository: zanata-server
Actor: seanf
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/zanata/zanata-server/pulls/comments/14277607","id":14277607,"diff_hunk":"@@ -97,17 +264,98 @@ public static boolean isUserCoordinatorOfLanguage(HLocale lang) {\n         return false; // No authenticated user\n     }\n \n-    public static boolean isLanguageTeamMember(HLocale lang) {\n-        HAccount authenticatedAccount = getAuthenticatedAccount();\n-        PersonDAO personDAO =\n-                ServiceLocator.instance().getInstance(PersonDAO.class);\n+    /* 'team coordinator' can insert/update/delete language team members */\n+    @GrantsPermission(actions = { \"insert\", \"update\", \"delete\" })\n+    public static boolean canModifyLanguageTeamMembers(\n+            HLocaleMember localeMember) {\n+        return isUserCoordinatorOfLanguage(localeMember.getSupportedLanguage());\n+    }\n \n-        if (authenticatedAccount != null) {\n-            return personDAO.isUserInLanguageTeamWithRoles(\n-                    authenticatedAccount.getPerson(), lang, null, null, null);\n-        }\n+    /***************************************************************************\n+     * View Obsolete Project and Project Iteration rules\n+     **************************************************************************/\n \n-        return false; // No authenticated user\n+    // Only admin can view obsolete projects\n+    @GrantsPermission(actions = \"view-obsolete\")\n+    public static boolean canViewObsoleteProject(HProject project) {\n+        return getIdentity().hasRole(\"admin\");\n+    }\n+\n+    // Only admin can view obsolete project iterations\n+    @GrantsPermission(actions = \"view-obsolete\")\n+    public static boolean canViewObsoleteProjectIteration(\n+            HProjectIteration projectIteration) {\n+        return getIdentity().hasRole(\"admin\");\n+    }\n+\n+    /***************************************************************************\n+     * Mark Project and Project Iteration obsolete rules\n+     **************************************************************************/\n+\n+    // Only admin can archive projects\n+    @GrantsPermission(actions = \"mark-obsolete\")\n+    public static boolean canArchiveProject(HProject project) {\n+        return getIdentity().hasRole(\"admin\");\n+    }\n+\n+    // Only admin can archive project iterations\n+    @GrantsPermission(actions = \"mark-obsolete\")\n+    public static boolean canArchiveProjectIteration(\n+            HProjectIteration projectIteration) {\n+        return getIdentity().hasRole(\"admin\");\n+    }\n+\n+    /***************************************************************************\n+     * File Download rules\n+     **************************************************************************/\n+\n+    /*\n+     * Permissions to download files. NOTE: Currently any authenticated user can\n+     * download files\n+     */\n+    @GrantsPermission(actions = { \"download-single\", \"download-all\" })\n+    public static boolean canDownloadFiles(HProjectIteration projectIteration) {\n+        return getIdentity().isLoggedIn();\n+    }\n+\n+    /***************************************************************************\n+     * Version Group rules\n+     **************************************************************************/\n+    @GrantsPermission(actions = { \"update\", \"insert\" })\n+    public static boolean canInsertAndUpdateVersionGroup(HIterationGroup group) {\n+        return getAuthenticatedAccount().getPerson().isMaintainer(group);\n+    }\n+\n+    @GrantsPermission(actions = \"view-obsolete\")\n+    public static boolean canViewObsoleteVersionGroup(HIterationGroup group) {\n+        return getAuthenticatedAccount().getPerson()\n+                .isMaintainerOfVersionGroups();","path":"zanata-war/src/main/java/org/zanata/security/SecurityFunctions.java","position":298,"original_position":298,"commit_id":"cc282bb02e2a19df3618594973f80077162818a0","original_commit_id":"cc282bb02e2a19df3618594973f80077162818a0","user":{"login":"seanf","id":54155,"avatar_url":"https://avatars.githubusercontent.com/u/54155?","gravatar_id":"00aeb34669f48c410a552ff840108561","url":"https://api.github.com/users/seanf","html_url":"https://github.com/seanf","followers_url":"https://api.github.com/users/seanf/followers","following_url":"https://api.github.com/users/seanf/following{/other_user}","gists_url":"https://api.github.com/users/seanf/gists{/gist_id}","starred_url":"https://api.github.com/users/seanf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanf/subscriptions","organizations_url":"https://api.github.com/users/seanf/orgs","repos_url":"https://api.github.com/users/seanf/repos","events_url":"https://api.github.com/users/seanf/events{/privacy}","received_events_url":"https://api.github.com/users/seanf/received_events","type":"User","site_admin":false},"body":"For now, I would recommend admins only.\r\n\r\nIn future, we might let the maintainer of a group see the obsolete group, but if so we should do similarly for obsolete projects and iterations.","created_at":"2014-06-27T02:27:34Z","updated_at":"2014-06-27T02:27:34Z","html_url":"https://github.com/zanata/zanata-server/pull/478#discussion_r14277607","pull_request_url":"https://api.github.com/repos/zanata/zanata-server/pulls/478","_links":{"self":{"href":"https://api.github.com/repos/zanata/zanata-server/pulls/comments/14277607"},"html":{"href":"https://github.com/zanata/zanata-server/pull/478#discussion_r14277607"},"pull_request":{"href":"https://api.github.com/repos/zanata/zanata-server/pulls/478"}}},"pull_request":{"url":"https://api.github.com/repos/zanata/zanata-server/pulls/478","id":16584495,"html_url":"https://github.com/zanata/zanata-server/pull/478","diff_url":"https://github.com/zanata/zanata-server/pull/478.diff","patch_url":"https://github.com/zanata/zanata-server/pull/478.patch","issue_url":"https://api.github.com/repos/zanata/zanata-server/issues/478","number":478,"state":"open","title":"Extract application permissions from a drools file and into Java code.","user":{"login":"carlosmunoz","id":84676,"avatar_url":"https://avatars.githubusercontent.com/u/84676?","gravatar_id":"325bb3a4f9a4dfac2d415ff43efb1e9b","url":"https://api.github.com/users/carlosmunoz","html_url":"https://github.com/carlosmunoz","followers_url":"https://api.github.com/users/carlosmunoz/followers","following_url":"https://api.github.com/users/carlosmunoz/following{/other_user}","gists_url":"https://api.github.com/users/carlosmunoz/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmunoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmunoz/subscriptions","organizations_url":"https://api.github.com/users/carlosmunoz/orgs","repos_url":"https://api.github.com/users/carlosmunoz/repos","events_url":"https://api.github.com/users/carlosmunoz/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmunoz/received_events","type":"User","site_admin":false},"body":"This is in preparation for the move to CDI.\r\nTesting of this pull request must ensure that the same level of permissions in the drools file is still maintained. The drools file is still kept for reference. It may be removed after this pull request is QA'd and merged.","created_at":"2014-06-02T05:59:23Z","updated_at":"2014-06-27T02:27:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e8efc2d5532f90bb0e1e9281ee2aa60db14a895","assignee":{"login":"seanf","id":54155,"avatar_url":"https://avatars.githubusercontent.com/u/54155?","gravatar_id":"00aeb34669f48c410a552ff840108561","url":"https://api.github.com/users/seanf","html_url":"https://github.com/seanf","followers_url":"https://api.github.com/users/seanf/followers","following_url":"https://api.github.com/users/seanf/following{/other_user}","gists_url":"https://api.github.com/users/seanf/gists{/gist_id}","starred_url":"https://api.github.com/users/seanf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanf/subscriptions","organizations_url":"https://api.github.com/users/seanf/orgs","repos_url":"https://api.github.com/users/seanf/repos","events_url":"https://api.github.com/users/seanf/events{/privacy}","received_events_url":"https://api.github.com/users/seanf/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/zanata/zanata-server/pulls/478/commits","review_comments_url":"https://api.github.com/repos/zanata/zanata-server/pulls/478/comments","review_comment_url":"https://api.github.com/repos/zanata/zanata-server/pulls/comments/{number}","comments_url":"https://api.github.com/repos/zanata/zanata-server/issues/478/comments","statuses_url":"https://api.github.com/repos/zanata/zanata-server/statuses/cc282bb02e2a19df3618594973f80077162818a0","head":{"label":"zanata:sec-functions","ref":"sec-functions","sha":"cc282bb02e2a19df3618594973f80077162818a0","user":{"login":"zanata","id":637455,"avatar_url":"https://avatars.githubusercontent.com/u/637455?","gravatar_id":"0a06368d154f4db91cae77f7aedb4dfa","url":"https://api.github.com/users/zanata","html_url":"https://github.com/zanata","followers_url":"https://api.github.com/users/zanata/followers","following_url":"https://api.github.com/users/zanata/following{/other_user}","gists_url":"https://api.github.com/users/zanata/gists{/gist_id}","starred_url":"https://api.github.com/users/zanata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanata/subscriptions","organizations_url":"https://api.github.com/users/zanata/orgs","repos_url":"https://api.github.com/users/zanata/repos","events_url":"https://api.github.com/users/zanata/events{/privacy}","received_events_url":"https://api.github.com/users/zanata/received_events","type":"Organization","site_admin":false},"repo":{"id":1461609,"name":"zanata-server","full_name":"zanata/zanata-server","owner":{"login":"zanata","id":637455,"avatar_url":"https://avatars.githubusercontent.com/u/637455?","gravatar_id":"0a06368d154f4db91cae77f7aedb4dfa","url":"https://api.github.com/users/zanata","html_url":"https://github.com/zanata","followers_url":"https://api.github.com/users/zanata/followers","following_url":"https://api.github.com/users/zanata/following{/other_user}","gists_url":"https://api.github.com/users/zanata/gists{/gist_id}","starred_url":"https://api.github.com/users/zanata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanata/subscriptions","organizations_url":"https://api.github.com/users/zanata/orgs","repos_url":"https://api.github.com/users/zanata/repos","events_url":"https://api.github.com/users/zanata/events{/privacy}","received_events_url":"https://api.github.com/users/zanata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zanata/zanata-server","description":"Zanata is a web-based system for translators to translate documentation and software online using a web browser.","fork":false,"url":"https://api.github.com/repos/zanata/zanata-server","forks_url":"https://api.github.com/repos/zanata/zanata-server/forks","keys_url":"https://api.github.com/repos/zanata/zanata-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zanata/zanata-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zanata/zanata-server/teams","hooks_url":"https://api.github.com/repos/zanata/zanata-server/hooks","issue_events_url":"https://api.github.com/repos/zanata/zanata-server/issues/events{/number}","events_url":"https://api.github.com/repos/zanata/zanata-server/events","assignees_url":"https://api.github.com/repos/zanata/zanata-server/assignees{/user}","branches_url":"https://api.github.com/repos/zanata/zanata-server/branches{/branch}","tags_url":"https://api.github.com/repos/zanata/zanata-server/tags","blobs_url":"https://api.github.com/repos/zanata/zanata-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zanata/zanata-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zanata/zanata-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/zanata/zanata-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zanata/zanata-server/statuses/{sha}","languages_url":"https://api.github.com/repos/zanata/zanata-server/languages","stargazers_url":"https://api.github.com/repos/zanata/zanata-server/stargazers","contributors_url":"https://api.github.com/repos/zanata/zanata-server/contributors","subscribers_url":"https://api.github.com/repos/zanata/zanata-server/subscribers","subscription_url":"https://api.github.com/repos/zanata/zanata-server/subscription","commits_url":"https://api.github.com/repos/zanata/zanata-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/zanata/zanata-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/zanata/zanata-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/zanata/zanata-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/zanata/zanata-server/contents/{+path}","compare_url":"https://api.github.com/repos/zanata/zanata-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zanata/zanata-server/merges","archive_url":"https://api.github.com/repos/zanata/zanata-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zanata/zanata-server/downloads","issues_url":"https://api.github.com/repos/zanata/zanata-server/issues{/number}","pulls_url":"https://api.github.com/repos/zanata/zanata-server/pulls{/number}","milestones_url":"https://api.github.com/repos/zanata/zanata-server/milestones{/number}","notifications_url":"https://api.github.com/repos/zanata/zanata-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zanata/zanata-server/labels{/name}","releases_url":"https://api.github.com/repos/zanata/zanata-server/releases{/id}","created_at":"2011-03-10T00:24:47Z","updated_at":"2014-06-26T01:27:34Z","pushed_at":"2014-06-27T01:39:46Z","git_url":"git://github.com/zanata/zanata-server.git","ssh_url":"git@github.com:zanata/zanata-server.git","clone_url":"https://github.com/zanata/zanata-server.git","svn_url":"https://github.com/zanata/zanata-server","homepage":"http://zanata.org","size":218006,"stargazers_count":51,"watchers_count":51,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":20,"mirror_url":null,"open_issues_count":15,"forks":20,"open_issues":15,"watchers":51,"default_branch":"master"}},"base":{"label":"zanata:integration/master","ref":"integration/master","sha":"810d8950ff136676d467b563969566356c349d8b","user":{"login":"zanata","id":637455,"avatar_url":"https://avatars.githubusercontent.com/u/637455?","gravatar_id":"0a06368d154f4db91cae77f7aedb4dfa","url":"https://api.github.com/users/zanata","html_url":"https://github.com/zanata","followers_url":"https://api.github.com/users/zanata/followers","following_url":"https://api.github.com/users/zanata/following{/other_user}","gists_url":"https://api.github.com/users/zanata/gists{/gist_id}","starred_url":"https://api.github.com/users/zanata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanata/subscriptions","organizations_url":"https://api.github.com/users/zanata/orgs","repos_url":"https://api.github.com/users/zanata/repos","events_url":"https://api.github.com/users/zanata/events{/privacy}","received_events_url":"https://api.github.com/users/zanata/received_events","type":"Organization","site_admin":false},"repo":{"id":1461609,"name":"zanata-server","full_name":"zanata/zanata-server","owner":{"login":"zanata","id":637455,"avatar_url":"https://avatars.githubusercontent.com/u/637455?","gravatar_id":"0a06368d154f4db91cae77f7aedb4dfa","url":"https://api.github.com/users/zanata","html_url":"https://github.com/zanata","followers_url":"https://api.github.com/users/zanata/followers","following_url":"https://api.github.com/users/zanata/following{/other_user}","gists_url":"https://api.github.com/users/zanata/gists{/gist_id}","starred_url":"https://api.github.com/users/zanata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanata/subscriptions","organizations_url":"https://api.github.com/users/zanata/orgs","repos_url":"https://api.github.com/users/zanata/repos","events_url":"https://api.github.com/users/zanata/events{/privacy}","received_events_url":"https://api.github.com/users/zanata/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zanata/zanata-server","description":"Zanata is a web-based system for translators to translate documentation and software online using a web browser.","fork":false,"url":"https://api.github.com/repos/zanata/zanata-server","forks_url":"https://api.github.com/repos/zanata/zanata-server/forks","keys_url":"https://api.github.com/repos/zanata/zanata-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zanata/zanata-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zanata/zanata-server/teams","hooks_url":"https://api.github.com/repos/zanata/zanata-server/hooks","issue_events_url":"https://api.github.com/repos/zanata/zanata-server/issues/events{/number}","events_url":"https://api.github.com/repos/zanata/zanata-server/events","assignees_url":"https://api.github.com/repos/zanata/zanata-server/assignees{/user}","branches_url":"https://api.github.com/repos/zanata/zanata-server/branches{/branch}","tags_url":"https://api.github.com/repos/zanata/zanata-server/tags","blobs_url":"https://api.github.com/repos/zanata/zanata-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zanata/zanata-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zanata/zanata-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/zanata/zanata-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zanata/zanata-server/statuses/{sha}","languages_url":"https://api.github.com/repos/zanata/zanata-server/languages","stargazers_url":"https://api.github.com/repos/zanata/zanata-server/stargazers","contributors_url":"https://api.github.com/repos/zanata/zanata-server/contributors","subscribers_url":"https://api.github.com/repos/zanata/zanata-server/subscribers","subscription_url":"https://api.github.com/repos/zanata/zanata-server/subscription","commits_url":"https://api.github.com/repos/zanata/zanata-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/zanata/zanata-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/zanata/zanata-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/zanata/zanata-server/issues/comments/{number}","contents_url":"https://api.github.com/repos/zanata/zanata-server/contents/{+path}","compare_url":"https://api.github.com/repos/zanata/zanata-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zanata/zanata-server/merges","archive_url":"https://api.github.com/repos/zanata/zanata-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zanata/zanata-server/downloads","issues_url":"https://api.github.com/repos/zanata/zanata-server/issues{/number}","pulls_url":"https://api.github.com/repos/zanata/zanata-server/pulls{/number}","milestones_url":"https://api.github.com/repos/zanata/zanata-server/milestones{/number}","notifications_url":"https://api.github.com/repos/zanata/zanata-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zanata/zanata-server/labels{/name}","releases_url":"https://api.github.com/repos/zanata/zanata-server/releases{/id}","created_at":"2011-03-10T00:24:47Z","updated_at":"2014-06-26T01:27:34Z","pushed_at":"2014-06-27T01:39:46Z","git_url":"git://github.com/zanata/zanata-server.git","ssh_url":"git@github.com:zanata/zanata-server.git","clone_url":"https://github.com/zanata/zanata-server.git","svn_url":"https://github.com/zanata/zanata-server","homepage":"http://zanata.org","size":218006,"stargazers_count":51,"watchers_count":51,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":20,"mirror_url":null,"open_issues_count":15,"forks":20,"open_issues":15,"watchers":51,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zanata/zanata-server/pulls/478"},"html":{"href":"https://github.com/zanata/zanata-server/pull/478"},"issue":{"href":"https://api.github.com/repos/zanata/zanata-server/issues/478"},"comments":{"href":"https://api.github.com/repos/zanata/zanata-server/issues/478/comments"},"review_comments":{"href":"https://api.github.com/repos/zanata/zanata-server/pulls/478/comments"},"review_comment":{"href":"https://api.github.com/repos/zanata/zanata-server/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/zanata/zanata-server/pulls/478/commits"},"statuses":{"href":"https://api.github.com/repos/zanata/zanata-server/statuses/cc282bb02e2a19df3618594973f80077162818a0"}}}}