{"action":"created","comment":{"url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/comments/29317259","id":29317259,"diff_hunk":"@@ -0,0 +1,85 @@\n+/*\n+ * Copyright (C) 2015 BonitaSoft S.A.\n+ * BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble\n+ * This library is free software; you can redistribute it and/or modify it under the terms\n+ * of the GNU Lesser General Public License as published by the Free Software Foundation\n+ * version 2.1 of the License.\n+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n+ * See the GNU Lesser General Public License for more details.\n+ * You should have received a copy of the GNU Lesser General Public License along with this\n+ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth\n+ * Floor, Boston, MA 02110-1301, USA.\n+ */\n+package org.bonitasoft.engine.page;\n+\n+import java.io.Serializable;\n+import java.util.Arrays;\n+import java.util.List;\n+import java.util.Map;\n+\n+import org.bonitasoft.engine.builder.BuilderFactory;\n+import org.bonitasoft.engine.commons.exceptions.SBonitaException;\n+import org.bonitasoft.engine.commons.exceptions.SExecutionException;\n+import org.bonitasoft.engine.core.process.instance.api.ActivityInstanceService;\n+import org.bonitasoft.engine.core.process.instance.model.archive.SAHumanTaskInstance;\n+import org.bonitasoft.engine.core.process.instance.model.archive.builder.SAUserTaskInstanceBuilderFactory;\n+import org.bonitasoft.engine.persistence.FilterOption;\n+import org.bonitasoft.engine.persistence.OrderByOption;\n+import org.bonitasoft.engine.persistence.OrderByType;\n+import org.bonitasoft.engine.persistence.QueryOptions;\n+\n+/**\n+ * author Emmanuel Duchastenier\n+ */\n+public class IsTaskPerformerRule extends AuthorizationRuleWithParameters implements AuthorizationRule {\n+\n+    private ActivityInstanceService activityInstanceService;\n+\n+    public IsTaskPerformerRule(ActivityInstanceService activityInstanceService) {\n+        this.activityInstanceService = activityInstanceService;\n+    }\n+\n+    @Override\n+    public boolean isAllowed(String key, Map<String, Serializable> context) throws SExecutionException {\n+        try {\n+            Long userId = getLongParameter(context, URLAdapterConstants.USER_QUERY_PARAM);\n+            Long processInstanceId = getLongParameter(context, URLAdapterConstants.ID_QUERY_PARAM);\n+            if (userId == null || processInstanceId == null) {\n+                throw new IllegalArgumentException(\n+                        \"Parameters 'userId' and 'processInstanceId' are mandatory to execute Page Authorization rule 'IsProcessInitiatorRule'\");\n+            }\n+\n+            QueryOptions archivedQueryOptions = buildArchivedTasksQueryOptions(processInstanceId);\n+            List<SAHumanTaskInstance> sArchivedHumanTasks = activityInstanceService.searchArchivedTasks(archivedQueryOptions);","path":"bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/page/IsTaskPerformerRule.java","position":54,"original_position":54,"commit_id":"d03014dcfe2f077f2c552cb35a200c8983b50876","original_commit_id":"d03014dcfe2f077f2c552cb35a200c8983b50876","user":{"login":"educhastenier","id":4921958,"avatar_url":"https://avatars.githubusercontent.com/u/4921958?v=3","gravatar_id":"","url":"https://api.github.com/users/educhastenier","html_url":"https://github.com/educhastenier","followers_url":"https://api.github.com/users/educhastenier/followers","following_url":"https://api.github.com/users/educhastenier/following{/other_user}","gists_url":"https://api.github.com/users/educhastenier/gists{/gist_id}","starred_url":"https://api.github.com/users/educhastenier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/educhastenier/subscriptions","organizations_url":"https://api.github.com/users/educhastenier/orgs","repos_url":"https://api.github.com/users/educhastenier/repos","events_url":"https://api.github.com/users/educhastenier/events{/privacy}","received_events_url":"https://api.github.com/users/educhastenier/received_events","type":"User","site_admin":false},"body":"I reused the logics from isInvolvedInProcessInstance from API","created_at":"2015-04-29T08:20:59Z","updated_at":"2015-04-29T08:20:59Z","html_url":"https://github.com/bonitasoft/bonita-engine/pull/33#discussion_r29317259","pull_request_url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/comments/29317259"},"html":{"href":"https://github.com/bonitasoft/bonita-engine/pull/33#discussion_r29317259"},"pull_request":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33","id":34283702,"html_url":"https://github.com/bonitasoft/bonita-engine/pull/33","diff_url":"https://github.com/bonitasoft/bonita-engine/pull/33.diff","patch_url":"https://github.com/bonitasoft/bonita-engine/pull/33.patch","issue_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/33","number":33,"state":"open","locked":false,"title":"Feat/bs 13115 authorization rules","user":{"login":"educhastenier","id":4921958,"avatar_url":"https://avatars.githubusercontent.com/u/4921958?v=3","gravatar_id":"","url":"https://api.github.com/users/educhastenier","html_url":"https://github.com/educhastenier","followers_url":"https://api.github.com/users/educhastenier/followers","following_url":"https://api.github.com/users/educhastenier/following{/other_user}","gists_url":"https://api.github.com/users/educhastenier/gists{/gist_id}","starred_url":"https://api.github.com/users/educhastenier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/educhastenier/subscriptions","organizations_url":"https://api.github.com/users/educhastenier/orgs","repos_url":"https://api.github.com/users/educhastenier/repos","events_url":"https://api.github.com/users/educhastenier/events{/privacy}","received_events_url":"https://api.github.com/users/educhastenier/received_events","type":"User","site_admin":false},"body":"Page / URL access authorization rule implementation","created_at":"2015-04-28T16:12:53Z","updated_at":"2015-04-29T08:20:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3b2c8d065c647c6620e4c26f53e8014ce63cf218","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33/commits","review_comments_url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33/comments","review_comment_url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/33/comments","statuses_url":"https://api.github.com/repos/bonitasoft/bonita-engine/statuses/d03014dcfe2f077f2c552cb35a200c8983b50876","head":{"label":"bonitasoft:feat/BS-13115_AuthorizationRules","ref":"feat/BS-13115_AuthorizationRules","sha":"d03014dcfe2f077f2c552cb35a200c8983b50876","user":{"login":"bonitasoft","id":4619712,"avatar_url":"https://avatars.githubusercontent.com/u/4619712?v=3","gravatar_id":"","url":"https://api.github.com/users/bonitasoft","html_url":"https://github.com/bonitasoft","followers_url":"https://api.github.com/users/bonitasoft/followers","following_url":"https://api.github.com/users/bonitasoft/following{/other_user}","gists_url":"https://api.github.com/users/bonitasoft/gists{/gist_id}","starred_url":"https://api.github.com/users/bonitasoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonitasoft/subscriptions","organizations_url":"https://api.github.com/users/bonitasoft/orgs","repos_url":"https://api.github.com/users/bonitasoft/repos","events_url":"https://api.github.com/users/bonitasoft/events{/privacy}","received_events_url":"https://api.github.com/users/bonitasoft/received_events","type":"Organization","site_admin":false},"repo":{"id":11125081,"name":"bonita-engine","full_name":"bonitasoft/bonita-engine","owner":{"login":"bonitasoft","id":4619712,"avatar_url":"https://avatars.githubusercontent.com/u/4619712?v=3","gravatar_id":"","url":"https://api.github.com/users/bonitasoft","html_url":"https://github.com/bonitasoft","followers_url":"https://api.github.com/users/bonitasoft/followers","following_url":"https://api.github.com/users/bonitasoft/following{/other_user}","gists_url":"https://api.github.com/users/bonitasoft/gists{/gist_id}","starred_url":"https://api.github.com/users/bonitasoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonitasoft/subscriptions","organizations_url":"https://api.github.com/users/bonitasoft/orgs","repos_url":"https://api.github.com/users/bonitasoft/repos","events_url":"https://api.github.com/users/bonitasoft/events{/privacy}","received_events_url":"https://api.github.com/users/bonitasoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bonitasoft/bonita-engine","description":"","fork":false,"url":"https://api.github.com/repos/bonitasoft/bonita-engine","forks_url":"https://api.github.com/repos/bonitasoft/bonita-engine/forks","keys_url":"https://api.github.com/repos/bonitasoft/bonita-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bonitasoft/bonita-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bonitasoft/bonita-engine/teams","hooks_url":"https://api.github.com/repos/bonitasoft/bonita-engine/hooks","issue_events_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/events{/number}","events_url":"https://api.github.com/repos/bonitasoft/bonita-engine/events","assignees_url":"https://api.github.com/repos/bonitasoft/bonita-engine/assignees{/user}","branches_url":"https://api.github.com/repos/bonitasoft/bonita-engine/branches{/branch}","tags_url":"https://api.github.com/repos/bonitasoft/bonita-engine/tags","blobs_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bonitasoft/bonita-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/bonitasoft/bonita-engine/languages","stargazers_url":"https://api.github.com/repos/bonitasoft/bonita-engine/stargazers","contributors_url":"https://api.github.com/repos/bonitasoft/bonita-engine/contributors","subscribers_url":"https://api.github.com/repos/bonitasoft/bonita-engine/subscribers","subscription_url":"https://api.github.com/repos/bonitasoft/bonita-engine/subscription","commits_url":"https://api.github.com/repos/bonitasoft/bonita-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/bonitasoft/bonita-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/bonitasoft/bonita-engine/contents/{+path}","compare_url":"https://api.github.com/repos/bonitasoft/bonita-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bonitasoft/bonita-engine/merges","archive_url":"https://api.github.com/repos/bonitasoft/bonita-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bonitasoft/bonita-engine/downloads","issues_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues{/number}","pulls_url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/bonitasoft/bonita-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/bonitasoft/bonita-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bonitasoft/bonita-engine/labels{/name}","releases_url":"https://api.github.com/repos/bonitasoft/bonita-engine/releases{/id}","created_at":"2013-07-02T13:06:27Z","updated_at":"2015-04-28T12:03:32Z","pushed_at":"2015-04-29T08:07:05Z","git_url":"git://github.com/bonitasoft/bonita-engine.git","ssh_url":"git@github.com:bonitasoft/bonita-engine.git","clone_url":"https://github.com/bonitasoft/bonita-engine.git","svn_url":"https://github.com/bonitasoft/bonita-engine","homepage":"","size":482808,"stargazers_count":30,"watchers_count":30,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":3,"forks":26,"open_issues":3,"watchers":30,"default_branch":"master"}},"base":{"label":"bonitasoft:CP_7.0_RC_sprint_1","ref":"CP_7.0_RC_sprint_1","sha":"cb3a7d783b632d72dc5293d54320468d0aac42fd","user":{"login":"bonitasoft","id":4619712,"avatar_url":"https://avatars.githubusercontent.com/u/4619712?v=3","gravatar_id":"","url":"https://api.github.com/users/bonitasoft","html_url":"https://github.com/bonitasoft","followers_url":"https://api.github.com/users/bonitasoft/followers","following_url":"https://api.github.com/users/bonitasoft/following{/other_user}","gists_url":"https://api.github.com/users/bonitasoft/gists{/gist_id}","starred_url":"https://api.github.com/users/bonitasoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonitasoft/subscriptions","organizations_url":"https://api.github.com/users/bonitasoft/orgs","repos_url":"https://api.github.com/users/bonitasoft/repos","events_url":"https://api.github.com/users/bonitasoft/events{/privacy}","received_events_url":"https://api.github.com/users/bonitasoft/received_events","type":"Organization","site_admin":false},"repo":{"id":11125081,"name":"bonita-engine","full_name":"bonitasoft/bonita-engine","owner":{"login":"bonitasoft","id":4619712,"avatar_url":"https://avatars.githubusercontent.com/u/4619712?v=3","gravatar_id":"","url":"https://api.github.com/users/bonitasoft","html_url":"https://github.com/bonitasoft","followers_url":"https://api.github.com/users/bonitasoft/followers","following_url":"https://api.github.com/users/bonitasoft/following{/other_user}","gists_url":"https://api.github.com/users/bonitasoft/gists{/gist_id}","starred_url":"https://api.github.com/users/bonitasoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bonitasoft/subscriptions","organizations_url":"https://api.github.com/users/bonitasoft/orgs","repos_url":"https://api.github.com/users/bonitasoft/repos","events_url":"https://api.github.com/users/bonitasoft/events{/privacy}","received_events_url":"https://api.github.com/users/bonitasoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bonitasoft/bonita-engine","description":"","fork":false,"url":"https://api.github.com/repos/bonitasoft/bonita-engine","forks_url":"https://api.github.com/repos/bonitasoft/bonita-engine/forks","keys_url":"https://api.github.com/repos/bonitasoft/bonita-engine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bonitasoft/bonita-engine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bonitasoft/bonita-engine/teams","hooks_url":"https://api.github.com/repos/bonitasoft/bonita-engine/hooks","issue_events_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/events{/number}","events_url":"https://api.github.com/repos/bonitasoft/bonita-engine/events","assignees_url":"https://api.github.com/repos/bonitasoft/bonita-engine/assignees{/user}","branches_url":"https://api.github.com/repos/bonitasoft/bonita-engine/branches{/branch}","tags_url":"https://api.github.com/repos/bonitasoft/bonita-engine/tags","blobs_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/refs{/sha}","trees_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bonitasoft/bonita-engine/statuses/{sha}","languages_url":"https://api.github.com/repos/bonitasoft/bonita-engine/languages","stargazers_url":"https://api.github.com/repos/bonitasoft/bonita-engine/stargazers","contributors_url":"https://api.github.com/repos/bonitasoft/bonita-engine/contributors","subscribers_url":"https://api.github.com/repos/bonitasoft/bonita-engine/subscribers","subscription_url":"https://api.github.com/repos/bonitasoft/bonita-engine/subscription","commits_url":"https://api.github.com/repos/bonitasoft/bonita-engine/commits{/sha}","git_commits_url":"https://api.github.com/repos/bonitasoft/bonita-engine/git/commits{/sha}","comments_url":"https://api.github.com/repos/bonitasoft/bonita-engine/comments{/number}","issue_comment_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/comments{/number}","contents_url":"https://api.github.com/repos/bonitasoft/bonita-engine/contents/{+path}","compare_url":"https://api.github.com/repos/bonitasoft/bonita-engine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bonitasoft/bonita-engine/merges","archive_url":"https://api.github.com/repos/bonitasoft/bonita-engine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bonitasoft/bonita-engine/downloads","issues_url":"https://api.github.com/repos/bonitasoft/bonita-engine/issues{/number}","pulls_url":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls{/number}","milestones_url":"https://api.github.com/repos/bonitasoft/bonita-engine/milestones{/number}","notifications_url":"https://api.github.com/repos/bonitasoft/bonita-engine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bonitasoft/bonita-engine/labels{/name}","releases_url":"https://api.github.com/repos/bonitasoft/bonita-engine/releases{/id}","created_at":"2013-07-02T13:06:27Z","updated_at":"2015-04-28T12:03:32Z","pushed_at":"2015-04-29T08:07:05Z","git_url":"git://github.com/bonitasoft/bonita-engine.git","ssh_url":"git@github.com:bonitasoft/bonita-engine.git","clone_url":"https://github.com/bonitasoft/bonita-engine.git","svn_url":"https://github.com/bonitasoft/bonita-engine","homepage":"","size":482808,"stargazers_count":30,"watchers_count":30,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":26,"mirror_url":null,"open_issues_count":3,"forks":26,"open_issues":3,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33"},"html":{"href":"https://github.com/bonitasoft/bonita-engine/pull/33"},"issue":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/33"},"comments":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/bonitasoft/bonita-engine/statuses/d03014dcfe2f077f2c552cb35a200c8983b50876"}}}}