{"action":"closed","number":506,"pull_request":{"url":"https://api.github.com/repos/nearform/udaru/pulls/506","id":178390360,"html_url":"https://github.com/nearform/udaru/pull/506","diff_url":"https://github.com/nearform/udaru/pull/506.diff","patch_url":"https://github.com/nearform/udaru/pull/506.patch","issue_url":"https://api.github.com/repos/nearform/udaru/issues/506","number":506,"state":"closed","locked":false,"title":"policy instance add, remove, delete & tests","user":{"login":"cianfoley-nearform","id":36038467,"avatar_url":"https://avatars1.githubusercontent.com/u/36038467?v=4","gravatar_id":"","url":"https://api.github.com/users/cianfoley-nearform","html_url":"https://github.com/cianfoley-nearform","followers_url":"https://api.github.com/users/cianfoley-nearform/followers","following_url":"https://api.github.com/users/cianfoley-nearform/following{/other_user}","gists_url":"https://api.github.com/users/cianfoley-nearform/gists{/gist_id}","starred_url":"https://api.github.com/users/cianfoley-nearform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cianfoley-nearform/subscriptions","organizations_url":"https://api.github.com/users/cianfoley-nearform/orgs","repos_url":"https://api.github.com/users/cianfoley-nearform/repos","events_url":"https://api.github.com/users/cianfoley-nearform/events{/privacy}","received_events_url":"https://api.github.com/users/cianfoley-nearform/received_events","type":"User","site_admin":false},"body":"@dberesford @mihaidma @ShogunPanda \r\n\r\nPRing this for your review...  \r\n\r\nBasically this solves the delete policy issue by creating an autoincrement column on each of the entity_policy relationship tables, which can be used as a parameter on the delete endpoints to delete a specific policy instance.  The existing functionality does not change i.e. calling delete without the parameter deletes all policy instances with that ID.\r\n\r\nPoints to note:\r\n- Migrate script to create autoincrement column\r\n- Instance number coming back from anywhere policy references are present in user teams and orgs\r\n- Affects policy deletion endpoints on each entity\r\n- Tests were affected so I've put in code to ignore instance property for most in udaru-test utility\r\n- Swagger/JOI validation updated to faciliate instance returned, and optional instance param on delete\r\n\r\nFuture work should include the ability to edit policies based on this instance ID, currently we have put and post where we pass a payload of policy ids/ instances with variables. post does a full replace, put will only add if it doesn't previously exist... post is considered a fresh wipe and repopulation but put could be considered an edit, in which case suggest the id goes into the payload and if present it could overwrite...\r\n\r\n","created_at":"2018-03-29T17:18:50Z","updated_at":"2018-03-30T14:04:32Z","closed_at":"2018-03-30T14:04:32Z","merged_at":"2018-03-30T14:04:32Z","merge_commit_sha":"475b82a940c5f567cb22fb18498b24224a52e79d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nearform/udaru/pulls/506/commits","review_comments_url":"https://api.github.com/repos/nearform/udaru/pulls/506/comments","review_comment_url":"https://api.github.com/repos/nearform/udaru/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nearform/udaru/issues/506/comments","statuses_url":"https://api.github.com/repos/nearform/udaru/statuses/9fb2e2e0dfc81edf64fc149ca1e89e30112bb0cd","head":{"label":"nearform:policy-instance-deletion-etc","ref":"policy-instance-deletion-etc","sha":"9fb2e2e0dfc81edf64fc149ca1e89e30112bb0cd","user":{"login":"nearform","id":1544687,"avatar_url":"https://avatars2.githubusercontent.com/u/1544687?v=4","gravatar_id":"","url":"https://api.github.com/users/nearform","html_url":"https://github.com/nearform","followers_url":"https://api.github.com/users/nearform/followers","following_url":"https://api.github.com/users/nearform/following{/other_user}","gists_url":"https://api.github.com/users/nearform/gists{/gist_id}","starred_url":"https://api.github.com/users/nearform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nearform/subscriptions","organizations_url":"https://api.github.com/users/nearform/orgs","repos_url":"https://api.github.com/users/nearform/repos","events_url":"https://api.github.com/users/nearform/events{/privacy}","received_events_url":"https://api.github.com/users/nearform/received_events","type":"Organization","site_admin":false},"repo":{"id":70055917,"name":"udaru","full_name":"nearform/udaru","owner":{"login":"nearform","id":1544687,"avatar_url":"https://avatars2.githubusercontent.com/u/1544687?v=4","gravatar_id":"","url":"https://api.github.com/users/nearform","html_url":"https://github.com/nearform","followers_url":"https://api.github.com/users/nearform/followers","following_url":"https://api.github.com/users/nearform/following{/other_user}","gists_url":"https://api.github.com/users/nearform/gists{/gist_id}","starred_url":"https://api.github.com/users/nearform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nearform/subscriptions","organizations_url":"https://api.github.com/users/nearform/orgs","repos_url":"https://api.github.com/users/nearform/repos","events_url":"https://api.github.com/users/nearform/events{/privacy}","received_events_url":"https://api.github.com/users/nearform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nearform/udaru","description":"A policy based authorization module that can be used to add permissions to 'actions' and 'resources'","fork":false,"url":"https://api.github.com/repos/nearform/udaru","forks_url":"https://api.github.com/repos/nearform/udaru/forks","keys_url":"https://api.github.com/repos/nearform/udaru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nearform/udaru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nearform/udaru/teams","hooks_url":"https://api.github.com/repos/nearform/udaru/hooks","issue_events_url":"https://api.github.com/repos/nearform/udaru/issues/events{/number}","events_url":"https://api.github.com/repos/nearform/udaru/events","assignees_url":"https://api.github.com/repos/nearform/udaru/assignees{/user}","branches_url":"https://api.github.com/repos/nearform/udaru/branches{/branch}","tags_url":"https://api.github.com/repos/nearform/udaru/tags","blobs_url":"https://api.github.com/repos/nearform/udaru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nearform/udaru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nearform/udaru/git/refs{/sha}","trees_url":"https://api.github.com/repos/nearform/udaru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nearform/udaru/statuses/{sha}","languages_url":"https://api.github.com/repos/nearform/udaru/languages","stargazers_url":"https://api.github.com/repos/nearform/udaru/stargazers","contributors_url":"https://api.github.com/repos/nearform/udaru/contributors","subscribers_url":"https://api.github.com/repos/nearform/udaru/subscribers","subscription_url":"https://api.github.com/repos/nearform/udaru/subscription","commits_url":"https://api.github.com/repos/nearform/udaru/commits{/sha}","git_commits_url":"https://api.github.com/repos/nearform/udaru/git/commits{/sha}","comments_url":"https://api.github.com/repos/nearform/udaru/comments{/number}","issue_comment_url":"https://api.github.com/repos/nearform/udaru/issues/comments{/number}","contents_url":"https://api.github.com/repos/nearform/udaru/contents/{+path}","compare_url":"https://api.github.com/repos/nearform/udaru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nearform/udaru/merges","archive_url":"https://api.github.com/repos/nearform/udaru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nearform/udaru/downloads","issues_url":"https://api.github.com/repos/nearform/udaru/issues{/number}","pulls_url":"https://api.github.com/repos/nearform/udaru/pulls{/number}","milestones_url":"https://api.github.com/repos/nearform/udaru/milestones{/number}","notifications_url":"https://api.github.com/repos/nearform/udaru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nearform/udaru/labels{/name}","releases_url":"https://api.github.com/repos/nearform/udaru/releases{/id}","deployments_url":"https://api.github.com/repos/nearform/udaru/deployments","created_at":"2016-10-05T11:55:56Z","updated_at":"2018-03-30T09:30:22Z","pushed_at":"2018-03-30T14:04:32Z","git_url":"git://github.com/nearform/udaru.git","ssh_url":"git@github.com:nearform/udaru.git","clone_url":"https://github.com/nearform/udaru.git","svn_url":"https://github.com/nearform/udaru","homepage":"","size":11190,"stargazers_count":55,"watchers_count":55,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":57,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3,"open_issues":57,"watchers":55,"default_branch":"master"}},"base":{"label":"nearform:master","ref":"master","sha":"f0750227f84a69d775fa7d89eed69ccf0010365f","user":{"login":"nearform","id":1544687,"avatar_url":"https://avatars2.githubusercontent.com/u/1544687?v=4","gravatar_id":"","url":"https://api.github.com/users/nearform","html_url":"https://github.com/nearform","followers_url":"https://api.github.com/users/nearform/followers","following_url":"https://api.github.com/users/nearform/following{/other_user}","gists_url":"https://api.github.com/users/nearform/gists{/gist_id}","starred_url":"https://api.github.com/users/nearform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nearform/subscriptions","organizations_url":"https://api.github.com/users/nearform/orgs","repos_url":"https://api.github.com/users/nearform/repos","events_url":"https://api.github.com/users/nearform/events{/privacy}","received_events_url":"https://api.github.com/users/nearform/received_events","type":"Organization","site_admin":false},"repo":{"id":70055917,"name":"udaru","full_name":"nearform/udaru","owner":{"login":"nearform","id":1544687,"avatar_url":"https://avatars2.githubusercontent.com/u/1544687?v=4","gravatar_id":"","url":"https://api.github.com/users/nearform","html_url":"https://github.com/nearform","followers_url":"https://api.github.com/users/nearform/followers","following_url":"https://api.github.com/users/nearform/following{/other_user}","gists_url":"https://api.github.com/users/nearform/gists{/gist_id}","starred_url":"https://api.github.com/users/nearform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nearform/subscriptions","organizations_url":"https://api.github.com/users/nearform/orgs","repos_url":"https://api.github.com/users/nearform/repos","events_url":"https://api.github.com/users/nearform/events{/privacy}","received_events_url":"https://api.github.com/users/nearform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nearform/udaru","description":"A policy based authorization module that can be used to add permissions to 'actions' and 'resources'","fork":false,"url":"https://api.github.com/repos/nearform/udaru","forks_url":"https://api.github.com/repos/nearform/udaru/forks","keys_url":"https://api.github.com/repos/nearform/udaru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nearform/udaru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nearform/udaru/teams","hooks_url":"https://api.github.com/repos/nearform/udaru/hooks","issue_events_url":"https://api.github.com/repos/nearform/udaru/issues/events{/number}","events_url":"https://api.github.com/repos/nearform/udaru/events","assignees_url":"https://api.github.com/repos/nearform/udaru/assignees{/user}","branches_url":"https://api.github.com/repos/nearform/udaru/branches{/branch}","tags_url":"https://api.github.com/repos/nearform/udaru/tags","blobs_url":"https://api.github.com/repos/nearform/udaru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nearform/udaru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nearform/udaru/git/refs{/sha}","trees_url":"https://api.github.com/repos/nearform/udaru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nearform/udaru/statuses/{sha}","languages_url":"https://api.github.com/repos/nearform/udaru/languages","stargazers_url":"https://api.github.com/repos/nearform/udaru/stargazers","contributors_url":"https://api.github.com/repos/nearform/udaru/contributors","subscribers_url":"https://api.github.com/repos/nearform/udaru/subscribers","subscription_url":"https://api.github.com/repos/nearform/udaru/subscription","commits_url":"https://api.github.com/repos/nearform/udaru/commits{/sha}","git_commits_url":"https://api.github.com/repos/nearform/udaru/git/commits{/sha}","comments_url":"https://api.github.com/repos/nearform/udaru/comments{/number}","issue_comment_url":"https://api.github.com/repos/nearform/udaru/issues/comments{/number}","contents_url":"https://api.github.com/repos/nearform/udaru/contents/{+path}","compare_url":"https://api.github.com/repos/nearform/udaru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nearform/udaru/merges","archive_url":"https://api.github.com/repos/nearform/udaru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nearform/udaru/downloads","issues_url":"https://api.github.com/repos/nearform/udaru/issues{/number}","pulls_url":"https://api.github.com/repos/nearform/udaru/pulls{/number}","milestones_url":"https://api.github.com/repos/nearform/udaru/milestones{/number}","notifications_url":"https://api.github.com/repos/nearform/udaru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nearform/udaru/labels{/name}","releases_url":"https://api.github.com/repos/nearform/udaru/releases{/id}","deployments_url":"https://api.github.com/repos/nearform/udaru/deployments","created_at":"2016-10-05T11:55:56Z","updated_at":"2018-03-30T09:30:22Z","pushed_at":"2018-03-30T14:04:32Z","git_url":"git://github.com/nearform/udaru.git","ssh_url":"git@github.com:nearform/udaru.git","clone_url":"https://github.com/nearform/udaru.git","svn_url":"https://github.com/nearform/udaru","homepage":"","size":11190,"stargazers_count":55,"watchers_count":55,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":57,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":3,"open_issues":57,"watchers":55,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nearform/udaru/pulls/506"},"html":{"href":"https://github.com/nearform/udaru/pull/506"},"issue":{"href":"https://api.github.com/repos/nearform/udaru/issues/506"},"comments":{"href":"https://api.github.com/repos/nearform/udaru/issues/506/comments"},"review_comments":{"href":"https://api.github.com/repos/nearform/udaru/pulls/506/comments"},"review_comment":{"href":"https://api.github.com/repos/nearform/udaru/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nearform/udaru/pulls/506/commits"},"statuses":{"href":"https://api.github.com/repos/nearform/udaru/statuses/9fb2e2e0dfc81edf64fc149ca1e89e30112bb0cd"}},"author_association":"CONTRIBUTOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"dberesford","id":602445,"avatar_url":"https://avatars0.githubusercontent.com/u/602445?v=4","gravatar_id":"","url":"https://api.github.com/users/dberesford","html_url":"https://github.com/dberesford","followers_url":"https://api.github.com/users/dberesford/followers","following_url":"https://api.github.com/users/dberesford/following{/other_user}","gists_url":"https://api.github.com/users/dberesford/gists{/gist_id}","starred_url":"https://api.github.com/users/dberesford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dberesford/subscriptions","organizations_url":"https://api.github.com/users/dberesford/orgs","repos_url":"https://api.github.com/users/dberesford/repos","events_url":"https://api.github.com/users/dberesford/events{/privacy}","received_events_url":"https://api.github.com/users/dberesford/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"maintainer_can_modify":false,"commits":3,"additions":694,"deletions":100,"changed_files":28}}
{"actor":{"display_login":"dberesford"}}