{"action":"opened","number":4314,"pull_request":{"url":"https://api.github.com/repos/google/ggrc-core/pulls/4314","id":82692467,"html_url":"https://github.com/google/ggrc-core/pull/4314","diff_url":"https://github.com/google/ggrc-core/pull/4314.diff","patch_url":"https://github.com/google/ggrc-core/pull/4314.patch","issue_url":"https://api.github.com/repos/google/ggrc-core/issues/4314","number":4314,"state":"open","locked":false,"title":"QUICK-FIX Unmap people via import","user":{"login":"kr41","id":961059,"avatar_url":"https://avatars.githubusercontent.com/u/961059?v=3","gravatar_id":"","url":"https://api.github.com/users/kr41","html_url":"https://github.com/kr41","followers_url":"https://api.github.com/users/kr41/followers","following_url":"https://api.github.com/users/kr41/following{/other_user}","gists_url":"https://api.github.com/users/kr41/gists{/gist_id}","starred_url":"https://api.github.com/users/kr41/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kr41/subscriptions","organizations_url":"https://api.github.com/users/kr41/orgs","repos_url":"https://api.github.com/users/kr41/repos","events_url":"https://api.github.com/users/kr41/events{/privacy}","received_events_url":"https://api.github.com/users/kr41/received_events","type":"User","site_admin":false},"body":"### Steps to reproduce\r\n\r\n1. Create a program.\r\n2. Map a couple of people.\r\n3. Add them different permissions: Editor, Reader.\r\n4. Export the program.\r\n5. Edit CSV to unmap people via `unmap:person` column.\r\n6. Import CSV.\r\n7. Go to the program page on \"people\" tab—the people are still there.\r\n\r\n### What happens under the hood:\r\n\r\n1. When a person is mapped to a program, they doesn't have any role.\r\n2. When a role is given to the person, `UserRole` object is created within the program context.\r\n3. When the person is unmapped from the program using `unmap:person` column of CSV, the role is still there.\r\n\r\nThe fix is a bit hackish, because it uses `UserRole` model from `ggrc_basic_permissions`. But it is the only way I found to fix the issue, without massive refactoring. Since `ggrc_basic_permissions` is an optional extension, here I use `getattr(all_models, 'UserRole', None)` to get `UserRole` model.\r\n","created_at":"2016-08-25T10:11:59Z","updated_at":"2016-08-25T10:11:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/google/ggrc-core/pulls/4314/commits","review_comments_url":"https://api.github.com/repos/google/ggrc-core/pulls/4314/comments","review_comment_url":"https://api.github.com/repos/google/ggrc-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/google/ggrc-core/issues/4314/comments","statuses_url":"https://api.github.com/repos/google/ggrc-core/statuses/6aa6d4124c551f7cd225dc3321ae6667f9a6acee","head":{"label":"kr41:quickfix-unmap-people-via-import","ref":"quickfix-unmap-people-via-import","sha":"6aa6d4124c551f7cd225dc3321ae6667f9a6acee","user":{"login":"kr41","id":961059,"avatar_url":"https://avatars.githubusercontent.com/u/961059?v=3","gravatar_id":"","url":"https://api.github.com/users/kr41","html_url":"https://github.com/kr41","followers_url":"https://api.github.com/users/kr41/followers","following_url":"https://api.github.com/users/kr41/following{/other_user}","gists_url":"https://api.github.com/users/kr41/gists{/gist_id}","starred_url":"https://api.github.com/users/kr41/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kr41/subscriptions","organizations_url":"https://api.github.com/users/kr41/orgs","repos_url":"https://api.github.com/users/kr41/repos","events_url":"https://api.github.com/users/kr41/events{/privacy}","received_events_url":"https://api.github.com/users/kr41/received_events","type":"User","site_admin":false},"repo":{"id":63245784,"name":"ggrc-core","full_name":"kr41/ggrc-core","owner":{"login":"kr41","id":961059,"avatar_url":"https://avatars.githubusercontent.com/u/961059?v=3","gravatar_id":"","url":"https://api.github.com/users/kr41","html_url":"https://github.com/kr41","followers_url":"https://api.github.com/users/kr41/followers","following_url":"https://api.github.com/users/kr41/following{/other_user}","gists_url":"https://api.github.com/users/kr41/gists{/gist_id}","starred_url":"https://api.github.com/users/kr41/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kr41/subscriptions","organizations_url":"https://api.github.com/users/kr41/orgs","repos_url":"https://api.github.com/users/kr41/repos","events_url":"https://api.github.com/users/kr41/events{/privacy}","received_events_url":"https://api.github.com/users/kr41/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kr41/ggrc-core","description":"GGRC Core","fork":true,"url":"https://api.github.com/repos/kr41/ggrc-core","forks_url":"https://api.github.com/repos/kr41/ggrc-core/forks","keys_url":"https://api.github.com/repos/kr41/ggrc-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kr41/ggrc-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kr41/ggrc-core/teams","hooks_url":"https://api.github.com/repos/kr41/ggrc-core/hooks","issue_events_url":"https://api.github.com/repos/kr41/ggrc-core/issues/events{/number}","events_url":"https://api.github.com/repos/kr41/ggrc-core/events","assignees_url":"https://api.github.com/repos/kr41/ggrc-core/assignees{/user}","branches_url":"https://api.github.com/repos/kr41/ggrc-core/branches{/branch}","tags_url":"https://api.github.com/repos/kr41/ggrc-core/tags","blobs_url":"https://api.github.com/repos/kr41/ggrc-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kr41/ggrc-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kr41/ggrc-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/kr41/ggrc-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kr41/ggrc-core/statuses/{sha}","languages_url":"https://api.github.com/repos/kr41/ggrc-core/languages","stargazers_url":"https://api.github.com/repos/kr41/ggrc-core/stargazers","contributors_url":"https://api.github.com/repos/kr41/ggrc-core/contributors","subscribers_url":"https://api.github.com/repos/kr41/ggrc-core/subscribers","subscription_url":"https://api.github.com/repos/kr41/ggrc-core/subscription","commits_url":"https://api.github.com/repos/kr41/ggrc-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/kr41/ggrc-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/kr41/ggrc-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/kr41/ggrc-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/kr41/ggrc-core/contents/{+path}","compare_url":"https://api.github.com/repos/kr41/ggrc-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kr41/ggrc-core/merges","archive_url":"https://api.github.com/repos/kr41/ggrc-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kr41/ggrc-core/downloads","issues_url":"https://api.github.com/repos/kr41/ggrc-core/issues{/number}","pulls_url":"https://api.github.com/repos/kr41/ggrc-core/pulls{/number}","milestones_url":"https://api.github.com/repos/kr41/ggrc-core/milestones{/number}","notifications_url":"https://api.github.com/repos/kr41/ggrc-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kr41/ggrc-core/labels{/name}","releases_url":"https://api.github.com/repos/kr41/ggrc-core/releases{/id}","deployments_url":"https://api.github.com/repos/kr41/ggrc-core/deployments","created_at":"2016-07-13T12:55:09Z","updated_at":"2016-07-13T12:55:15Z","pushed_at":"2016-08-25T09:58:21Z","git_url":"git://github.com/kr41/ggrc-core.git","ssh_url":"git@github.com:kr41/ggrc-core.git","clone_url":"https://github.com/kr41/ggrc-core.git","svn_url":"https://github.com/kr41/ggrc-core","homepage":null,"size":53874,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"develop"}},"base":{"label":"google:develop","ref":"develop","sha":"60507c7ac3d8cdb39d7235a6a549bdb8cc9e39f0","user":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"repo":{"id":9304637,"name":"ggrc-core","full_name":"google/ggrc-core","owner":{"login":"google","id":1342004,"avatar_url":"https://avatars.githubusercontent.com/u/1342004?v=3","gravatar_id":"","url":"https://api.github.com/users/google","html_url":"https://github.com/google","followers_url":"https://api.github.com/users/google/followers","following_url":"https://api.github.com/users/google/following{/other_user}","gists_url":"https://api.github.com/users/google/gists{/gist_id}","starred_url":"https://api.github.com/users/google/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/google/subscriptions","organizations_url":"https://api.github.com/users/google/orgs","repos_url":"https://api.github.com/users/google/repos","events_url":"https://api.github.com/users/google/events{/privacy}","received_events_url":"https://api.github.com/users/google/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/google/ggrc-core","description":"GGRC Core","fork":false,"url":"https://api.github.com/repos/google/ggrc-core","forks_url":"https://api.github.com/repos/google/ggrc-core/forks","keys_url":"https://api.github.com/repos/google/ggrc-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/google/ggrc-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/google/ggrc-core/teams","hooks_url":"https://api.github.com/repos/google/ggrc-core/hooks","issue_events_url":"https://api.github.com/repos/google/ggrc-core/issues/events{/number}","events_url":"https://api.github.com/repos/google/ggrc-core/events","assignees_url":"https://api.github.com/repos/google/ggrc-core/assignees{/user}","branches_url":"https://api.github.com/repos/google/ggrc-core/branches{/branch}","tags_url":"https://api.github.com/repos/google/ggrc-core/tags","blobs_url":"https://api.github.com/repos/google/ggrc-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/google/ggrc-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/google/ggrc-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/google/ggrc-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/google/ggrc-core/statuses/{sha}","languages_url":"https://api.github.com/repos/google/ggrc-core/languages","stargazers_url":"https://api.github.com/repos/google/ggrc-core/stargazers","contributors_url":"https://api.github.com/repos/google/ggrc-core/contributors","subscribers_url":"https://api.github.com/repos/google/ggrc-core/subscribers","subscription_url":"https://api.github.com/repos/google/ggrc-core/subscription","commits_url":"https://api.github.com/repos/google/ggrc-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/google/ggrc-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/google/ggrc-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/google/ggrc-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/google/ggrc-core/contents/{+path}","compare_url":"https://api.github.com/repos/google/ggrc-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/google/ggrc-core/merges","archive_url":"https://api.github.com/repos/google/ggrc-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/google/ggrc-core/downloads","issues_url":"https://api.github.com/repos/google/ggrc-core/issues{/number}","pulls_url":"https://api.github.com/repos/google/ggrc-core/pulls{/number}","milestones_url":"https://api.github.com/repos/google/ggrc-core/milestones{/number}","notifications_url":"https://api.github.com/repos/google/ggrc-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/google/ggrc-core/labels{/name}","releases_url":"https://api.github.com/repos/google/ggrc-core/releases{/id}","deployments_url":"https://api.github.com/repos/google/ggrc-core/deployments","created_at":"2013-04-08T19:16:28Z","updated_at":"2016-08-24T16:12:01Z","pushed_at":"2016-08-25T10:10:51Z","git_url":"git://github.com/google/ggrc-core.git","ssh_url":"git@github.com:google/ggrc-core.git","clone_url":"https://github.com/google/ggrc-core.git","svn_url":"https://github.com/google/ggrc-core","homepage":null,"size":64818,"stargazers_count":124,"watchers_count":124,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":18,"forks":94,"open_issues":18,"watchers":124,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/4314"},"html":{"href":"https://github.com/google/ggrc-core/pull/4314"},"issue":{"href":"https://api.github.com/repos/google/ggrc-core/issues/4314"},"comments":{"href":"https://api.github.com/repos/google/ggrc-core/issues/4314/comments"},"review_comments":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/4314/comments"},"review_comment":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/google/ggrc-core/pulls/4314/commits"},"statuses":{"href":"https://api.github.com/repos/google/ggrc-core/statuses/6aa6d4124c551f7cd225dc3321ae6667f9a6acee"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":7,"deletions":2,"changed_files":1}}
{"actor":{"display_login":"kr41"}}