Published: 2017-12-25   Views: 1444
Author: hasanuzzaman
Published in: Dolibarr
Module Development: Error In Dolibarr Menu Permission - Solved

As a Dolibarr module developer you may find issue with the dynamic permission allocation issues. The current Dolibarr Module Development documentation is not full. As a new module developer you may face so many problems. But it is not possible to get all the answers in the Internet related to module development. This document may solve the following problems in the module development process.

  1. If problem with module enabling
  2. If the menu permission does not work correctly.
  3. If Module Rights class not working.
  4. Problem with dynamic permission.

dolibarr menu permission help

Solution to Dolibarr menu permission error

First Step:

The most common mistake that developers usually do is choosing incorrect name for the module's RIGHTS class. Lets say if your module name is ALDictionary,  make sure you have not gave the same name for RIGHTS class. Like incorrect rights class name is ALDictionary; while correct name is aldictionary. Please see the image for details.dolibarr menu permission

 

Second Step:

Make sure the configuration class is initialized and has different name than the main module core class. Here the correct sample code is given below:

 

if (! isset($conf->aldictionary) || ! isset($conf->aldictionary->enabled)) {
    $conf->aldictionary = new stdClass();
    $conf->aldictionary->enabled = 0;
}

 

 

 

You should not use the same name as of main class.

Third Step:

Check your menu array definition. There are two important keys to check. One is enabled and another is perms. To make your module permission is handled by Dolibarr itself, you should give the code string as follows '$conf->aldictionary->enabled' and $user->rights->aldictionary->read. Make sure you have put these under single quote.

 

Fourth Step:

Dolibarr module uninstallation process is not too much intelligent. While you are enabling and disabling your module again and again for testing, Dolibarr keeps the garbage data in few rights MySQL tables. The tables name are llx_rights_def and llx_user_rights respectively. These two tables holds the data for module's rights. Navigate through the table each and delete the rows that corresponding to your module (check $this->numero of your module descriptor file). Now enable your module again. Now the permission should work.

 

Note: If the all above three steps does not solve your problem you can contact us without any hesitation. We will be happy to assist you.

Article Comments

0 comments.

There are zero comments yet, why not be the first?

You must be logged in to post a comment.

Please log in or register to comment or reply to a comment.

Articles Search

Featured Articles

Most Popular Articles

Article Categories Expand

7  
1  
1  
1  
0  
6  
0  
53  
3  

There are zero sub-categories in this parent category.

45  
6  
3  
3  
7  
4  
8  
4  
3  
2  
1  
0  
0  
0  
25  
0  
0  
0  
1  
2  
8  
1  
1  
0  
1  
1  
0  
1  
1  
0  
0  
1  
4  
0  
3  
3  
0  
1  
25  
1  
0  
0  
1  
0  
0  
6  
0  
1  
29  
1  
0  
2  
0  
11  
0  
0  
0  
0  
3  
2  
0  
2  
2  
1  

There are zero sub-categories in this parent category.

3  
1  
2  
5  
0  
3  
2  
1  
0  
0  
1  
0  
1  
2  
0  
1  
0  
21  
0  

There are zero sub-categories in this parent category.

0  
1  
0  
0  
0  
0  
0  
1  
0  
0  
0  
2  
24  
17  
3  
1  
0  
0  
0  
0  
1  
1  
0  
0  
0  
0  
0  
1  
0  
0  
1  
3  
0  
0  
0  
0  
0  
0  
0  
1  
1  
0