{"action":"opened","number":9,"pull_request":{"url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/9","id":50393531,"html_url":"https://github.com/droolsjbpm/kie-uberfire-extensions/pull/9","diff_url":"https://github.com/droolsjbpm/kie-uberfire-extensions/pull/9.diff","patch_url":"https://github.com/droolsjbpm/kie-uberfire-extensions/pull/9.patch","issue_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/issues/9","number":9,"state":"open","locked":false,"title":"Timeline feature does not respect security constraint set by \"add-group-repo\" kie-cli command\"","user":{"login":"ederign","id":531351,"avatar_url":"https://avatars.githubusercontent.com/u/531351?v=3","gravatar_id":"","url":"https://api.github.com/users/ederign","html_url":"https://github.com/ederign","followers_url":"https://api.github.com/users/ederign/followers","following_url":"https://api.github.com/users/ederign/following{/other_user}","gists_url":"https://api.github.com/users/ederign/gists{/gist_id}","starred_url":"https://api.github.com/users/ederign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ederign/subscriptions","organizations_url":"https://api.github.com/users/ederign/orgs","repos_url":"https://api.github.com/users/ederign/repos","events_url":"https://api.github.com/users/ederign/events{/privacy}","received_events_url":"https://api.github.com/users/ederign/received_events","type":"User","site_admin":false},"body":"Problem\r\n------------\r\nkie-config-cli can restrict access to the git repository/organization unit only for user with specific group. \r\n\r\nHowever, when a user - not a member of this group - displays the Home -> Timeline feature - he is still able to open & edit & save assets which are located in a protected git repository.\r\n\r\nSolution\r\n------------\r\nIn order to address this issue, I've to create a new plugabble security mechanism on kie-uberfire-extensions.\r\nThat mechanism includes a [SocialSecurityConstraintsManager](https://github.com/ederign/kie-uberfire-extensions/blob/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c/kie-uberfire-social-activities/kie-uberfire-social-activities-backend/src/main/java/org/kie/uberfire/social/activities/security/SocialSecurityConstraintsManager.java)  that look for cdi implementations of [SocialSecurityConstraint](https://github.com/ederign/kie-uberfire-extensions/blob/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c/kie-uberfire-social-activities/kie-uberfire-social-activities-api/src/main/java/org/kie/uberfire/social/activities/service/SocialSecurityConstraint.java) and apply this constraints to a list of social events.\r\n\r\n[SocialSecurityConstraint](https://github.com/ederign/kie-uberfire-extensions/blob/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c/kie-uberfire-social-activities/kie-uberfire-social-activities-api/src/main/java/org/kie/uberfire/social/activities/service/SocialSecurityConstraint.java)  has two methods, hasRestrictions that see if there is some restrictions for a given event, and init methods that is called before hasRestrictions in order to build some cache (if necessary).\r\n\r\nEach [SocialTimelineCachePersistence](https://github.com/ederign/kie-uberfire-extensions/blob/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c/kie-uberfire-social-activities/kie-uberfire-social-activities-backend/src/main/java/org/kie/uberfire/social/activities/persistence/SocialTimelineCachePersistence.java) that returns a timeline instead of returning events are now calling applySocialSecurityConstraints method that delegates to [SocialSecurityConstraintsManager](https://github.com/ederign/kie-uberfire-extensions/blob/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c/kie-uberfire-social-activities/kie-uberfire-social-activities-backend/src/main/java/org/kie/uberfire/social/activities/security/SocialSecurityConstraintsManager.java).\r\n\r\n\r\nThe implementation of [SocialSecurityConstraint](https://github.com/ederign/kie-uberfire-extensions/blob/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c/kie-uberfire-social-activities/kie-uberfire-social-activities-api/src/main/java/org/kie/uberfire/social/activities/service/SocialSecurityConstraint.java)  are located on kie-wb-common home page:\r\n\r\n- [SocialEventOUConstraint](https://github.com/ederign/kie-wb-common/blob/8f071c1b9da2e42138456c02fad11b748be7d313/kie-wb-common-screens/kie-wb-common-social-home-page/kie-wb-common-social-home-page-backend/src/main/java/org/kie/workbench/common/screens/social/hp/security/SocialEventOUConstraint.java) that secures a event againts OU restrictions;\r\n- [SocialEventRepositoryConstraint](https://github.com/ederign/kie-wb-common/blob/8f071c1b9da2e42138456c02fad11b748be7d313/kie-wb-common-screens/kie-wb-common-social-home-page/kie-wb-common-social-home-page-backend/src/main/java/org/kie/workbench/common/screens/social/hp/security/SocialEventRepositoryConstraint.java) that secures a project/asset event agains repositories permissions.\r\n\r\n\r\nI also found and fix another feature leak issue related to link creations on Social Timelines. If a user has a permission to create a asset sometime, had created a asset and then lost the authoring permission, the links are still created and our user can assets AuthoringPerspective via social link. That was fixed in [DefaultSocialLinkCommandGenerator](https://github.com/ederign/kie-wb-common/blob/8f071c1b9da2e42138456c02fad11b748be7d313/kie-wb-common-screens/kie-wb-common-social-home-page/kie-wb-common-social-home-page-client/src/main/java/org/kie/workbench/common/screens/social/hp/client/homepage/DefaultSocialLinkCommandGenerator.java).\r\n","created_at":"2015-11-11T15:10:45Z","updated_at":"2015-11-11T15:10:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/9/commits","review_comments_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/9/comments","review_comment_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/issues/9/comments","statuses_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/statuses/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c","head":{"label":"ederign:social-security-constraints","ref":"social-security-constraints","sha":"ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c","user":{"login":"ederign","id":531351,"avatar_url":"https://avatars.githubusercontent.com/u/531351?v=3","gravatar_id":"","url":"https://api.github.com/users/ederign","html_url":"https://github.com/ederign","followers_url":"https://api.github.com/users/ederign/followers","following_url":"https://api.github.com/users/ederign/following{/other_user}","gists_url":"https://api.github.com/users/ederign/gists{/gist_id}","starred_url":"https://api.github.com/users/ederign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ederign/subscriptions","organizations_url":"https://api.github.com/users/ederign/orgs","repos_url":"https://api.github.com/users/ederign/repos","events_url":"https://api.github.com/users/ederign/events{/privacy}","received_events_url":"https://api.github.com/users/ederign/received_events","type":"User","site_admin":false},"repo":{"id":33995916,"name":"kie-uberfire-extensions","full_name":"ederign/kie-uberfire-extensions","owner":{"login":"ederign","id":531351,"avatar_url":"https://avatars.githubusercontent.com/u/531351?v=3","gravatar_id":"","url":"https://api.github.com/users/ederign","html_url":"https://github.com/ederign","followers_url":"https://api.github.com/users/ederign/followers","following_url":"https://api.github.com/users/ederign/following{/other_user}","gists_url":"https://api.github.com/users/ederign/gists{/gist_id}","starred_url":"https://api.github.com/users/ederign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ederign/subscriptions","organizations_url":"https://api.github.com/users/ederign/orgs","repos_url":"https://api.github.com/users/ederign/repos","events_url":"https://api.github.com/users/ederign/events{/privacy}","received_events_url":"https://api.github.com/users/ederign/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ederign/kie-uberfire-extensions","description":"KIE extensions to UberFire framework","fork":true,"url":"https://api.github.com/repos/ederign/kie-uberfire-extensions","forks_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/forks","keys_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/teams","hooks_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/hooks","issue_events_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/events","assignees_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/tags","blobs_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/languages","stargazers_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/stargazers","contributors_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/contributors","subscribers_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/subscribers","subscription_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/subscription","commits_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/merges","archive_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/downloads","issues_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/labels{/name}","releases_url":"https://api.github.com/repos/ederign/kie-uberfire-extensions/releases{/id}","created_at":"2015-04-15T13:37:49Z","updated_at":"2015-04-15T13:37:50Z","pushed_at":"2015-11-11T14:56:18Z","git_url":"git://github.com/ederign/kie-uberfire-extensions.git","ssh_url":"git@github.com:ederign/kie-uberfire-extensions.git","clone_url":"https://github.com/ederign/kie-uberfire-extensions.git","svn_url":"https://github.com/ederign/kie-uberfire-extensions","homepage":null,"size":2783,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"droolsjbpm:master","ref":"master","sha":"8d24f1f2b30b58454e1687901c477c1810b54ff4","user":{"login":"droolsjbpm","id":517980,"avatar_url":"https://avatars.githubusercontent.com/u/517980?v=3","gravatar_id":"","url":"https://api.github.com/users/droolsjbpm","html_url":"https://github.com/droolsjbpm","followers_url":"https://api.github.com/users/droolsjbpm/followers","following_url":"https://api.github.com/users/droolsjbpm/following{/other_user}","gists_url":"https://api.github.com/users/droolsjbpm/gists{/gist_id}","starred_url":"https://api.github.com/users/droolsjbpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droolsjbpm/subscriptions","organizations_url":"https://api.github.com/users/droolsjbpm/orgs","repos_url":"https://api.github.com/users/droolsjbpm/repos","events_url":"https://api.github.com/users/droolsjbpm/events{/privacy}","received_events_url":"https://api.github.com/users/droolsjbpm/received_events","type":"Organization","site_admin":false},"repo":{"id":21173718,"name":"kie-uberfire-extensions","full_name":"droolsjbpm/kie-uberfire-extensions","owner":{"login":"droolsjbpm","id":517980,"avatar_url":"https://avatars.githubusercontent.com/u/517980?v=3","gravatar_id":"","url":"https://api.github.com/users/droolsjbpm","html_url":"https://github.com/droolsjbpm","followers_url":"https://api.github.com/users/droolsjbpm/followers","following_url":"https://api.github.com/users/droolsjbpm/following{/other_user}","gists_url":"https://api.github.com/users/droolsjbpm/gists{/gist_id}","starred_url":"https://api.github.com/users/droolsjbpm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droolsjbpm/subscriptions","organizations_url":"https://api.github.com/users/droolsjbpm/orgs","repos_url":"https://api.github.com/users/droolsjbpm/repos","events_url":"https://api.github.com/users/droolsjbpm/events{/privacy}","received_events_url":"https://api.github.com/users/droolsjbpm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/droolsjbpm/kie-uberfire-extensions","description":"KIE extensions to UberFire framework","fork":false,"url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions","forks_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/forks","keys_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/teams","hooks_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/hooks","issue_events_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/events","assignees_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/tags","blobs_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/languages","stargazers_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/stargazers","contributors_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/contributors","subscribers_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/subscribers","subscription_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/subscription","commits_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/merges","archive_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/downloads","issues_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/labels{/name}","releases_url":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/releases{/id}","created_at":"2014-06-24T17:11:35Z","updated_at":"2015-08-07T17:15:51Z","pushed_at":"2015-11-11T15:10:45Z","git_url":"git://github.com/droolsjbpm/kie-uberfire-extensions.git","ssh_url":"git@github.com:droolsjbpm/kie-uberfire-extensions.git","clone_url":"https://github.com/droolsjbpm/kie-uberfire-extensions.git","svn_url":"https://github.com/droolsjbpm/kie-uberfire-extensions","homepage":null,"size":4053,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":2,"forks":28,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/9"},"html":{"href":"https://github.com/droolsjbpm/kie-uberfire-extensions/pull/9"},"issue":{"href":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/issues/9"},"comments":{"href":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/droolsjbpm/kie-uberfire-extensions/statuses/ceb4e3a49f90c9f56e8c7818d43d85cc1bccb97c"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":366,"deletions":60,"changed_files":11}}