403 error when trying to edit the defaults of a Page Type

Permalink
I'm new to 5.7 but not concrete5. I am putting my first 5.7 site together and so far have had no major problems. I am now trying to set up the defaults for a couple of Page Types, but every time I click 'Edit Defaults' on any Page Type, I get a 403 Error: You are not allowed to access this page.

The 'Edit Defaults' button link looks correct e.g. domain-name/index.php/dashboard/pages/types/output/edit_defaults/27/33. Page Type 27 exists in the db and is indeed the one I am trying to edit. Page Template 33 exists in the db and is the correct one. The URL I see when I get this particular 403 is: domain-name/?cID=1305

Page 1305 in the database has the following data (null or zero fields ignored):
cID: 1305
ptID: 27
cIsTemplate: 1
cOverrideTemplatePermissions: 1
cInheritPermissionsFromCID: 1305
cInheritPermissionsFrom: OVERRIDE
cIsActive: 1
cCacheFullPageContent: -1

The 403 is clearly being generated at application level yet I am the admin/original user. I have added the Administrators group to my admin account just to be sure. I have added Administrators to every permission for the Page Type. I have logged out and back in again. I have another c5 deployment on the same server, with the default c5 sample content, and I *can* edit the Page Type defaults, so this is not a server environment issue. I have compared the Pages table entry for one of the target pages in the second deployment and it seems very similar to the data listed above (with different IDs of course).

Can anyone think of anything I have overlooked please?

# concrete5 Version
Core Version - 5.7.5.8
Version Installed - 5.7.5.8
Database Version - 20160412000000

# concrete5 Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache/2.4.6 (CentOS)

# Server API
apache2handler

# PHP Version
5.6.23

 
losttheplot replied on at Permalink Reply
After spending hours on this snag I noticed that occasionally I could edit a Page Type's defaults repeatedly (instead of getting a 403), but then when I changed something, I got the 403 again. I poured through the database tables, comparing table after table across two deployments (one with the problem and one without), tracking IDs and noting the recorded data. I changed setting after setting; changed permissions on everything possible to change permissions on; created new templates and page types; tested, recorded, analysed. I thought I was going mad. Nothing made sense.

Then I finally noticed a pattern of sorts ...Hallelujah! If I click the 'Output' button, then the 'Edit Defaults' button, the first time I will always get a 403 error. But if I go Back in the browser and click the 'Edit Defaults' button again, it sometimes shows me the template for editing. If not on the first repeat, then on the second or third, but never the first time. So it's an intermittent snag.

Does this ring a bell with anyone? Any ideas what could cause an intermittent snag like this that is not server/hardware related?
losttheplot replied on at Permalink Reply
Upon further investigation within the database, I noticed that all foreign key references to a Page Type that I had previously deleted, were still in their respective tables. In other words, the Page Type delete action does not clean up secondary references to the deleted page.

In order to try and clean up the data for this site, I carried out the following actions to remove all orphaned data records:

1. Deleted all pages that were not of the type 'page' (the default page type).
2. Noted all page type ptID numbers.
3. Deleted all Page Types except basic 'page' - confirmed all gone from PageTypes table.
4. Deleted all template pages from the Pages table relating to the deleted ptID numbers.
5. Ensured that all remaining pages with a ptID only reference the basic 'page' page type.
6. Deleted all records from PageTypePageTemplateDefaultPages table relating to the above.
7. Deleted all records from PageTypePermissionAssignments table relating to the above.
8. Recreated required Page Types e.g. blog, blog_entry, store_product etc.

Since doing all of this, I occasionally still get a 403 error, but whereas this was previously more often than not, it is now very rarely, which means that I can get on with building websites now.