{"action":"created","comment":{"url":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/comments/81169591","pull_request_review_id":2166277,"id":81169591,"diff_hunk":"@@ -43,12 +44,13 @@ class CreateBackupCommand : public Command {\n              << std::endl\n              << \"{ createBackup: 1, backupDir: <destination directory> }\";\n     }\n-    void addRequiredPrivileges(const std::string& dbname,\n-                               const BSONObj& cmdObj,\n-                               std::vector<Privilege>* out) override {\n-        ActionSet actions;\n-        actions.addAction(ActionType::startBackup);\n-        out->push_back(Privilege(parseResourcePattern(dbname, cmdObj), actions));\n+    Status checkAuthForCommand(ClientBasic* client,\n+                               const std::string& dbname,\n+                               const BSONObj& cmdObj) override {\n+        return AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(\n+                   ResourcePattern::forAnyNormalResource(), ActionType::startBackup)\n+            ? Status::OK()\n+            : Status(ErrorCodes::Unauthorized, \"Unauthorized\");","path":"src/mongo/db/backup/backup_commands.cpp","position":24,"original_position":24,"commit_id":"aa5643b63e6e73503e8e0374d22f257a68647116","original_commit_id":"aa5643b63e6e73503e8e0374d22f257a68647116","user":{"login":"igorsol","id":668750,"avatar_url":"https://avatars.githubusercontent.com/u/668750?v=3","gravatar_id":"","url":"https://api.github.com/users/igorsol","html_url":"https://github.com/igorsol","followers_url":"https://api.github.com/users/igorsol/followers","following_url":"https://api.github.com/users/igorsol/following{/other_user}","gists_url":"https://api.github.com/users/igorsol/gists{/gist_id}","starred_url":"https://api.github.com/users/igorsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorsol/subscriptions","organizations_url":"https://api.github.com/users/igorsol/orgs","repos_url":"https://api.github.com/users/igorsol/repos","events_url":"https://api.github.com/users/igorsol/events{/privacy}","received_events_url":"https://api.github.com/users/igorsol/received_events","type":"User","site_admin":false},"body":"Thank you for details.\r\nUnfortunately I don't understand why previous code only checks against `admin` db. Admin db is not mentioned there. But I see that new code effectively checks if authorized user has `startBackup` action in his roles.\r\nOne interesting thing is that `dbname` parameter is not used. In my understanding this is because `startBackup` works on a higher level (data directory).","created_at":"2016-09-29T15:50:14Z","updated_at":"2016-09-29T15:51:38Z","html_url":"https://github.com/percona/percona-server-mongodb/pull/80#discussion_r81169591","pull_request_url":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80","_links":{"self":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/comments/81169591"},"html":{"href":"https://github.com/percona/percona-server-mongodb/pull/80#discussion_r81169591"},"pull_request":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80"}}},"pull_request":{"url":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80","id":87152626,"html_url":"https://github.com/percona/percona-server-mongodb/pull/80","diff_url":"https://github.com/percona/percona-server-mongodb/pull/80.diff","patch_url":"https://github.com/percona/percona-server-mongodb/pull/80.patch","issue_url":"https://api.github.com/repos/percona/percona-server-mongodb/issues/80","number":80,"state":"open","locked":false,"title":"Enhance auth checks for HotBackup","user":{"login":"denis-protyvenskyi","id":16902149,"avatar_url":"https://avatars.githubusercontent.com/u/16902149?v=3","gravatar_id":"","url":"https://api.github.com/users/denis-protyvenskyi","html_url":"https://github.com/denis-protyvenskyi","followers_url":"https://api.github.com/users/denis-protyvenskyi/followers","following_url":"https://api.github.com/users/denis-protyvenskyi/following{/other_user}","gists_url":"https://api.github.com/users/denis-protyvenskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/denis-protyvenskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denis-protyvenskyi/subscriptions","organizations_url":"https://api.github.com/users/denis-protyvenskyi/orgs","repos_url":"https://api.github.com/users/denis-protyvenskyi/repos","events_url":"https://api.github.com/users/denis-protyvenskyi/events{/privacy}","received_events_url":"https://api.github.com/users/denis-protyvenskyi/received_events","type":"User","site_admin":false},"body":"Make HotBackup possible with 'backup' role on 'admin' database.","created_at":"2016-09-28T16:17:24Z","updated_at":"2016-09-29T15:51:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5da974d68474e984cc8ef6c7b6f9f45e9f22fb3","assignee":{"login":"igorsol","id":668750,"avatar_url":"https://avatars.githubusercontent.com/u/668750?v=3","gravatar_id":"","url":"https://api.github.com/users/igorsol","html_url":"https://github.com/igorsol","followers_url":"https://api.github.com/users/igorsol/followers","following_url":"https://api.github.com/users/igorsol/following{/other_user}","gists_url":"https://api.github.com/users/igorsol/gists{/gist_id}","starred_url":"https://api.github.com/users/igorsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorsol/subscriptions","organizations_url":"https://api.github.com/users/igorsol/orgs","repos_url":"https://api.github.com/users/igorsol/repos","events_url":"https://api.github.com/users/igorsol/events{/privacy}","received_events_url":"https://api.github.com/users/igorsol/received_events","type":"User","site_admin":false},"assignees":[{"login":"igorsol","id":668750,"avatar_url":"https://avatars.githubusercontent.com/u/668750?v=3","gravatar_id":"","url":"https://api.github.com/users/igorsol","html_url":"https://github.com/igorsol","followers_url":"https://api.github.com/users/igorsol/followers","following_url":"https://api.github.com/users/igorsol/following{/other_user}","gists_url":"https://api.github.com/users/igorsol/gists{/gist_id}","starred_url":"https://api.github.com/users/igorsol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/igorsol/subscriptions","organizations_url":"https://api.github.com/users/igorsol/orgs","repos_url":"https://api.github.com/users/igorsol/repos","events_url":"https://api.github.com/users/igorsol/events{/privacy}","received_events_url":"https://api.github.com/users/igorsol/received_events","type":"User","site_admin":false},{"login":"dbpercona","id":9259336,"avatar_url":"https://avatars.githubusercontent.com/u/9259336?v=3","gravatar_id":"","url":"https://api.github.com/users/dbpercona","html_url":"https://github.com/dbpercona","followers_url":"https://api.github.com/users/dbpercona/followers","following_url":"https://api.github.com/users/dbpercona/following{/other_user}","gists_url":"https://api.github.com/users/dbpercona/gists{/gist_id}","starred_url":"https://api.github.com/users/dbpercona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbpercona/subscriptions","organizations_url":"https://api.github.com/users/dbpercona/orgs","repos_url":"https://api.github.com/users/dbpercona/repos","events_url":"https://api.github.com/users/dbpercona/events{/privacy}","received_events_url":"https://api.github.com/users/dbpercona/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80/commits","review_comments_url":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80/comments","review_comment_url":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/percona/percona-server-mongodb/issues/80/comments","statuses_url":"https://api.github.com/repos/percona/percona-server-mongodb/statuses/aa5643b63e6e73503e8e0374d22f257a68647116","head":{"label":"denis-protyvenskyi:universal-hotbackup","ref":"universal-hotbackup","sha":"aa5643b63e6e73503e8e0374d22f257a68647116","user":{"login":"denis-protyvenskyi","id":16902149,"avatar_url":"https://avatars.githubusercontent.com/u/16902149?v=3","gravatar_id":"","url":"https://api.github.com/users/denis-protyvenskyi","html_url":"https://github.com/denis-protyvenskyi","followers_url":"https://api.github.com/users/denis-protyvenskyi/followers","following_url":"https://api.github.com/users/denis-protyvenskyi/following{/other_user}","gists_url":"https://api.github.com/users/denis-protyvenskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/denis-protyvenskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denis-protyvenskyi/subscriptions","organizations_url":"https://api.github.com/users/denis-protyvenskyi/orgs","repos_url":"https://api.github.com/users/denis-protyvenskyi/repos","events_url":"https://api.github.com/users/denis-protyvenskyi/events{/privacy}","received_events_url":"https://api.github.com/users/denis-protyvenskyi/received_events","type":"User","site_admin":false},"repo":{"id":50488494,"name":"percona-server-mongodb","full_name":"denis-protyvenskyi/percona-server-mongodb","owner":{"login":"denis-protyvenskyi","id":16902149,"avatar_url":"https://avatars.githubusercontent.com/u/16902149?v=3","gravatar_id":"","url":"https://api.github.com/users/denis-protyvenskyi","html_url":"https://github.com/denis-protyvenskyi","followers_url":"https://api.github.com/users/denis-protyvenskyi/followers","following_url":"https://api.github.com/users/denis-protyvenskyi/following{/other_user}","gists_url":"https://api.github.com/users/denis-protyvenskyi/gists{/gist_id}","starred_url":"https://api.github.com/users/denis-protyvenskyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denis-protyvenskyi/subscriptions","organizations_url":"https://api.github.com/users/denis-protyvenskyi/orgs","repos_url":"https://api.github.com/users/denis-protyvenskyi/repos","events_url":"https://api.github.com/users/denis-protyvenskyi/events{/privacy}","received_events_url":"https://api.github.com/users/denis-protyvenskyi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denis-protyvenskyi/percona-server-mongodb","description":"Percona Server for MongoDB","fork":true,"url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb","forks_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/forks","keys_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/teams","hooks_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/hooks","issue_events_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/issues/events{/number}","events_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/events","assignees_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/assignees{/user}","branches_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/branches{/branch}","tags_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/tags","blobs_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/statuses/{sha}","languages_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/languages","stargazers_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/stargazers","contributors_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/contributors","subscribers_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/subscribers","subscription_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/subscription","commits_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/contents/{+path}","compare_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/merges","archive_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/downloads","issues_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/issues{/number}","pulls_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/pulls{/number}","milestones_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/milestones{/number}","notifications_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/labels{/name}","releases_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/releases{/id}","deployments_url":"https://api.github.com/repos/denis-protyvenskyi/percona-server-mongodb/deployments","created_at":"2016-01-27T07:00:52Z","updated_at":"2016-01-27T07:01:08Z","pushed_at":"2016-09-28T16:14:18Z","git_url":"git://github.com/denis-protyvenskyi/percona-server-mongodb.git","ssh_url":"git@github.com:denis-protyvenskyi/percona-server-mongodb.git","clone_url":"https://github.com/denis-protyvenskyi/percona-server-mongodb.git","svn_url":"https://github.com/denis-protyvenskyi/percona-server-mongodb","homepage":"http://www.percona.com","size":250157,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"percona:v3.2-beta","ref":"v3.2-beta","sha":"33180e39d3de2caa83f4627669287379f2db70b0","user":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?v=3","gravatar_id":"","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"repo":{"id":39519916,"name":"percona-server-mongodb","full_name":"percona/percona-server-mongodb","owner":{"login":"percona","id":1683025,"avatar_url":"https://avatars.githubusercontent.com/u/1683025?v=3","gravatar_id":"","url":"https://api.github.com/users/percona","html_url":"https://github.com/percona","followers_url":"https://api.github.com/users/percona/followers","following_url":"https://api.github.com/users/percona/following{/other_user}","gists_url":"https://api.github.com/users/percona/gists{/gist_id}","starred_url":"https://api.github.com/users/percona/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/percona/subscriptions","organizations_url":"https://api.github.com/users/percona/orgs","repos_url":"https://api.github.com/users/percona/repos","events_url":"https://api.github.com/users/percona/events{/privacy}","received_events_url":"https://api.github.com/users/percona/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/percona/percona-server-mongodb","description":"Percona Server for MongoDB","fork":true,"url":"https://api.github.com/repos/percona/percona-server-mongodb","forks_url":"https://api.github.com/repos/percona/percona-server-mongodb/forks","keys_url":"https://api.github.com/repos/percona/percona-server-mongodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/percona/percona-server-mongodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/percona/percona-server-mongodb/teams","hooks_url":"https://api.github.com/repos/percona/percona-server-mongodb/hooks","issue_events_url":"https://api.github.com/repos/percona/percona-server-mongodb/issues/events{/number}","events_url":"https://api.github.com/repos/percona/percona-server-mongodb/events","assignees_url":"https://api.github.com/repos/percona/percona-server-mongodb/assignees{/user}","branches_url":"https://api.github.com/repos/percona/percona-server-mongodb/branches{/branch}","tags_url":"https://api.github.com/repos/percona/percona-server-mongodb/tags","blobs_url":"https://api.github.com/repos/percona/percona-server-mongodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/percona/percona-server-mongodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/percona/percona-server-mongodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/percona/percona-server-mongodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/percona/percona-server-mongodb/statuses/{sha}","languages_url":"https://api.github.com/repos/percona/percona-server-mongodb/languages","stargazers_url":"https://api.github.com/repos/percona/percona-server-mongodb/stargazers","contributors_url":"https://api.github.com/repos/percona/percona-server-mongodb/contributors","subscribers_url":"https://api.github.com/repos/percona/percona-server-mongodb/subscribers","subscription_url":"https://api.github.com/repos/percona/percona-server-mongodb/subscription","commits_url":"https://api.github.com/repos/percona/percona-server-mongodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/percona/percona-server-mongodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/percona/percona-server-mongodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/percona/percona-server-mongodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/percona/percona-server-mongodb/contents/{+path}","compare_url":"https://api.github.com/repos/percona/percona-server-mongodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/percona/percona-server-mongodb/merges","archive_url":"https://api.github.com/repos/percona/percona-server-mongodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/percona/percona-server-mongodb/downloads","issues_url":"https://api.github.com/repos/percona/percona-server-mongodb/issues{/number}","pulls_url":"https://api.github.com/repos/percona/percona-server-mongodb/pulls{/number}","milestones_url":"https://api.github.com/repos/percona/percona-server-mongodb/milestones{/number}","notifications_url":"https://api.github.com/repos/percona/percona-server-mongodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/percona/percona-server-mongodb/labels{/name}","releases_url":"https://api.github.com/repos/percona/percona-server-mongodb/releases{/id}","deployments_url":"https://api.github.com/repos/percona/percona-server-mongodb/deployments","created_at":"2015-07-22T17:25:26Z","updated_at":"2016-09-20T23:01:06Z","pushed_at":"2016-09-28T16:17:24Z","git_url":"git://github.com/percona/percona-server-mongodb.git","ssh_url":"git@github.com:percona/percona-server-mongodb.git","clone_url":"https://github.com/percona/percona-server-mongodb.git","svn_url":"https://github.com/percona/percona-server-mongodb","homepage":"http://www.percona.com","size":225823,"stargazers_count":32,"watchers_count":32,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":5,"forks":12,"open_issues":5,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80"},"html":{"href":"https://github.com/percona/percona-server-mongodb/pull/80"},"issue":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/issues/80"},"comments":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/issues/80/comments"},"review_comments":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80/comments"},"review_comment":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/pulls/80/commits"},"statuses":{"href":"https://api.github.com/repos/percona/percona-server-mongodb/statuses/aa5643b63e6e73503e8e0374d22f257a68647116"}}}}
{"actor":{"display_login":"igorsol"}}