Access denied - when try to access custom module

In my custom module: After creating as soon as I try to access this, I am getting the error as below

Access denied.
You try to access to a page, area or feature of a disabled module or without being in an authenticated session or that is not allowed to your user.
Current login: admin
Permission for this login can be defined by your Dolibarr administrator from menu Home->Users

But if I comment this line (availabe in xxxindex.php) ‘if (! $user->rights->stockstatus->read) accessforbidden();’ this is working fine.

Could you please suggest on this

Thanks

I’ve had a similar problem and it was caused by this. I was experimenting and trying to create a custom module with several attempts and using numero 500000 (the default) and then tried 500001, 500002 etc for different experiments. Along the way, going into the danger zone and deleting various previous attempts. Basically that Danger Zone delete does not fully delete what was previously created. To clean up properly you need to use MySQLWorkbench to clean up remnants in at least these tables…

use dolibarrdebian;
select * from llx_rights_def;
select * from llx_menu;
select * from llx_const;
select * from llx_cronjob;
select * from llx_boxes_def;

The next thing I would say is that it’s a mistake to experiment with a numero like 500001, the last digit needs to be zero because a module does not use just one number it uses a block of numbers (something like 500000 to control reading privileges, 500001 for create/modify, 500002 for delete etc - but those actual values are not gospel, just from my poor recollection).

So what I’m saying is that, if you clean out and start over, for me it worked, but of course 500000 is not a safe number anyway if you plan to distribute.

Hope that helps-R

1 Like

It seems that when we have a number, we should reserve it when we deploy on the dolistore. Quiet interesting.

Hello, I am using dolibarr 16.0.1, local host. I don’t have much technical knowledge. Just trying to setup for my store. I cant setup any account in Bank & Cash module, even though I logged in as super admin, its says access denied or I am trying to access something of disabled features.

Pleasr advise, my technical knowledge is very limited. Thank you

HERE you can reserve IDs to be used for your modules.