CRM-17310 Add my reports functionality
[civicrm-core.git] / CRM / Core / BAO / Navigation.php
index 08c345ef2529f3a15c03e24923ce137a9c07b0f3..ed189576a24d5ce3d8b9c8195609971e9da424e6 100644 (file)
@@ -604,6 +604,13 @@ ORDER BY parent_id, weight";
             return $showItem;
           }
         }
+        // CRM-17310 my reports allow people with access own reports to see the report if it is theirs.
+        elseif ($key == 'access own private reports') {
+          // Special permission processing for private reports.
+          $report_url = parse_url(ltrim($url, '/'));
+          $instance_id = CRM_Report_Utils_Report::getInstanceID($report_url['path']);
+          $hasPermission = $showItem = CRM_Report_BAO_ReportInstance::contactIsOwner($instance_id);
+        }
         else {
           $hasPermission = TRUE;
         }