Forum

Thread tagged as: Problem

Example auth plugin gives missing Collections and Routes nav items

Hi, I've followed the instructions at https://docs.grabaperch.com/api/auth/ for an authentication plugin, and have the code the same as on this page.

I can use the Perch admin without logging in, but the Collections, Routes and Users navigation items are missing. I tried the email addresses as one of the registered admins but get the same result. Is this intended?

Thanks

Dave C

Dave C 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Does the role you're logging in as have permission to access those?

Users obviously doesn't apply if you're managing the logins.

Dave C

Dave C 0 points

I think so -I've got 'role' => 'admin' and the email address as an admin account. When I log in with this email address normally I get the Collections and Routes nav items.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, I'll check what's happening.

Dave C

Dave C 0 points

Drew McLellan said:

Ok, I'll check what's happening.

Cool thanks. Were you able to recreate this?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I've not had the chance yet, but I'll see if I can look at it today.

Dave C

Dave C 0 points

No worries, thanks.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, found and fixed. There's a bug with how the special 'admin' role's privileges are escalated when using an auth plugin.

The workaround for the time being is to create a role with all privileges assigned, rather than relying on the admin role.

This is fixed for Perch/Runway 3.

Dave C

Dave C 0 points

I've created a role called loggedin and assigned it all privileges, and used it for the value of role in auth.php -in both log_user_in() and resume_session(), but I still get the same UI as I had when using the admin role.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you see privileges for those items in the control panel?

Dave C

Dave C 0 points

Oh yes I forgot to mention -I don't see any options relating to collections (or routes) in the Roles page, but do see checkboxes for System, Assets, Categories and Pages. In case helpful, I do see a FROM perch2_gacdcollections query in the debug message section.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is gacdcollections a custom app?

Dave C

Dave C 0 points

Must be just the test collection I created.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Collections don't have their own tables, so that doesn't seem likely.

Dave C

Dave C 0 points

Oh right. Under the Apps menu there's "Categories" and the name of the collection I created. I've not installed/made any custom apps.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, that sounds odd. I don't think it's related. It sounds like you're missing some privileges in your database.

Was this a clean install of 2.8.34 or an update from an earlier version?

Dave C

Dave C 0 points

Perch Runway 2.8.34, fresh install. I didn't run the usual setup, rather my colleague made a very simple site, and a user account for me, and dumped the DB. He committed the whole site folder to source control, including the dump, so my DB is made from the dump. Might that make any difference?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, that shouldn't make any difference. I'll take a look into it. It may be that the best option is to wait for Runway 3.

Dave C

Dave C 0 points

Okay thanks. I'm sure you get asked this every five mins, but what kind of time scale for release of v3?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Very soon - so much so that I'm fixing bugs in v3 not v2 right now.

Dave C

Dave C 0 points

Cool :)