Skip to content

Commit

Permalink
[REF] Fix permission check for system workflow message created
Browse files Browse the repository at this point in the history
  • Loading branch information
seamuslee001 committed Mar 16, 2020
1 parent 2f5ca90 commit 66d7129
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions CRM/Core/BAO/MessageTemplate.php
Expand Up @@ -85,8 +85,10 @@ public static function add(&$params) {
}
}
else {
if (!empty($params['workflow_id']) && !CRM_Core_Permission::check('edit system workflow message templates')) {
throw new \Civi\API\Exception\UnauthorizedException(ts('%1', [1 => $systemWorkflowPermissionDeniedMessage]));
if (!empty($params['workflow_id'])) {
if (!CRM_Core_Permission::check('edit system workflow message templates')) {
throw new \Civi\API\Exception\UnauthorizedException(ts('%1', [1 => $systemWorkflowPermissionDeniedMessage]));
}
}
elseif (!CRM_Core_Permission::check('edit user-driven message templates')) {
throw new \Civi\API\Exception\UnauthorizedException(ts('%1', [1 => $userWorkflowPermissionDeniedMessage]));
Expand Down

0 comments on commit 66d7129

Please sign in to comment.