-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-20441 Fix issue where multiple activity Ids were not supported wh… #10212
Conversation
…en check permissions was used
@davejenx @eileenmcnaughton @monishdeb Hey Folks i'm 99% sure this will fix the breakage Dave found. Dave are you able to test this? |
Looks good - thanks! |
just pasting here from Mattermost: @JohnFF "@seamuslee looks good" |
@seamuslee001 Just tested the current 4.7.19-rc branch and I now get a different fatal error on contact view as an ACL'd user with just "access CiviCRM" + ACL view for one group. Backtrace: |
So first off that makes some sort of sense to a degree as its probably trying to get a count of the number of activities
In that respect i believe that this is a new issue rather than the same issue as CRM-20441 as CRM-20441 was dealing with the problem where the check was failing as it couldn't interpret multiple ids. Here it is handling that and failing This is the function which is killing things for you https://github.com/civicrm/civicrm-core/blob/master/CRM/Activity/BAO/Activity.php#L2084 |
@colemanw Coleman Can you please comment on Dave's latest error as to what we should do, It appears it is correctly checking permissions now but that check is failing |
$ids = array(); | ||
if (is_array($params['id'])) { | ||
foreach ($params['id'] as $operator => $values) { | ||
if (in_array($operator, CRM_Core_DAO::acceptedSQLOperators())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could result in permission escalation if the operator is not "IN". E.g. passing 'id' => array('NOT IN' => 123)
would let you see all activities if you have access to view 123.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@colemanw should we limit it to just IN for the moment or include Like as well?
I think let's play it safe and stick with IN.
…On 04/24/2017 07:08 PM, Seamus Lee wrote:
***@***.**** commented on this pull request.
------------------------------------------------------------------------
In api/v3/Activity.php
<#10212 (comment)>:
> @@ -304,11 +304,23 @@ function civicrm_api3_activity_get($params) {
"Cannot access activities. Required permission: 'view all activities''"
);
}
-
- if (!CRM_Activity_BAO_Activity::checkPermission($params['id'], CRM_Core_Action::VIEW)) {
- throw new \Civi\API\Exception\UnauthorizedException(
- 'You do not have permission to view this activity'
- );
+ $ids = array();
+ if (is_array($params['id'])) {
+ foreach ($params['id'] as $operator => $values) {
+ if (in_array($operator, CRM_Core_DAO::acceptedSQLOperators())) {
@colemanw <https://github.com/colemanw> should we limit it to just IN
for the moment or include Like as well?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10212 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACveIKW-lby7Zs-HjAyOtnEr0iyrizmOks5rzStWgaJpZM4NE47U>.
|
…en check permissions was used