{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/server-auth/pulls/comments/191330505","pull_request_review_id":123879510,"id":191330505,"diff_hunk":"@@ -34,29 +37,52 @@ class ResAuthenticationAttempt(models.Model):\n     whitelisted = fields.Boolean(\n         compute=\"_compute_whitelisted\",\n     )\n+    banned = fields.Boolean(\n+        compute=\"_compute_banned\"\n+    )\n+\n+    @api.multi\n+    @api.depends('remote', 'login')\n+    def _compute_banned(self):\n+        for item in self:\n+            item.banned = not self._trusted(item.remote, item.login)\n \n     @api.multi\n     @api.depends('remote')\n     def _compute_metadata(self):\n-        for item in self:\n-            url = GEOLOCALISATION_URL.format(item.remote)\n+        if util.strtobool(self.env[\"ir.config_parameter\"].sudo().get_param(\n+            'auth_brute_force.check_remote', 'True'\n+        )):\n+            for item in self:\n+                url = GEOLOCALISATION_URL.format(item.remote)\n+                try:\n+                    res = json.loads(urlopen(url, timeout=5).read())\n+                except Exception:\n+                    _logger.warning(\n+                        \"Couldn't fetch details from %s\",\n+                        url,\n+                        exc_info=True,\n+                    )\n+                else:\n+                    item.remote_metadata = \"\\n\".join(\n+                        '%s: %s' % pair for pair in res.items())\n+\n+    def check_whitelist(self, ip):","path":"auth_brute_force/models/res_authentication_attempt.py","position":54,"original_position":54,"commit_id":"e6c8a8d7af9e2b6489001ddac26055873a54163c","original_commit_id":"e6c8a8d7af9e2b6489001ddac26055873a54163c","user":{"login":"Yajo","id":973709,"avatar_url":"https://avatars0.githubusercontent.com/u/973709?v=4","gravatar_id":"","url":"https://api.github.com/users/Yajo","html_url":"https://github.com/Yajo","followers_url":"https://api.github.com/users/Yajo/followers","following_url":"https://api.github.com/users/Yajo/following{/other_user}","gists_url":"https://api.github.com/users/Yajo/gists{/gist_id}","starred_url":"https://api.github.com/users/Yajo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yajo/subscriptions","organizations_url":"https://api.github.com/users/Yajo/orgs","repos_url":"https://api.github.com/users/Yajo/repos","events_url":"https://api.github.com/users/Yajo/events{/privacy}","received_events_url":"https://api.github.com/users/Yajo/received_events","type":"User","site_admin":false},"body":"`@api.model`. Make it private method, we don't want it to be called through RPC.","created_at":"2018-05-29T07:49:47Z","updated_at":"2018-05-29T07:57:50Z","html_url":"https://github.com/OCA/server-auth/pull/23#discussion_r191330505","pull_request_url":"https://api.github.com/repos/OCA/server-auth/pulls/23","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/OCA/server-auth/pulls/comments/191330505"},"html":{"href":"https://github.com/OCA/server-auth/pull/23#discussion_r191330505"},"pull_request":{"href":"https://api.github.com/repos/OCA/server-auth/pulls/23"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/server-auth/pulls/23","id":190934032,"html_url":"https://github.com/OCA/server-auth/pull/23","diff_url":"https://github.com/OCA/server-auth/pull/23.diff","patch_url":"https://github.com/OCA/server-auth/pull/23.patch","issue_url":"https://api.github.com/repos/OCA/server-auth/issues/23","number":23,"state":"open","locked":false,"title":"[11.0][auth_brute_force][IMP] Set CIDR configuration & some extra improvements","user":{"login":"etobella","id":28590170,"avatar_url":"https://avatars1.githubusercontent.com/u/28590170?v=4","gravatar_id":"","url":"https://api.github.com/users/etobella","html_url":"https://github.com/etobella","followers_url":"https://api.github.com/users/etobella/followers","following_url":"https://api.github.com/users/etobella/following{/other_user}","gists_url":"https://api.github.com/users/etobella/gists{/gist_id}","starred_url":"https://api.github.com/users/etobella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etobella/subscriptions","organizations_url":"https://api.github.com/users/etobella/orgs","repos_url":"https://api.github.com/users/etobella/repos","events_url":"https://api.github.com/users/etobella/events{/privacy}","received_events_url":"https://api.github.com/users/etobella/received_events","type":"User","site_admin":false},"body":"Sets ICDR validation as expected from #22 \r\n\r\nEdition and deletion of lines is disallowed and items can be set to unbanned in order to simplify the process. Now, you can set to unbanned in order to reset the counters and you can also maintain all the history.\r\n\r\nFix #22","created_at":"2018-05-28T13:41:42Z","updated_at":"2018-05-29T07:57:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"18104ea2f54c0e51bdba682ce58673f00b7f5c8b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/OCA/server-auth/pulls/23/commits","review_comments_url":"https://api.github.com/repos/OCA/server-auth/pulls/23/comments","review_comment_url":"https://api.github.com/repos/OCA/server-auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/server-auth/issues/23/comments","statuses_url":"https://api.github.com/repos/OCA/server-auth/statuses/e6c8a8d7af9e2b6489001ddac26055873a54163c","head":{"label":"etobella:11.0-fix-set-cidr","ref":"11.0-fix-set-cidr","sha":"e6c8a8d7af9e2b6489001ddac26055873a54163c","user":{"login":"etobella","id":28590170,"avatar_url":"https://avatars1.githubusercontent.com/u/28590170?v=4","gravatar_id":"","url":"https://api.github.com/users/etobella","html_url":"https://github.com/etobella","followers_url":"https://api.github.com/users/etobella/followers","following_url":"https://api.github.com/users/etobella/following{/other_user}","gists_url":"https://api.github.com/users/etobella/gists{/gist_id}","starred_url":"https://api.github.com/users/etobella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etobella/subscriptions","organizations_url":"https://api.github.com/users/etobella/orgs","repos_url":"https://api.github.com/users/etobella/repos","events_url":"https://api.github.com/users/etobella/events{/privacy}","received_events_url":"https://api.github.com/users/etobella/received_events","type":"User","site_admin":false},"repo":{"id":106395747,"name":"server-auth","full_name":"etobella/server-auth","owner":{"login":"etobella","id":28590170,"avatar_url":"https://avatars1.githubusercontent.com/u/28590170?v=4","gravatar_id":"","url":"https://api.github.com/users/etobella","html_url":"https://github.com/etobella","followers_url":"https://api.github.com/users/etobella/followers","following_url":"https://api.github.com/users/etobella/following{/other_user}","gists_url":"https://api.github.com/users/etobella/gists{/gist_id}","starred_url":"https://api.github.com/users/etobella/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/etobella/subscriptions","organizations_url":"https://api.github.com/users/etobella/orgs","repos_url":"https://api.github.com/users/etobella/repos","events_url":"https://api.github.com/users/etobella/events{/privacy}","received_events_url":"https://api.github.com/users/etobella/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/etobella/server-auth","description":null,"fork":true,"url":"https://api.github.com/repos/etobella/server-auth","forks_url":"https://api.github.com/repos/etobella/server-auth/forks","keys_url":"https://api.github.com/repos/etobella/server-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/etobella/server-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/etobella/server-auth/teams","hooks_url":"https://api.github.com/repos/etobella/server-auth/hooks","issue_events_url":"https://api.github.com/repos/etobella/server-auth/issues/events{/number}","events_url":"https://api.github.com/repos/etobella/server-auth/events","assignees_url":"https://api.github.com/repos/etobella/server-auth/assignees{/user}","branches_url":"https://api.github.com/repos/etobella/server-auth/branches{/branch}","tags_url":"https://api.github.com/repos/etobella/server-auth/tags","blobs_url":"https://api.github.com/repos/etobella/server-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/etobella/server-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/etobella/server-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/etobella/server-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/etobella/server-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/etobella/server-auth/languages","stargazers_url":"https://api.github.com/repos/etobella/server-auth/stargazers","contributors_url":"https://api.github.com/repos/etobella/server-auth/contributors","subscribers_url":"https://api.github.com/repos/etobella/server-auth/subscribers","subscription_url":"https://api.github.com/repos/etobella/server-auth/subscription","commits_url":"https://api.github.com/repos/etobella/server-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/etobella/server-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/etobella/server-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/etobella/server-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/etobella/server-auth/contents/{+path}","compare_url":"https://api.github.com/repos/etobella/server-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/etobella/server-auth/merges","archive_url":"https://api.github.com/repos/etobella/server-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/etobella/server-auth/downloads","issues_url":"https://api.github.com/repos/etobella/server-auth/issues{/number}","pulls_url":"https://api.github.com/repos/etobella/server-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/etobella/server-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/etobella/server-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/etobella/server-auth/labels{/name}","releases_url":"https://api.github.com/repos/etobella/server-auth/releases{/id}","deployments_url":"https://api.github.com/repos/etobella/server-auth/deployments","created_at":"2017-10-10T09:21:34Z","updated_at":"2017-10-10T09:13:21Z","pushed_at":"2018-05-28T16:13:55Z","git_url":"git://github.com/etobella/server-auth.git","ssh_url":"git@github.com:etobella/server-auth.git","clone_url":"https://github.com/etobella/server-auth.git","svn_url":"https://github.com/etobella/server-auth","homepage":null,"size":605,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"11.0"}},"base":{"label":"OCA:11.0","ref":"11.0","sha":"665e83120e13affcd31189ba302e698e754e06c1","user":{"login":"OCA","id":7600578,"avatar_url":"https://avatars1.githubusercontent.com/u/7600578?v=4","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"repo":{"id":106394816,"name":"server-auth","full_name":"OCA/server-auth","owner":{"login":"OCA","id":7600578,"avatar_url":"https://avatars1.githubusercontent.com/u/7600578?v=4","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OCA/server-auth","description":null,"fork":false,"url":"https://api.github.com/repos/OCA/server-auth","forks_url":"https://api.github.com/repos/OCA/server-auth/forks","keys_url":"https://api.github.com/repos/OCA/server-auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/server-auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/server-auth/teams","hooks_url":"https://api.github.com/repos/OCA/server-auth/hooks","issue_events_url":"https://api.github.com/repos/OCA/server-auth/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/server-auth/events","assignees_url":"https://api.github.com/repos/OCA/server-auth/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/server-auth/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/server-auth/tags","blobs_url":"https://api.github.com/repos/OCA/server-auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/server-auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/server-auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/server-auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/server-auth/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/server-auth/languages","stargazers_url":"https://api.github.com/repos/OCA/server-auth/stargazers","contributors_url":"https://api.github.com/repos/OCA/server-auth/contributors","subscribers_url":"https://api.github.com/repos/OCA/server-auth/subscribers","subscription_url":"https://api.github.com/repos/OCA/server-auth/subscription","commits_url":"https://api.github.com/repos/OCA/server-auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/server-auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/server-auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/server-auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/server-auth/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/server-auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/server-auth/merges","archive_url":"https://api.github.com/repos/OCA/server-auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/server-auth/downloads","issues_url":"https://api.github.com/repos/OCA/server-auth/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/server-auth/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/server-auth/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/server-auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/server-auth/labels{/name}","releases_url":"https://api.github.com/repos/OCA/server-auth/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/server-auth/deployments","created_at":"2017-10-10T09:13:21Z","updated_at":"2018-05-28T12:08:41Z","pushed_at":"2018-05-28T16:13:56Z","git_url":"git://github.com/OCA/server-auth.git","ssh_url":"git@github.com:OCA/server-auth.git","clone_url":"https://github.com/OCA/server-auth.git","svn_url":"https://github.com/OCA/server-auth","homepage":null,"size":595,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":23,"mirror_url":null,"archived":false,"open_issues_count":10,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0"},"forks":23,"open_issues":10,"watchers":6,"default_branch":"11.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/server-auth/pulls/23"},"html":{"href":"https://github.com/OCA/server-auth/pull/23"},"issue":{"href":"https://api.github.com/repos/OCA/server-auth/issues/23"},"comments":{"href":"https://api.github.com/repos/OCA/server-auth/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/server-auth/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/server-auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/server-auth/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/server-auth/statuses/e6c8a8d7af9e2b6489001ddac26055873a54163c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"Yajo"}}