{"action":"created","comment":{"url":"https://api.github.com/repos/librenms/librenms/pulls/comments/38850887","id":38850887,"diff_hunk":"@@ -51,7 +51,25 @@\n   });\n ';\n \n-foreach (dbFetchRows(\"SELECT `device_id`,`hostname`,`os`,`status`,`lat`,`lng` FROM `devices` LEFT JOIN `locations` ON `devices`.`location`=`locations`.`location` WHERE `disabled`=0 AND `ignore`=0 AND `lat` != '' AND `lng` != '' ORDER BY `status` ASC, `hostname`\") as $map_devices) {\n+// Checking user permissions\n+if (is_admin() || is_read()) {\n+// Admin or global read-only - show all devices\n+    $sql = \"SELECT `device_id`,`hostname`,`os`,`status`,`lat`,`lng` FROM `devices`\n+            LEFT JOIN `locations` ON `devices`.`location`=`locations`.`location`\n+            WHERE `disabled`=0 AND `ignore`=0 AND `lat` != '' AND `lng` != ''\n+            ORDER BY `status` ASC, `hostname`\";\n+}\n+else {\n+// Normal user - grab devices that user has permissions to\n+    $sql = \"SELECT `devices`.`device_id` as `device_id`,`hostname`,`os`,`status`,`lat`,`lng`\n+            FROM `devices_perms`, `devices`\n+            LEFT JOIN `locations` ON `devices`.`location`=`locations`.`location`\n+            WHERE `disabled`=0 AND `ignore`=0 AND `lat` != '' AND `lng` != ''\n+            AND `devices`.`device_id` = `devices_perms`.`device_id`\n+            AND `devices_perms`.`user_id` = '\".$_SESSION['user_id'].\"'","path":"html/includes/common/worldmap.inc.php","position":20,"original_position":20,"commit_id":"50b40f82c06d5f09e2ff914694d5b1418c316eba","original_commit_id":"50b40f82c06d5f09e2ff914694d5b1418c316eba","user":{"login":"f0o","id":1656377,"avatar_url":"https://avatars.githubusercontent.com/u/1656377?v=3","gravatar_id":"","url":"https://api.github.com/users/f0o","html_url":"https://github.com/f0o","followers_url":"https://api.github.com/users/f0o/followers","following_url":"https://api.github.com/users/f0o/following{/other_user}","gists_url":"https://api.github.com/users/f0o/gists{/gist_id}","starred_url":"https://api.github.com/users/f0o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f0o/subscriptions","organizations_url":"https://api.github.com/users/f0o/orgs","repos_url":"https://api.github.com/users/f0o/repos","events_url":"https://api.github.com/users/f0o/events{/privacy}","received_events_url":"https://api.github.com/users/f0o/received_events","type":"User","site_admin":false},"body":"please use a `?` sign as placeholder and give the `dbFetchRows($sql)` a 2nd param in form of `array($_SESSION['user_id'])`","created_at":"2015-09-07T10:25:24Z","updated_at":"2015-09-07T10:25:24Z","html_url":"https://github.com/librenms/librenms/pull/1857#discussion_r38850887","pull_request_url":"https://api.github.com/repos/librenms/librenms/pulls/1857","_links":{"self":{"href":"https://api.github.com/repos/librenms/librenms/pulls/comments/38850887"},"html":{"href":"https://github.com/librenms/librenms/pull/1857#discussion_r38850887"},"pull_request":{"href":"https://api.github.com/repos/librenms/librenms/pulls/1857"}}},"pull_request":{"url":"https://api.github.com/repos/librenms/librenms/pulls/1857","id":44311081,"html_url":"https://github.com/librenms/librenms/pull/1857","diff_url":"https://github.com/librenms/librenms/pull/1857.diff","patch_url":"https://github.com/librenms/librenms/pull/1857.patch","issue_url":"https://api.github.com/repos/librenms/librenms/issues/1857","number":1857,"state":"open","locked":false,"title":"Issue 1855","user":{"login":"spaprzycki","id":10880890,"avatar_url":"https://avatars.githubusercontent.com/u/10880890?v=3","gravatar_id":"","url":"https://api.github.com/users/spaprzycki","html_url":"https://github.com/spaprzycki","followers_url":"https://api.github.com/users/spaprzycki/followers","following_url":"https://api.github.com/users/spaprzycki/following{/other_user}","gists_url":"https://api.github.com/users/spaprzycki/gists{/gist_id}","starred_url":"https://api.github.com/users/spaprzycki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spaprzycki/subscriptions","organizations_url":"https://api.github.com/users/spaprzycki/orgs","repos_url":"https://api.github.com/users/spaprzycki/repos","events_url":"https://api.github.com/users/spaprzycki/events{/privacy}","received_events_url":"https://api.github.com/users/spaprzycki/received_events","type":"User","site_admin":false},"body":"As per issue 1855 created short while ago","created_at":"2015-09-06T22:18:24Z","updated_at":"2015-09-07T10:25:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d57a55a226facde559f945e55a94da05c7a85de7","assignee":{"login":"f0o","id":1656377,"avatar_url":"https://avatars.githubusercontent.com/u/1656377?v=3","gravatar_id":"","url":"https://api.github.com/users/f0o","html_url":"https://github.com/f0o","followers_url":"https://api.github.com/users/f0o/followers","following_url":"https://api.github.com/users/f0o/following{/other_user}","gists_url":"https://api.github.com/users/f0o/gists{/gist_id}","starred_url":"https://api.github.com/users/f0o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/f0o/subscriptions","organizations_url":"https://api.github.com/users/f0o/orgs","repos_url":"https://api.github.com/users/f0o/repos","events_url":"https://api.github.com/users/f0o/events{/privacy}","received_events_url":"https://api.github.com/users/f0o/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/librenms/librenms/pulls/1857/commits","review_comments_url":"https://api.github.com/repos/librenms/librenms/pulls/1857/comments","review_comment_url":"https://api.github.com/repos/librenms/librenms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/librenms/librenms/issues/1857/comments","statuses_url":"https://api.github.com/repos/librenms/librenms/statuses/50b40f82c06d5f09e2ff914694d5b1418c316eba","head":{"label":"spaprzycki:issue-1855","ref":"issue-1855","sha":"50b40f82c06d5f09e2ff914694d5b1418c316eba","user":{"login":"spaprzycki","id":10880890,"avatar_url":"https://avatars.githubusercontent.com/u/10880890?v=3","gravatar_id":"","url":"https://api.github.com/users/spaprzycki","html_url":"https://github.com/spaprzycki","followers_url":"https://api.github.com/users/spaprzycki/followers","following_url":"https://api.github.com/users/spaprzycki/following{/other_user}","gists_url":"https://api.github.com/users/spaprzycki/gists{/gist_id}","starred_url":"https://api.github.com/users/spaprzycki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spaprzycki/subscriptions","organizations_url":"https://api.github.com/users/spaprzycki/orgs","repos_url":"https://api.github.com/users/spaprzycki/repos","events_url":"https://api.github.com/users/spaprzycki/events{/privacy}","received_events_url":"https://api.github.com/users/spaprzycki/received_events","type":"User","site_admin":false},"repo":{"id":42018733,"name":"librenms","full_name":"spaprzycki/librenms","owner":{"login":"spaprzycki","id":10880890,"avatar_url":"https://avatars.githubusercontent.com/u/10880890?v=3","gravatar_id":"","url":"https://api.github.com/users/spaprzycki","html_url":"https://github.com/spaprzycki","followers_url":"https://api.github.com/users/spaprzycki/followers","following_url":"https://api.github.com/users/spaprzycki/following{/other_user}","gists_url":"https://api.github.com/users/spaprzycki/gists{/gist_id}","starred_url":"https://api.github.com/users/spaprzycki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spaprzycki/subscriptions","organizations_url":"https://api.github.com/users/spaprzycki/orgs","repos_url":"https://api.github.com/users/spaprzycki/repos","events_url":"https://api.github.com/users/spaprzycki/events{/privacy}","received_events_url":"https://api.github.com/users/spaprzycki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spaprzycki/librenms","description":"Community-based GPL-licensed network monitoring system","fork":true,"url":"https://api.github.com/repos/spaprzycki/librenms","forks_url":"https://api.github.com/repos/spaprzycki/librenms/forks","keys_url":"https://api.github.com/repos/spaprzycki/librenms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spaprzycki/librenms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spaprzycki/librenms/teams","hooks_url":"https://api.github.com/repos/spaprzycki/librenms/hooks","issue_events_url":"https://api.github.com/repos/spaprzycki/librenms/issues/events{/number}","events_url":"https://api.github.com/repos/spaprzycki/librenms/events","assignees_url":"https://api.github.com/repos/spaprzycki/librenms/assignees{/user}","branches_url":"https://api.github.com/repos/spaprzycki/librenms/branches{/branch}","tags_url":"https://api.github.com/repos/spaprzycki/librenms/tags","blobs_url":"https://api.github.com/repos/spaprzycki/librenms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spaprzycki/librenms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spaprzycki/librenms/git/refs{/sha}","trees_url":"https://api.github.com/repos/spaprzycki/librenms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spaprzycki/librenms/statuses/{sha}","languages_url":"https://api.github.com/repos/spaprzycki/librenms/languages","stargazers_url":"https://api.github.com/repos/spaprzycki/librenms/stargazers","contributors_url":"https://api.github.com/repos/spaprzycki/librenms/contributors","subscribers_url":"https://api.github.com/repos/spaprzycki/librenms/subscribers","subscription_url":"https://api.github.com/repos/spaprzycki/librenms/subscription","commits_url":"https://api.github.com/repos/spaprzycki/librenms/commits{/sha}","git_commits_url":"https://api.github.com/repos/spaprzycki/librenms/git/commits{/sha}","comments_url":"https://api.github.com/repos/spaprzycki/librenms/comments{/number}","issue_comment_url":"https://api.github.com/repos/spaprzycki/librenms/issues/comments{/number}","contents_url":"https://api.github.com/repos/spaprzycki/librenms/contents/{+path}","compare_url":"https://api.github.com/repos/spaprzycki/librenms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spaprzycki/librenms/merges","archive_url":"https://api.github.com/repos/spaprzycki/librenms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spaprzycki/librenms/downloads","issues_url":"https://api.github.com/repos/spaprzycki/librenms/issues{/number}","pulls_url":"https://api.github.com/repos/spaprzycki/librenms/pulls{/number}","milestones_url":"https://api.github.com/repos/spaprzycki/librenms/milestones{/number}","notifications_url":"https://api.github.com/repos/spaprzycki/librenms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spaprzycki/librenms/labels{/name}","releases_url":"https://api.github.com/repos/spaprzycki/librenms/releases{/id}","created_at":"2015-09-06T21:02:43Z","updated_at":"2015-09-06T21:03:22Z","pushed_at":"2015-09-06T22:15:19Z","git_url":"git://github.com/spaprzycki/librenms.git","ssh_url":"git@github.com:spaprzycki/librenms.git","clone_url":"https://github.com/spaprzycki/librenms.git","svn_url":"https://github.com/spaprzycki/librenms","homepage":"http://www.librenms.org/","size":95685,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"librenms:master","ref":"master","sha":"e0e4f97747729ec0b533efb683121894944fab6e","user":{"login":"librenms","id":5791783,"avatar_url":"https://avatars.githubusercontent.com/u/5791783?v=3","gravatar_id":"","url":"https://api.github.com/users/librenms","html_url":"https://github.com/librenms","followers_url":"https://api.github.com/users/librenms/followers","following_url":"https://api.github.com/users/librenms/following{/other_user}","gists_url":"https://api.github.com/users/librenms/gists{/gist_id}","starred_url":"https://api.github.com/users/librenms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/librenms/subscriptions","organizations_url":"https://api.github.com/users/librenms/orgs","repos_url":"https://api.github.com/users/librenms/repos","events_url":"https://api.github.com/users/librenms/events{/privacy}","received_events_url":"https://api.github.com/users/librenms/received_events","type":"Organization","site_admin":false},"repo":{"id":13914116,"name":"librenms","full_name":"librenms/librenms","owner":{"login":"librenms","id":5791783,"avatar_url":"https://avatars.githubusercontent.com/u/5791783?v=3","gravatar_id":"","url":"https://api.github.com/users/librenms","html_url":"https://github.com/librenms","followers_url":"https://api.github.com/users/librenms/followers","following_url":"https://api.github.com/users/librenms/following{/other_user}","gists_url":"https://api.github.com/users/librenms/gists{/gist_id}","starred_url":"https://api.github.com/users/librenms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/librenms/subscriptions","organizations_url":"https://api.github.com/users/librenms/orgs","repos_url":"https://api.github.com/users/librenms/repos","events_url":"https://api.github.com/users/librenms/events{/privacy}","received_events_url":"https://api.github.com/users/librenms/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/librenms/librenms","description":"Community-based GPL-licensed network monitoring system","fork":false,"url":"https://api.github.com/repos/librenms/librenms","forks_url":"https://api.github.com/repos/librenms/librenms/forks","keys_url":"https://api.github.com/repos/librenms/librenms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/librenms/librenms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/librenms/librenms/teams","hooks_url":"https://api.github.com/repos/librenms/librenms/hooks","issue_events_url":"https://api.github.com/repos/librenms/librenms/issues/events{/number}","events_url":"https://api.github.com/repos/librenms/librenms/events","assignees_url":"https://api.github.com/repos/librenms/librenms/assignees{/user}","branches_url":"https://api.github.com/repos/librenms/librenms/branches{/branch}","tags_url":"https://api.github.com/repos/librenms/librenms/tags","blobs_url":"https://api.github.com/repos/librenms/librenms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/librenms/librenms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/librenms/librenms/git/refs{/sha}","trees_url":"https://api.github.com/repos/librenms/librenms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/librenms/librenms/statuses/{sha}","languages_url":"https://api.github.com/repos/librenms/librenms/languages","stargazers_url":"https://api.github.com/repos/librenms/librenms/stargazers","contributors_url":"https://api.github.com/repos/librenms/librenms/contributors","subscribers_url":"https://api.github.com/repos/librenms/librenms/subscribers","subscription_url":"https://api.github.com/repos/librenms/librenms/subscription","commits_url":"https://api.github.com/repos/librenms/librenms/commits{/sha}","git_commits_url":"https://api.github.com/repos/librenms/librenms/git/commits{/sha}","comments_url":"https://api.github.com/repos/librenms/librenms/comments{/number}","issue_comment_url":"https://api.github.com/repos/librenms/librenms/issues/comments{/number}","contents_url":"https://api.github.com/repos/librenms/librenms/contents/{+path}","compare_url":"https://api.github.com/repos/librenms/librenms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/librenms/librenms/merges","archive_url":"https://api.github.com/repos/librenms/librenms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/librenms/librenms/downloads","issues_url":"https://api.github.com/repos/librenms/librenms/issues{/number}","pulls_url":"https://api.github.com/repos/librenms/librenms/pulls{/number}","milestones_url":"https://api.github.com/repos/librenms/librenms/milestones{/number}","notifications_url":"https://api.github.com/repos/librenms/librenms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/librenms/librenms/labels{/name}","releases_url":"https://api.github.com/repos/librenms/librenms/releases{/id}","created_at":"2013-10-28T01:37:13Z","updated_at":"2015-09-04T17:33:06Z","pushed_at":"2015-09-07T10:23:42Z","git_url":"git://github.com/librenms/librenms.git","ssh_url":"git@github.com:librenms/librenms.git","clone_url":"https://github.com/librenms/librenms.git","svn_url":"https://github.com/librenms/librenms","homepage":"http://www.librenms.org/","size":95685,"stargazers_count":223,"watchers_count":223,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":135,"mirror_url":null,"open_issues_count":139,"forks":135,"open_issues":139,"watchers":223,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/librenms/librenms/pulls/1857"},"html":{"href":"https://github.com/librenms/librenms/pull/1857"},"issue":{"href":"https://api.github.com/repos/librenms/librenms/issues/1857"},"comments":{"href":"https://api.github.com/repos/librenms/librenms/issues/1857/comments"},"review_comments":{"href":"https://api.github.com/repos/librenms/librenms/pulls/1857/comments"},"review_comment":{"href":"https://api.github.com/repos/librenms/librenms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/librenms/librenms/pulls/1857/commits"},"statuses":{"href":"https://api.github.com/repos/librenms/librenms/statuses/50b40f82c06d5f09e2ff914694d5b1418c316eba"}}}}