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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Access Denied for editing contact
Pages: [1]

Author Topic: Access Denied for editing contact  (Read 492 times)

cfusch

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 4.6.6
  • CMS version: Drupal 7.39
  • MySQL version: 5.6.23
  • PHP version: 5.4.38
Access Denied for editing contact
October 28, 2014, 08:29:39 am
This is a Drupal Website and I am the Drupal admin.  I'm getting an access denied when I try to "edit" contact information from an individual on any contact list.  Here's my process:

* Get a list of contacts via simply pressing enter in the blank search field (upper left) OR by doing an Advanced Search (probably getting the list using any method.
* Clicking on "Edit" at the far right side of an of the contacts on the list results in getting a page that reads, " Access denied. You are not authorized to access this page."
* However, if I click on the contact's name (not "edit"), I get a page for editing the contact.

See the two attached images.

Why am I getting an "Access Denied" when I'm admin??

Carl


JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Access Denied for editing contact
October 28, 2014, 08:53:57 am
Your screenshots don't all include URLs - but from the URLs I can see, I think I see the issue.

In that first screenshot, you're on "navysailing.org" - but the link you're hovering over is a link to "www.navysailing.org".  In Drupal, logging in on mysite.org does NOT log you in on www.mysite.org.

There's a number of ways to handle this - it could be a matter of mismatched base URLs between Drupal/Civi, or a number of other issues - in my experience, the best way to make sure this never happens is to edit Drupal's settings.php in the section that allows you to redirect all non-www URLS to www or vice versa.
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

cfusch

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 4.6.6
  • CMS version: Drupal 7.39
  • MySQL version: 5.6.23
  • PHP version: 5.4.38
Re: Access Denied for editing contact
October 28, 2014, 09:05:28 am
Hi, Jon!

Thanks! That might well be the problem given that I just moved from my home development server to the live site.  I thought all  of the URLs had been adjusted, but I will take another look.

Carl

cfusch

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 4.6.6
  • CMS version: Drupal 7.39
  • MySQL version: 5.6.23
  • PHP version: 5.4.38
Re: Access Denied for editing contact
October 28, 2014, 09:52:20 am
Huh! That was pretty good, Jon! 

I learn something new everyday! :-)

This has a twist that's worth mentioning.

First, I tried inputting www.navysailing.org directly into the browser URL field. And everything worked as it should have, i.e. the browser held the address as www.navysailing.org all the time.

Next I went to the settings.php and searched for 'redirect'.  On my setttings.php that was around 400, but I have some views crud in there, so searching for "redirect" brought me to this slug of code:

Code: [Select]
/**
 * Drupal automatically generates a unique session cookie name for each site
 * based on its full domain name. If you have multiple domains pointing at the
 * same Drupal site, you can either redirect them all to a single domain (see
 * comment in .htaccess), or uncomment the line below and specify their shared
 * base domain. Doing so assures that users remain logged in as they cross
 * between your various domains. Make sure to always start the $cookie_domain
 * with a leading dot, as per RFC 2109.
 */
# $cookie_domain = '.example.com';


I un-commented the "$cookie_domain = '.example.com'; and replaced it with $cookie_domain = '.navysailing.org'

That didn't work ... so I replaced it with
$cookie_domain = 'www.navysailing.org'

That didn't work.

Sooooooooo .... I went to the .htaccess and fixed it by uncommenting the redirect to a non-www to a www. (around line 85ish)

That fixed the problem, BUT I don't like making these kind of changes to the .htaccess, because of the upgrades will trample on .htaccess thus eliminating the fix.  I don't like having to remember to deal with that upon  upgrade.

So, looking at my settings.php change to the $cookie_domain ... could I have made a mistake interpreting the the directions to fix the problem in the settings.php????  (which I much prefer to changing the .htaccess).

Sorry for the verbosity!  :-[

Carl

JonGold

  • Ask me questions
  • ****
  • Posts: 638
  • Karma: 81
    • Palante Technology
  • CiviCRM version: 4.1 to the latest
  • CMS version: Drupal 6-7, Wordpress 4.0+
  • PHP version: PHP 5.3-5.5
Re: Access Denied for editing contact
October 28, 2014, 10:04:29 am
Hi Carl,

No, you're right - I meant .htaccess.  You can always move those settings to your Apache config to avoid Drupal overwriting them on update!
Sign up to StackExchange and get free expert CiviCRM advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

cfusch

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 4.6.6
  • CMS version: Drupal 7.39
  • MySQL version: 5.6.23
  • PHP version: 5.4.38
Re: Access Denied for editing contact
October 28, 2014, 10:32:45 am
Jon!

You 'Da Man!

Thanks for the quick responses. This has quickly solved what could have been a really nasty problem!

Onward!

Carl

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Access Denied for editing contact

This forum was archived on 2017-11-26.