Authentication fails for staff user without super user status

227 views
Skip to first unread message

usha nattala

unread,
Jul 30, 2015, 3:21:52 AM7/30/15
to Mezzanine Users
Hi,

I recently got up a mezzanine 4.0.0 site and I just created a staff user without super user permissions. But this particular account is unable to login to either the admin or site interface. I get the error message 'You don't have permission to access the admin for this site'. I even tried adding all the available user permissions (leaving the superuser status unchecked) to a test staff account just to be sure but the the test staff account couldn't log in either. All the custom models are registered and the auth is not customized in any way.
The normal admin account with super user permissions can log in normally without problems.
What could the problem be, please?

Thanks in advance,
Usha 

Ryne Everett

unread,
Jul 30, 2015, 4:49:54 AM7/30/15
to Mezzanine Users, usha.n...@gmail.com
I just encountered the same issue and found Stephen's hint useful: https://github.com/stephenmcd/mezzanine/issues/1366#issuecomment-126171667
Message has been deleted

usha nattala

unread,
Jul 30, 2015, 5:18:26 AM7/30/15
to Mezzanine Users, usha.n...@gmail.com
Hi Ryne,
Thanks for your prompt reply. But I'm all on local host with http://127.0.0.1:8000. What would I need to do in this case?
Thanks,
Usha
Message has been deleted

usha nattala

unread,
Jul 30, 2015, 5:40:44 AM7/30/15
to Mezzanine Users, usha.n...@gmail.com
If it helps, I started out in Mezzanine 3.1.10 and then upgraded to 4.0.0 a few days after it was released.

Ryne Everett

unread,
Jul 30, 2015, 8:38:26 PM7/30/15
to Mezzanine Users, usha.n...@gmail.com
How are you deploying? Are you using the recommended project template? Or is this problem occurring in local development?

usha nattala

unread,
Jul 30, 2015, 9:37:28 PM7/30/15
to Mezzanine Users, usha.n...@gmail.com
Hi Ryne,
It's just local development for now. I'm planning to deploy to a server if all goes well.
Thanks,
Usha

Ryne Everett

unread,
Jul 30, 2015, 9:41:34 PM7/30/15
to mezzani...@googlegroups.com, usha.n...@gmail.com
Are you developing in a VM? Also how are you running it? `python manage.py runserver`?

--
You received this message because you are subscribed to a topic in the Google Groups "Mezzanine Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mezzanine-users/RSoPDeDrnaw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

usha nattala

unread,
Jul 30, 2015, 11:19:09 PM7/30/15
to Mezzanine Users, usha.n...@gmail.com
Hi Ryne,
No VM yet but I'm interested in running it on a vm eventually. For now yes, it's simple 'python manage.py runserver' on my local machine.
Thanks,
Usha

Ryne Everett

unread,
Jul 30, 2015, 11:50:36 PM7/30/15
to mezzani...@googlegroups.com, usha.n...@gmail.com
Hmm. Sorry usha, but it isn't clear to me what the problem might be under those circumstances. That said, here are some values I would try inputting to Site Permissions:

localhost:8000
Whatever is returned by typing `hostname` into a terminal.

If none of those works, I would "shell in" with `python manage.py shell` to see if any SitePermission objects were created:

>>> from mezzanine.core.models import SitePermission
>>> SitePermission.objects.count()

Also, what operating system are you using?

--

usha nattala

unread,
Aug 2, 2015, 10:26:27 PM8/2/15
to Mezzanine Users, usha.n...@gmail.com, rynee...@gmail.com
Hi Ryne,

There were 0 SitePermission objects. I finally ended up adding a couple of entries to core_sitepermission and core_sitepermission_sites and now my staff user login works as it should.
insert into core_sitepermission(id,user_id) values(1,4);
insert into core_sitepermission_sites(id,sitepermission_id,site_id) values(1,1,1);

I'm on Ubuntu btw.

Thanks for the tip off, it really helped!

Thanks,
Usha

Ryne Everett

unread,
Aug 2, 2015, 10:54:48 PM8/2/15
to usha nattala, Mezzanine Users
Great! Btw, I'm guessing you'll be able to grant permissions through the admin interface from now on, now that the SitePermissions object actually exists.

usha nattala

unread,
Aug 3, 2015, 2:00:48 AM8/3/15
to Mezzanine Users
Yup, I can grant permissions to pages etc from the admin but I have to add lines to those two tables every time I make a new user.

usha nattala

unread,
Aug 3, 2015, 2:01:26 AM8/3/15
to Mezzanine Users
New non-super staff user I mean

Mahdi Bornazadeh

unread,
Sep 19, 2015, 3:47:54 AM9/19/15
to Mezzanine Users
 i had this issue in ubuntu 14.04 and with both python 2.x and 3.x.

all of this is because when creating new user in mezzanine,
(specially first user with createdb management command which is admin user)
sitepermission of the user dose not add automatically.

so when create new project log in to admin and  edit admin user and select the only available site "127.0.0.1:8000" in sitepermission and save.

so SitePermission.objects.count() equals1

do this procedure for every other staff  user.
and if there are two sitepermission inline,
only selecting the first one solve the issue.


Reply all
Reply to author
Forward
0 new messages