I updated from PS 1.6 to 1.7.5 and I am experiencing the "Access denied" error for SuperAdmin as described here:
https://github.com/PrestaShop/PrestaShop/issues/9513
https://www.prestashop.com/forums/topic/876786-solved-prestashop-17-access-denied-as-admin-in-bo/
https://www.prestashop.com/forums/topic/600537-ps-17-access-denied-in-design-pages-as-superadmin/
https://www.prestashop.com/forums/topic/901131-access-denied-in-design-pages-as-superadmin/
However these solutions refer to PS 1.7.4 or earlier or are just partial solutions.
Which "id_authorization_role" numbers (or rather the range) do I have to set for "id_profile" = 1 (SuperAdmin) in the _access table for prestashop version 1.7.5 to grant the SuperAdmin all the required authorizations he is supposed to have?
Thanks!
Additional information
PrestaShop version: 1.7.5.0
PHP version: 7.2.13
Screenshots of some errors I am experiencing:
Hi @Goalfair,
For the access denied page => you need to remove 'ps_access' table and restore 'ps_access' from 'clean' DB to solve your issue.
About the "Clear cache" issue, it is a permission issue => you need to change the file permissions of all directories to 777.
You can navigate to your BO => Advanced Parameters => Information => Check your configuration => Required parameters: OK/NOK.
Thanks to check & feedback.
Thanks, I was hoping someone would know (also for the benefit of others reading this) what to add/change to the _access table, because otherwise I now have to set up an entire new instance of prestashop 1.7.5 just for the purpose of taking the one table I need.
I read about folder/file permissions and it seems 777 is not recommended for security reasons?
Advanced Parameters => Information is telling me that everything is okay.
@Goalfair, thanks for your feedback, could you please try to clear cache manually by deleting all the folder into var/cache (prod & dev) & change the file permissions for the var/cache to 777, so you can clear cache.
Thanks to check and feedback.
I cleared the cache manually and set permissions of var/cache to 777. However in PS-Dashboard it still says "You do not have permission to update this" whenever I click on "clear cache".
I also created a new prestashop instance, took the _access table from there and imported it to my actual database. However this did not really solve the problem with the "Link Widget" (Dashboard menu item "Design" - "Link Widget") because while the error message does not appear any longer, I also can not access the page, everytime I click on the menu link I am redirected to the homepage of the Dashboard.
Generally in case of an upgrade from 1.6 to 1.7 - replacing the "ps_access" table does seem quite fishy.
Why?
The upgraded "ps_authorization_role" is also different than the default one.
For example:
In my actual database in table "ps_authorization_role" there is one entry:
(899, 'ROLE_MOD_MODULE_BLOCKCONTACT_DELETE'),
In a new database this entry is missing entirely.
Another example the other way round:
In the new database it says:
(682, 'ROLE_MOD_MODULE_WELCOME_READ'),
In the actual database it says:
(1094, 'ROLE_MOD_MODULE_WELCOME_READ'),
Completely different ID, which is then referenced from "ps_access"?
But I should use this new "ps_access" to replace the same table of the actual database and this is supposed to work? What!?
@Goalfair, about the issue of "access denied" after upgrade from PS1.6 to PS1.7, there is an issue with more details still open not fixed yet, you can follow this link: https://github.com/PrestaShop/autoupgrade/issues/100
About your permission issue when clearing cache, We need to retrieve the PHP error log and the debug mode report in order to find out what's wrong.
Don't you know how to get this information? Please read the following article:
http://build.prestashop.com/howtos/misc/how-to-create-bug-report/
Thanks!
As I suspected it is _NOT_ enough to just use a default "ps_access" table. If anything, you would have to use a default "ps_authorization_role" table as well, which could not work if you upgraded PS from a previous version.
See: https://github.com/PrestaShop/PrestaShop/issues/9513#issuecomment-415011961
ID profile number 1 (SuperAdmin) of the "ps_access" table has to be matched with all the IDs of the corresponding authorization roles of the table "ps_authorization_role".
For example if in "ps_authorization_role" it says: (1094, 'ROLE_MOD_MODULE_WELCOME_READ'),
then "1094" has to be assigned to "1" in the ps_access table: (1, 1049),
I added the ps_access.sql which worked for me, if anyone needs it:
ps_access.zip
Just delete the existing table (create backup beforehand ofc) and import the one provided. If you are using another prefix as ps_ you need to change that before importing.
This also solved the "not allowed to delete cache" issue.
Hi @Goalfair,
Thanks for your feedback & for this clarifications.
Issue #9513 is assigned to our developer.
Since it is fixed, I close the issue.
Feel free to open a new one when needed.
Thanks!
Quick fix for id profile = 1 (super admin?) to resolve access deined after upgrade:
INSERT INTO ps_access SELECT 1, `ar`.`id_authorization_role` FROM `ps_authorization_role` ar
LEFT JOIN ps_access a ON( ar.id_authorization_role = a.id_authorization_role AND a.id_profile = 1)
WHERE a.id_profile IS NULL
More content for https://devdocs.prestashop.com/1.7/faq/upgrade/ 馃槃 ? Feel free to submit a PR
Most helpful comment
As I suspected it is _NOT_ enough to just use a default "ps_access" table. If anything, you would have to use a default "ps_authorization_role" table as well, which could not work if you upgraded PS from a previous version.
See: https://github.com/PrestaShop/PrestaShop/issues/9513#issuecomment-415011961
ID profile number 1 (SuperAdmin) of the "ps_access" table has to be matched with all the IDs of the corresponding authorization roles of the table "ps_authorization_role".
For example if in "ps_authorization_role" it says:
(1094, 'ROLE_MOD_MODULE_WELCOME_READ'),
then "1094" has to be assigned to "1" in the ps_access table:
(1, 1049),
I added the ps_access.sql which worked for me, if anyone needs it:
ps_access.zip
Just delete the existing table (create backup beforehand ofc) and import the one provided. If you are using another prefix as ps_ you need to change that before importing.
This also solved the "not allowed to delete cache" issue.