1

I have a weird problem with my new Drupal 7 site. This is also my first Drupal site.

  • I have now two users: admin1 (has admin rights) & user1
  • at first, when I logged with admin1, everything was fine
  • when I logged in as user1, on the hovering admin panel it says that the logged in user is admin1, and this user has admin rights although they don't show on the DB. If content is added by user1, the creator is admin1
  • I added user2 with no admin rights. Everything went fine until I logged out user2: now the admin1 do not seem to have admin rights anymore but the user2 has them
  • I tried to disable nginx caching and it seems that it's off, but the problem still remains
  • Earlier, my site was on LAMP-stack without problems. At least not similar to this. Apache needs too much memory so I switched to LEMP-stack, and this problem arised. So, I assume the problem is somewhere on my nginx-configuration.
  • All this time, on the database, only admin1 actually have the admin rights

I am using the 7.34 core but the same problem existed with 7.33 as well. The site is hosted on DigitalOcean on a server using Ubuntu 14.04 x64. The webserver is nginx 1.4.6-1ubuntu3.1

  • This problem may be related to your cache configuration. Start from disabling all cache in your nginx/varnish/boost/whatever! – kalabro Nov 22 '14 at 8:41
  • Hmm... It seems that setting nginx expires to -1 solved the problem. Well that was easy! :D Thank you very mcuh! – jubakala Nov 22 '14 at 8:53
  • Weekend reading: github.com/perusio/drupal-with-nginx – kalabro Nov 22 '14 at 9:25
  • Sorry, I was wrong, the problem seems to still exists... – jubakala Nov 22 '14 at 9:51
  • The problem is in your web server/proxy configuration, not it Drupal. – kalabro Nov 23 '14 at 10:40
0

@kalabro Actually, it was Drupal problem, but in my own code, not in the core or some module. As a Drupal newbie, I had used "global $user" at a template file to show the current logged in user's username on the menubar... When I removed this, problem was solved.

| improve this answer | |
-1

As a workaround, you could use the Auto Assign Role module.

| improve this answer | |
  • The admin role is not actually granted for other users while registering. If I check from the DB, only the admin has the admin rights, so the rights are granted correctly. It is probably a cache issue with nginx as kalabro said, but more complicated than I first thought. At first, I used Apache, but it ate all the memory (512MB) so I switched to nginx. Maybe I revert back to Apache or try lighthttpd, since the nginx configuration seems to complicated. – jubakala Nov 22 '14 at 12:38
  • It is not clear how this module would help the OP, who is saying that logging in as user1 shows admin1 as username in some places of the UI. – kiamlaluno Nov 22 '14 at 13:00
-1

This issue is only because other users of your Drupal 7 site will have same permissions as the administrator is assigned with.

See the values stored in role and role_permission tables in your Drupal database.

Check if the rid value is assigned with similar permission values in the role_permission table.[Also take care of the module field if many exist]

If so, this would be because of the reason that the users' roles are created with extra permissions other than:

access content
post comments
skip comment approval
use text format

-which are the default permissions assigned to the authenticated user.

All you can do now is either manually edit the table values[not suggested by the community] or use a module to update the user permissions for each roles.

Thank you.

| improve this answer | |
  • No, this is not the problem. Only the user which was created while installation has the admin rights, as it should. The problem is not that other users would have the admin rights, but that it seems so, and that even though I login with user1 account with no admin rights, the logged in user is switched to the admin-user. But now it also happened so that after I added a new user, user2 for test purposes, when I login as admin, it doesn't have the admin rights, at least not on the app itself, and it is then switched to the user2 which seems then to have admin rights. So it is really weird. – jubakala Nov 22 '14 at 17:25
  • Do you have only the basic roles[authenticated user and administrator] for your site? Or have you defined any other user roles? – Ataboy Josef Nov 23 '14 at 12:24
  • Yes, basic roles only. I haven't added any other roles. – jubakala Nov 24 '14 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.