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

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?

Hi Chris

Database: mysqlnd 8.2.12
PHP/8.2.12 or PHP/8.1.0
Installation: self-install (apache 2.4 /xamp or mamp windows)
SuiteCrm version: 8.5.0

Use Case:

  1. custom module called “cstm_Customer_Payments”.
  2. There is a Many to Many relationship from cstm_Customer_Payments to Invoices module
  3. On cstm_Customer_Payments RecordView, there is a subpanel “Invoices” (cstm_customer_payments_aos_invoices)
  4. When clicking on Edit icon of “Invoices” subpanel record, it throws error message as below:

image

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

if i dig a little under the error above
in public\legacy\include\portability\Services\ACL\UserACLService.php

change

if (!$isActionAvailable) {
return [
‘status’ => false,
‘message’ => ‘ERR_UNAUTHORIZED_PAGE_ACCESS’
];
}

by

if (!$isActionAvailable) {
return [
‘status’ => true,
‘message’ => ‘’
];
}
and now i have this error
Error:
“Error occurred while fetching metadata”
image

I have also added a file in public\legacy\custom\Extension\application\Ext\ModuleNameMap\cstm_Customer_Payments.php

  • repair and rebuild

with
$module_name_map[‘cstm_Customer_Payments’] = [
‘frontend’ => ‘Customer_Payments’,
‘core’ => ‘cstm_Customer_Payments’
];

I dont have specific error in suitecrm.log or php.log

This post refers to the module name map, and capitalization of your module name.

Let us know if this solved your issue!

Hi ! thanks you for your reply , I have tried but same issue.

I have similar issues in Contacts Module Subpanels when i click on edit button on subpanel:

Subpanel History, Activities Error:
image

Subpanel Contracts, Events, Invoices, Quotes
image

Subpanel Opportunities, Cases, Leads, Documents Edit button works well

I am also getting the ‘You are not authorized to view this page…’ error on every user login.

The difference is we have no external modules at all.

SuiteCRM 8.5 (recently upgraded from 8.2.4)
MySQL v 8.0.32
PHP v 8.1.25

Permissions are all ok as far as I can see.

It doesn’t matter if they are an admin user or a regular user, the message still comes up but allows you to click through it and everything operates as normal. Logout is fine.

I have spent most of today tracking the code to try and understand why this is happening but just can’t see anything that is causing it, although I am not an out-and-out coder by any means.

If anyone has any ideas, happy to listen as this is stopping us migrating to 8.5 on the main system as the support desk would not be happy.

Any help gratefully received.

Update your MySQL:

OK Thanks. I am planning to do this tomorrow as I had to apply a temp patch to fix the sub-panel issues that came up. Didn’t expect the login to be the same cause.

Thank you for your fast response. Hopefully that will dispappear tomorrow once the upgrade has been done.

Many thanks again.