I’m the only user in this SuiteCRM instance. I’m the administrator (ony one user cannot be anything else).
I created a module.
Admin → Module Builder → New package
I created the Package and then the Module. Then I deployed it. Then quick repair and rebuild.
The module appears in top menu. When I cklick on it I get an error pop up: “You are not authorized to view this page. Please contact your system administrator.”
Error log says this:
13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “enctype” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 24
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “return_id” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 52
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “return_relationship” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 57
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “relate_to” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 58
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “return_id” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 61
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “app_strings” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 110
[13-Oct-2021 13:06:06 UTC] PHP Warning: Trying to access array offset on value of type null in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 110
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “default_value” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 186
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “default_value” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 625
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “default” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 674
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “default_value” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 754
[13-Oct-2021 13:06:06 UTC] PHP Warning: Undefined array key “TOGGLE_JS” in /home/crm8/public_html/public/legacy/cache/smarty/templates_c/%%F4^F45^F45E7F3F%%EditView.tpl.php on line 900
Note: I don’t know if there should be a directory ModuleNameMap by default, I’m just informing you there were no directory ModuleNameMap, I had to create it.
The console reports: VM6094 sugar_grp1_jquery.js:2 [Violation] 'load' handler took 169ms
I was able to replicate the issue on my side. I’ve applied the solution I told you and it worked ok.
Could you check if the case in the letters of your module name is correct?
if you go to public/legacy/custom/Extension/application/Ext/Include there should be a file with the name of your module.
In my case I added a MyModule module, with package prefix of test.
On public/legacy/custom/Extension/application/Ext/Include/MyModule.php I have
<?php
//WARNING: The contents of this file are auto-generated
$beanList['test_MyModule'] = 'test_MyModule';
$beanFiles['test_MyModule'] = 'modules/test_MyModule/test_MyModule.php';
$moduleList[] = 'test_MyModule';
?>
On the fix file public/legacy/custom/Extension/application/Ext/ModuleNameMap/my_module.php in have:
Hi,
I was getting the authorization error yesterday.
I tried your workaround and it worked initially.
When I came back today and tried to access my custom module, i get a text error on a blank screen: Error: Module Staff does not exist.
My file PKG1_Staff.php, as per above, looks like this:
Any thoughts on this issue?
Not being able to create and use a custom module is a significant blocker.
Update:
I was able to get this to work, but not sure why.
Above, you say to look for public/legacy/custom/Extension/application/Ext/Include/MyModule.php
For me, that file was not named MyModule.php but was the full package name.
That is, expected was Staff.php but the file name was PACKAGE1.php.
I created a link: ln -s PACKAGE1.php Staff.php and i was able to see the module.
Not sure how long this workaround will last.
So, some things are not working properly and need to be addressed before the next release.
The reference to public/legacy/custom/Extension/application/Ext/Include/<file>.php, was just to open it and check the machine name for the module. From what I’ve understood in your case the module name is PKG1_Staff.
That module name is the name that should be used on the code inside the public/legacy/custom/Extension/application/Ext/ModuleNameMap/<any_name>.php
As a matter of fact this should not be needed. This is caused as a part of the logic of the acl check that is being too strict, which causes custom module not to be recognized as valid modules if they are not defined on the module_name_map. We are in the process of changing that.
What is module_name_map ?
Module name map, is a map that maps from legacy module names to more “standard” names both on the front end and on the SuiteCRM 8 side backend. Though at the moment it is mostly used for the front end.
When you open the app and go to the accounts module the address is something like <your_instante>/#/accounts/ and not <your_instante>/#/Accounts/ or if you go to Quotes the address is <your_instante>/#/quotes/ and not not <your_instante>/#/AOS_Quotes/. This mapping between the legacy module name and the front end name is declare on the module_name_map.
You can find the core module_name_map at public/legacy/include/portability/module_name_map.php
And we allow to extend the module name map, use the legacy extension mechanism. Which is declared on public/legacy/ModuleInstall/extensions.php.
This extension setup is what allows us to add the file to public/legacy/custom/Extension/application/Ext/ModuleNameMap/<any_name>.php
Database type and version?
PHP version?
Installation method, docker or self-install?
Relevant entries, at the time of the error, in suitecrm.log and php_errors.log?