You are not authorized to view this page. Please contact your system administrator

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

— environment —
PHP 8.0
MySQL 5.7.35
Apache 2.4.49
SuiteCRM 8.0.0-rc

I would really appreciate if somebody can help me solve this problem.

Thank you.

Hi @Cadej,

Thanks for your feedback and for trying on SuiteCRM 8 RC.

Could you try the following:

Create a file at public/legacy/custom/Extension/application/Ext/ModuleNameMap/my_module.php with the following contents please?

  • Replace MyModule by the name of your module, should be the “machine name” something like ABC_MyModule or similar.
  • Run a repair and rebuild
<?php

$module_name_map = $module_name_map ?? [];

$module_name_map['MyModule'] = [
    'frontend' => 'my-module',
    'core' => 'MyModule'
];

I’ve raised this internally, I think this is something we should look at.

1 Like

I didn’t quite understand you. Here is what I did

A file
public/legacy/custom/Extension/application/Ext/Podrocja_delovanja/Podrocja_delovanja.php

Content:
<?php

$module_name_map = $module_name_map ?? [];

$module_name_map['Podrocja_delovanja'] = [
    'frontend' => 'Podrocja_delovanja',
    'core' => 'Podrocja_delovanja'
];

Sadly it doesn’t work.

Hi @Cadej,

Thanks for the feedback

This file, could you move it to the following location please?

public/legacy/custom/Extension/application/Ext/ModuleNameMap/Podrocja_delovanja.php

Also could you change the front end name to something like the following please?

delovanja, like so: 'frontend' => 'delovanja'

I did
public/legacy/custom/Extension/application/Ext/ModuleNameMap/Podrocja_delovanja.php

<?php

$module_name_map = $module_name_map ?? [];

$module_name_map['Podrocja_delovanja'] = [
    'frontend' => 'delovanja',
    'core' => 'Podrocja_delovanja'
];

It still doesn’t work.

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

Hi @Cadej,

Yes, thats correct, you need to create it.

Could you check if a file was generated on the following path please?
public/legacy/custom/application/Ext/ModuleNameMap/module_name_map.ext.php

Yes, it was.

<?php 
 //WARNING: The contents of this file are auto-generated

$module_name_map = $module_name_map ?? [];

$module_name_map['Podrocja_delovanja'] = [
    'frontend' => 'delovanja',
    'core' => 'Podrocja_delovanja'
];
?>

Hi @Cadej,

Thank you

Could you also send me a screen shot of the following please?

  • error on the browser
  • browser console log
  • browser network tab

Hi @Cadej,

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:

<?php

$module_name_map = $module_name_map ?? [];

$module_name_map['test_MyModule'] = [
    'frontend' => 'my-module',
    'core' => 'test_MyModule'
];

Then I had to do a repair and rebuild.

Another thing.

Are you able to load the homepage ok?

I’m not getting all those errors.

Could you check the following file please?

  • public/legacy/.htaccess

On RewriteBase you should have the following:

  1. If your vhost is pointing to public inside SuiteCRM 8 folder, RewriteBase should have /legacy

  2. If your are using a subfolder in the url like https://<yourdomain>/subfolder/public, thenRewriteBase should have /subfolder/public/legacy

1 Like

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:

<?php

$module_name_map = $module_name_map ?? [];

$module_name_map['PKG1_Staff'] = [
    'frontend' => 'Staff',
    'core' => 'PKG1_Staff'
];

?>

Any suggestions?

Thanks,
Arthur

Hi @art,

Thanks for trying out SuiteCRM 8.

Could you try with the following, please?

$module_name_map['PKG1_Staff'] = [
    'frontend' => 'PKG1_Staff',
    'core' => 'PKG1_Staff'
]

HI @clemente.raposo ,

With all 3 being ‘PKG1_Staff’ i get the original error - not authorized to view page.

Arthur

Hi @clemente.raposo,

Also, the file is in the Include directory and looks like yours.
The name of the file is the full package name PACKAGE1.php not the key PKG1.php.

My custom package is PACKAGE1 with key PKG1
My custom module in this package is Staff.

So, I am a bit confused with when I should use PACKAGE1, PKG1_Staff or just Staff.
For filenames and statements within files.

Arthur

Hi @clemente.raposo,

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.

Regards,
Arthur

Hi @art,

Sorry for the delay.

I’m glad you were able get it working.

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

like

$module_name_map = $module_name_map ?? [];

$module_name_map['PKG1_Staff'] = [
    'frontend' => 'staff',
    'core' => 'PKG1_Staff'
];

Now on the reason why is this needed.

  1. 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.

  2. 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

Hope this helps make it a bit more clear.

2 Likes

I am having the same issue. Tried the solution given above but issue is not resolved yet.

Use Case:

  1. We have a custom module called “EC_Children”.
  2. There is a One to Many relationship from Contacts to EC_Children module
  3. So on Contact RecordView, there is a subpanel of “EC_Children”
  4. When we click on Edit icon of “EC_Children” subpenl record, it throws error message as below:

Error:
You are not authorized to view this page. Please contact your system administrator

I did following changes but it is not working:

public/legacy/custom/Extension/application/Ext/ModuleNameMap/EC_Children.php

<?php
$module_name_map = $module_name_map ?? [];

$module_name_map['EC_Children'] = [
    'frontend' => 'ec-children',
    'core' => 'EC_Children'
];
~ 

ext.php file was built as below:
public/legacy/custom/application/Ext/ModuleNameMap/module_name_map.ext.php

<?php
 //WARNING: The contents of this file are auto-generated


$module_name_map = $module_name_map ?? [];

$module_name_map['EC_Children'] = [
    'frontend' => 'ec-children',
    'core' => 'EC_Children'
];

?>

What can be the possible root cause and its solution?

has there been any resolution to this? We are experiencing this issue as well on the latest release of SuiteCRM.

Hello ! I have the same issue i’m using SuiteCrm 8.5

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?