{"action":"created","comment":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments/185142471","pull_request_review_id":116474942,"id":185142471,"diff_hunk":"@@ -43,64 +43,64 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {\n \n   public $_freqUnits;\n \n+  /**\n+   * Context of the form being loaded.\n+   *\n+   * 'event' or null\n+   *\n+   * @var string\n+   */\n+  protected $context;\n+\n   /**\n    * Build the form object.\n    */\n   public function buildQuickForm() {\n     parent::buildQuickForm();\n     $this->_mappingID = $mappingID = NULL;\n     $providersCount = CRM_SMS_BAO_Provider::activeProviderCount();\n-    $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);\n+    $this->context = CRM_Utils_Request::retrieve('context', 'String', $this);\n+    if ($this->context == 'event') {\n+      $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);\n+    }\n \n     //CRM-16777: Don't provide access to administer schedule reminder page, with user that does not have 'administer CiviCRM' permission\n-    if (empty($this->_context) && !CRM_Core_Permission::check('administer CiviCRM')) {\n-      CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));\n+    if (!$this->context && !CRM_Core_Permission::check('administer CiviCRM')) {\n+      throw new CRM_Core_Exception(ts('You do not have permission to access this page.'));\n     }\n     //CRM-16777: When user have ACLs 'edit' permission for specific event, do not give access to add, delete & updtae\n     //schedule reminder for other events.\n-    else {\n-      $this->_compId = CRM_Utils_Request::retrieve('compId', 'Integer', $this);\n-      if (!CRM_Event_BAO_Event::checkPermission($this->_compId, CRM_Core_Permission::EDIT)) {\n-        CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));\n-      }\n+    elseif ($this->context === 'event' && !CRM_Event_BAO_Event::checkPermission($this->_compId, CRM_Core_Permission::EDIT)) {","path":"CRM/Admin/Form/ScheduleReminders.php","position":39,"original_position":39,"commit_id":"12d546731dd101f69501cb8e3ceac9151f1b9784","original_commit_id":"12d546731dd101f69501cb8e3ceac9151f1b9784","user":{"login":"eileenmcnaughton","id":336308,"avatar_url":"https://avatars2.githubusercontent.com/u/336308?v=4","gravatar_id":"","url":"https://api.github.com/users/eileenmcnaughton","html_url":"https://github.com/eileenmcnaughton","followers_url":"https://api.github.com/users/eileenmcnaughton/followers","following_url":"https://api.github.com/users/eileenmcnaughton/following{/other_user}","gists_url":"https://api.github.com/users/eileenmcnaughton/gists{/gist_id}","starred_url":"https://api.github.com/users/eileenmcnaughton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eileenmcnaughton/subscriptions","organizations_url":"https://api.github.com/users/eileenmcnaughton/orgs","repos_url":"https://api.github.com/users/eileenmcnaughton/repos","events_url":"https://api.github.com/users/eileenmcnaughton/events{/privacy}","received_events_url":"https://api.github.com/users/eileenmcnaughton/received_events","type":"User","site_admin":false},"body":"the actual change in this PR is the elseif vs the else","created_at":"2018-04-30T23:59:47Z","updated_at":"2018-04-30T23:59:48Z","html_url":"https://github.com/civicrm/civicrm-core/pull/11733#discussion_r185142471","pull_request_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments/185142471"},"html":{"href":"https://github.com/civicrm/civicrm-core/pull/11733#discussion_r185142471"},"pull_request":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733"}}},"pull_request":{"url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733","id":171839267,"html_url":"https://github.com/civicrm/civicrm-core/pull/11733","diff_url":"https://github.com/civicrm/civicrm-core/pull/11733.diff","patch_url":"https://github.com/civicrm/civicrm-core/pull/11733.patch","issue_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/11733","number":11733,"state":"open","locked":false,"title":"Fix access to scheduled reminders for admins without event access","user":{"login":"eileenmcnaughton","id":336308,"avatar_url":"https://avatars2.githubusercontent.com/u/336308?v=4","gravatar_id":"","url":"https://api.github.com/users/eileenmcnaughton","html_url":"https://github.com/eileenmcnaughton","followers_url":"https://api.github.com/users/eileenmcnaughton/followers","following_url":"https://api.github.com/users/eileenmcnaughton/following{/other_user}","gists_url":"https://api.github.com/users/eileenmcnaughton/gists{/gist_id}","starred_url":"https://api.github.com/users/eileenmcnaughton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eileenmcnaughton/subscriptions","organizations_url":"https://api.github.com/users/eileenmcnaughton/orgs","repos_url":"https://api.github.com/users/eileenmcnaughton/repos","events_url":"https://api.github.com/users/eileenmcnaughton/events{/privacy}","received_events_url":"https://api.github.com/users/eileenmcnaughton/received_events","type":"User","site_admin":false},"body":"Overview\r\n----------------------------------------\r\nFix access to scheduled reminders for admins without event access\r\n\r\nBefore\r\n----------------------------------------\r\nSomeone with 'Administer CiviCRM' but not 'Manage Events' gets an error trying to create a non-event scheduled reminder\r\n\r\nAfter\r\n----------------------------------------\r\nAccess works\r\n\r\nTechnical Details\r\n----------------------------------------\r\nFix access to scheduled reminders form.\r\n\r\nThe current logic is that if the context is not event (empty) and the user does not\r\nhave administer CiviCRM they get bounced. if they pass that check they are then\r\npassed into the check that should only be applied when the context IS event. This results\r\nin a bounce for a user without any manage event access.\r\n\r\nComments\r\n----------------------------------------\r\nMost of the changes are tidy ups (2 distinct ones in separate commits). Actual change is the 3rd commit & on this line https://github.com/civicrm/civicrm-core/compare/master...eileenmcnaughton:sched?expand=1#diff-e179caac63281aad4b5df3aab2e370e2R73\r\n","created_at":"2018-02-28T02:21:54Z","updated_at":"2018-04-30T23:59:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a777ab96300e5bf44b1b8bdca4b1e3053d2badbf","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":246037889,"url":"https://api.github.com/repos/civicrm/civicrm-core/labels/master","name":"master","color":"0052cc","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733/commits","review_comments_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733/comments","review_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/11733/comments","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/12d546731dd101f69501cb8e3ceac9151f1b9784","head":{"label":"eileenmcnaughton:sched","ref":"sched","sha":"12d546731dd101f69501cb8e3ceac9151f1b9784","user":{"login":"eileenmcnaughton","id":336308,"avatar_url":"https://avatars2.githubusercontent.com/u/336308?v=4","gravatar_id":"","url":"https://api.github.com/users/eileenmcnaughton","html_url":"https://github.com/eileenmcnaughton","followers_url":"https://api.github.com/users/eileenmcnaughton/followers","following_url":"https://api.github.com/users/eileenmcnaughton/following{/other_user}","gists_url":"https://api.github.com/users/eileenmcnaughton/gists{/gist_id}","starred_url":"https://api.github.com/users/eileenmcnaughton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eileenmcnaughton/subscriptions","organizations_url":"https://api.github.com/users/eileenmcnaughton/orgs","repos_url":"https://api.github.com/users/eileenmcnaughton/repos","events_url":"https://api.github.com/users/eileenmcnaughton/events{/privacy}","received_events_url":"https://api.github.com/users/eileenmcnaughton/received_events","type":"User","site_admin":false},"repo":{"id":8567814,"name":"civicrm-core","full_name":"eileenmcnaughton/civicrm-core","owner":{"login":"eileenmcnaughton","id":336308,"avatar_url":"https://avatars2.githubusercontent.com/u/336308?v=4","gravatar_id":"","url":"https://api.github.com/users/eileenmcnaughton","html_url":"https://github.com/eileenmcnaughton","followers_url":"https://api.github.com/users/eileenmcnaughton/followers","following_url":"https://api.github.com/users/eileenmcnaughton/following{/other_user}","gists_url":"https://api.github.com/users/eileenmcnaughton/gists{/gist_id}","starred_url":"https://api.github.com/users/eileenmcnaughton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eileenmcnaughton/subscriptions","organizations_url":"https://api.github.com/users/eileenmcnaughton/orgs","repos_url":"https://api.github.com/users/eileenmcnaughton/repos","events_url":"https://api.github.com/users/eileenmcnaughton/events{/privacy}","received_events_url":"https://api.github.com/users/eileenmcnaughton/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eileenmcnaughton/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":true,"url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core","forks_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/forks","keys_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/teams","hooks_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/events","assignees_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/tags","blobs_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/subscription","commits_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/merges","archive_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/downloads","issues_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/releases{/id}","deployments_url":"https://api.github.com/repos/eileenmcnaughton/civicrm-core/deployments","created_at":"2013-03-04T23:49:52Z","updated_at":"2017-04-24T15:08:57Z","pushed_at":"2018-04-30T22:55:15Z","git_url":"git://github.com/eileenmcnaughton/civicrm-core.git","ssh_url":"git@github.com:eileenmcnaughton/civicrm-core.git","clone_url":"https://github.com/eileenmcnaughton/civicrm-core.git","svn_url":"https://github.com/eileenmcnaughton/civicrm-core","homepage":null,"size":201021,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":2,"open_issues":0,"watchers":2,"default_branch":"code_ideas"}},"base":{"label":"civicrm:master","ref":"master","sha":"4e991547de8ccf4aef81b4579521f4bb26022978","user":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"repo":{"id":8495499,"name":"civicrm-core","full_name":"civicrm/civicrm-core","owner":{"login":"civicrm","id":136373,"avatar_url":"https://avatars2.githubusercontent.com/u/136373?v=4","gravatar_id":"","url":"https://api.github.com/users/civicrm","html_url":"https://github.com/civicrm","followers_url":"https://api.github.com/users/civicrm/followers","following_url":"https://api.github.com/users/civicrm/following{/other_user}","gists_url":"https://api.github.com/users/civicrm/gists{/gist_id}","starred_url":"https://api.github.com/users/civicrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/civicrm/subscriptions","organizations_url":"https://api.github.com/users/civicrm/orgs","repos_url":"https://api.github.com/users/civicrm/repos","events_url":"https://api.github.com/users/civicrm/events{/privacy}","received_events_url":"https://api.github.com/users/civicrm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/civicrm/civicrm-core","description":"CiviCRM (Core Application and Framework)","fork":false,"url":"https://api.github.com/repos/civicrm/civicrm-core","forks_url":"https://api.github.com/repos/civicrm/civicrm-core/forks","keys_url":"https://api.github.com/repos/civicrm/civicrm-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/civicrm/civicrm-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/civicrm/civicrm-core/teams","hooks_url":"https://api.github.com/repos/civicrm/civicrm-core/hooks","issue_events_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/events{/number}","events_url":"https://api.github.com/repos/civicrm/civicrm-core/events","assignees_url":"https://api.github.com/repos/civicrm/civicrm-core/assignees{/user}","branches_url":"https://api.github.com/repos/civicrm/civicrm-core/branches{/branch}","tags_url":"https://api.github.com/repos/civicrm/civicrm-core/tags","blobs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/civicrm/civicrm-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/civicrm/civicrm-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/civicrm/civicrm-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/civicrm/civicrm-core/statuses/{sha}","languages_url":"https://api.github.com/repos/civicrm/civicrm-core/languages","stargazers_url":"https://api.github.com/repos/civicrm/civicrm-core/stargazers","contributors_url":"https://api.github.com/repos/civicrm/civicrm-core/contributors","subscribers_url":"https://api.github.com/repos/civicrm/civicrm-core/subscribers","subscription_url":"https://api.github.com/repos/civicrm/civicrm-core/subscription","commits_url":"https://api.github.com/repos/civicrm/civicrm-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/civicrm/civicrm-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/civicrm/civicrm-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/civicrm/civicrm-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/civicrm/civicrm-core/contents/{+path}","compare_url":"https://api.github.com/repos/civicrm/civicrm-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/civicrm/civicrm-core/merges","archive_url":"https://api.github.com/repos/civicrm/civicrm-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/civicrm/civicrm-core/downloads","issues_url":"https://api.github.com/repos/civicrm/civicrm-core/issues{/number}","pulls_url":"https://api.github.com/repos/civicrm/civicrm-core/pulls{/number}","milestones_url":"https://api.github.com/repos/civicrm/civicrm-core/milestones{/number}","notifications_url":"https://api.github.com/repos/civicrm/civicrm-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/civicrm/civicrm-core/labels{/name}","releases_url":"https://api.github.com/repos/civicrm/civicrm-core/releases{/id}","deployments_url":"https://api.github.com/repos/civicrm/civicrm-core/deployments","created_at":"2013-03-01T06:11:56Z","updated_at":"2018-04-30T23:26:54Z","pushed_at":"2018-04-30T23:26:30Z","git_url":"git://github.com/civicrm/civicrm-core.git","ssh_url":"git@github.com:civicrm/civicrm-core.git","clone_url":"https://github.com/civicrm/civicrm-core.git","svn_url":"https://github.com/civicrm/civicrm-core","homepage":null,"size":160585,"stargazers_count":269,"watchers_count":269,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":625,"mirror_url":null,"archived":false,"open_issues_count":168,"license":null,"forks":625,"open_issues":168,"watchers":269,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733"},"html":{"href":"https://github.com/civicrm/civicrm-core/pull/11733"},"issue":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/11733"},"comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/issues/11733/comments"},"review_comments":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733/comments"},"review_comment":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/civicrm/civicrm-core/pulls/11733/commits"},"statuses":{"href":"https://api.github.com/repos/civicrm/civicrm-core/statuses/12d546731dd101f69501cb8e3ceac9151f1b9784"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"eileenmcnaughton"}}