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 Profiles (Moderator: Dave Greenberg) »
  • User cannot edit organisation profile with custom fields
Pages: [1]

Author Topic: User cannot edit organisation profile with custom fields  (Read 1358 times)

DylanSale

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
User cannot edit organisation profile with custom fields
June 27, 2010, 11:51:52 pm
Hi,
I am new to Civicrm and Joomla, and have been setting up a system. The basic premise is that there are individuals and organisations, and some organisations are also service providers. Some individuals are the primary contact for their company. I have setup the relations so that those individuals can edit their employers and this all works (they log in using civiuser then can access their dashboard and edit the company details from there).

I have setup custom fields for the service provider information and imported the data for those. I then added these organisations to a service provider group. I then set up a profile so that the users can edit their company's service provider details. The profile only lists organisations in the Service Provider group.

The issue I am having is that users (who can all edit their company details) cant edit the profile with custom fields. I have made all the fields editable (ie not view only), and Public in the Custom Data and Profile.

In order to allow the user to edit the profile I hacked the dashboard to add a link to edit the custom data profile (as described http://forum.civicrm.org/index.php?topic=5699.0 ). Clicking the link redirects me to the root of the website and when I click to go back to the dashboard it says "You do not have permission to edit this contact record. Contact the site administrator if you need assistance."

Like I said, I do have permission (through the relationship) because I can edit the company using the default edit link on the dashboard.

I think the problem is that
Code: [Select]
       CRM_Contact_BAO_Contact_Utils::validChecksum( $contactID,
                                                              CRM_Utils_Request::retrieve( 'cs', 'String' , $form, false ) )
is returning false in Contact/BAO/Contact/Permission.php:224. I have no idea what this line is doing or why its failing.

Is this a bug, or have I misconfigured something? How can I check?
(I am using 3.1.5 stable release with Joomla)


EDIT:
I changed
Profile/Form/Edit.php:91 to
Code: [Select]
                //if ( $config->userFrameworkFrontend ) {
                //    CRM_Contact_BAO_Contact_Permission::validateOnlyChecksum( $id, $this );
                //} else {
                    CRM_Contact_BAO_Contact_Permission::validateChecksumContact( $id, $this );
                //}
(ie, commented out all the lines except the validateChecksumContact one)
and it seems to work now. Is this a bad thing security-wise?
« Last Edit: June 28, 2010, 12:23:58 am by DylanSale »

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: User cannot edit organisation profile with custom fields
June 28, 2010, 12:33:52 am
Never used joomla, but assuming that's mostly the same as drupal:
Can the admin access the profile and it works ?

Assuming yes, you should check more access rights of the users:
- Do they have the permission to use profile ?
- Do the have the right to access custom fields ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: User cannot edit organisation profile with custom fields
June 28, 2010, 01:12:57 am
The problem about Individuals not being able to edit custom data for an Org they have permissioned relationships have tripped up a few projects -and afaik is still not resolved. Solutions do exist eg search for 'stoobs solution' or else you need to make some more progress with building a hook to do this. Search the forums a bit more and you will probably come across the discussions on this.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

DylanSale

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
Re: User cannot edit organisation profile with custom fields
June 28, 2010, 04:19:19 pm
Hi thanks for the replies.
Xavier:
The users aren't joomla ones, I am using civiuser (and civilogin I think, I didnt set this part up) to do authentication. I cant see how I would give the users permission to access the profile though. The admin can access/edit the profile from the admin panel (but it doesnt work through the front end forms).

As I said before, I am pretty sure I have set up the custom fields to be accessible by other users. I set them to public and not "visible only" where I could.

Peterd:
I did a search for these things before posting, and found a post about stoob's solution, but the link they posted seems to be broken so I couldn't understand what they were discussing. Perhaps I missed something, I'll keep looking.

As I mentioned, commenting out the above code allows users to edit the profiles. From what I can see the second function call there "validateChecksumContact" checks to see if a Relationship exists that allows the user to edit the organisation (which it does), so the check passes. The function "validateOnlyChecksum" does not make this check, and is failing for some reason (related to the checksum I assume). I will leave it like this for now because I cant see any security issues doing it this way (if the relationship does not allow editing, the "validateChecksumContact" function falls back to the "validateOnlyChecksum" anyway from what I can see).

jimmyjam

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 4
Re: User cannot edit organisation profile with custom fields
July 01, 2010, 12:06:43 pm
I need to allow my users to edit custom org data.   Which approach is easiest to implement? I'm not a coder.

1) Dylan's solution (described above)

2) ToddW's solution described here:
http://forum.civicrm.org/index.php/topic,12839.0.html

3) Stoob's solution

4) another solution

Thanks,
James

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: User cannot edit organisation profile with custom fields
July 01, 2010, 09:27:55 pm

i think all the proposed solutions require some code modification

this has come up a few times before, so it would be great if a general solution was built that other folks can use. If you have the money, funding  a developer to do that would be awesome. generalizing it would probably take 30-50 hours, IMO

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

jimmyjam

  • I post occasionally
  • **
  • Posts: 87
  • Karma: 4
Re: User cannot edit organisation profile with custom fields
July 02, 2010, 05:02:17 am
I have a client breathing down my neck to implement a custom solution asap, and can afford to pay someone $500 to do the work. Not enough to build a general solution, unfortunately. Is there a way to team up with others and pool our resources?

Thanks,
James

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: User cannot edit organisation profile with custom fields
July 02, 2010, 07:15:11 am
see: http://forum.civicrm.org/index.php/topic,13750.msg61590.html#msg61590
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • User cannot edit organisation profile with custom fields

This forum was archived on 2017-11-26.