CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink
Pages: [1]

Author Topic: Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink  (Read 1759 times)

supporters

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink
January 13, 2011, 04:18:06 pm
I can't figure out why the contact hyperlinks in the dashlet report
go to an access denied page for the user yet she can click on the
contact hyperlinks in a search results page and fully view the info which is what we want.

A dashlet was added to a users dashboard based on a custom report (template - constituent summary).  The report basically just consists of the contact name, email and phone number of all contacts filtered by group membership (a CiviCRM contact group we setup called "board members").  This user is setup in drupal and CiviCRM to have access to CiviCRM, and the ability to edit all contacts...most permissions except Delete and Administer.  But, when the user clicks on a contact's name (hyperlinked) in the dashlet report to access the contact's profile, they get an ACCESS DENIED with a URL:

https://www.ourdomain.com/civicrm/report/instance/2?reset=1&force=1&id_op=eq&id_value=203

And yet, this user has permissions and can pull up (view and edit) all the contact info when clicking on a contact from the contact name hyperlinks listed in the results of a search without issue.

We do have a permissions qualifier on the CiviCRM report settings for the aforementioned custom, template-based report whereby user must have permissions to:
a) access CiviCRM and
b) edit contacts  [matches the assigned CiviCRM permissions of the users role/group in Drupal configuration]

supporters

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink
January 13, 2011, 06:55:09 pm
Interestingly, I see now that when I tried this with a user account with 'administer CiviCRM' permissions, if the user clicks on a contact's name hyperlink from the aforementioned report dashlet, it's not bringing up the contact profile but actually brings up a Constituent Report (Detail), for which if the user then clicks on the contact's name hyperlink, it goes to the (desired) contact profile page.  I'm not sure at this point why it goes to the Constituent Report (Detail) rather than simply to the contact profile page, maybe we can change that in code somewhere (or GUI interface in future versions).

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink
January 14, 2011, 09:00:01 pm
Quote
if the user clicks on a contact's name hyperlink from the aforementioned report dashlet, it's not bringing up the contact profile but actually brings up a Constituent Report (Detail), for which if the user then clicks on the contact's name hyperlink, it goes to the (desired) contact profile page.
Contact link on report/instance Constituent Report( Summary ) redirected the Contact Report ( details), to view the contact details ( specified in that report ) of that contact.
You can change this behavior by modifying this link in the function alterRow( ) of report CRM/Report/Form/Contact/Summary. php ( Constituent summary report ).

Regarding access denied problem, can u check the permission for report https://www.ourdomain.com/civicrm/report/instance/2?reset=1, user should have that permission to access the report.

Rajan

supporters

  • I’m new here
  • *
  • Posts: 15
  • Karma: 0
Re: Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink
January 15, 2011, 12:04:07 pm
Wow, thank you!
Access denied issue resolved!

Regarding which report the link should go to...   
here's code excerpted from SUMMARY.PHP

    function alterDisplay( &$rows ) {
        // custom code to alter rows
        $entryFound = false;
        foreach ( $rows as $rowNum => $row ) {
            // make count columns point to detail report
            // convert display name to links
            if ( array_key_exists('civicrm_contact_display_name', $row) &&
                 array_key_exists('civicrm_contact_id', $row) ) {
                $url = CRM_Report_Utils_Report::getNextUrl( 'contact/detail',
                                              'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
                                              $this->_absoluteUrl, $this->_id );
                $rows[$rowNum]['civicrm_contact_display_name_link' ] = $url;
                $rows[$rowNum]['civicrm_contact_display_name_hover'] = ts("View Contact details for this contact.");
                $entryFound = true;
            }

LOOKING AT THIS CODE, I DONT SEE AN ALTERROW()
per se, but it looks like we need to replace:

   $url = CRM_Report_Utils_Report::getNextUrl( 'contact/detail', ...

   with something that will take the user to:

      https://www.ourdomain.com/civicrm/contact/view?cid=[the right id here]

      rather than that contact detail form at:

         https://www.ourdomain.com/civicrm/report/instance/2?cid=[the right id here]

Again, any help appreciated

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink
January 15, 2011, 02:10:49 pm
You're on the right track. The replacement url will be something like this (copied from Contact Detail Report - Detail.php):
                $url = CRM_Utils_System::url( "civicrm/contact/view", 
                                              'reset=1&cid=' . $row['civicrm_contact_id'],
                                              $this->_absoluteUrl );
Protect your investment in CiviCRM by  becoming a Member!

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink
January 15, 2011, 09:42:03 pm
Yaa .. its should be function alterDisplay( $rows), typo mistake  ;) .
Parameter $rows contains the all field values,  $row['civicrm_contact_id'] will be the contact id.
As Dave Greenberg  told above, you can easily modify the link.

Rajan



Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Reports + Dashlets telling user ACCESS DENIED if click on contact hyperlink

This forum was archived on 2017-11-26.