# Custom Module permissions

**URL:** <https://www.dolibarr.org/forum/t/custom-module-permissions/22031>\
**Category:** Developing for Dolibarr\
**Tags:** Linux, v14, Help\
**Created:** [March 16, 2022, 4:15pm UTC](https://www.dolibarr.org/forum/t/custom-module-permissions/22031 "2022-03-16T16:15:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tindoshox](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/t/7cd45c/32.png) [@tindoshox](https://www.dolibarr.org/forum/u/tindoshox)\
**Post date:** [March 16, 2022, 4:15pm UTC](https://www.dolibarr.org/forum/t/custom-module-permissions/22031/1 "2022-03-16T16:15:49Z")

</div>

Dolibarr version 14.03  
Platform Ubuntu Server 18.04 LTS  
Webserver Apache 2

I have developed a few custom modules and they do what is intended. The problem comes with the left menu search box. I haven’t made any changes to it but I get the following:

_133_

_Notice_\*: Undefined property: stdClass::$supplier\_invoice in **/var/www/demo/htdocs/core/ajax/selectsearchbox.php** on line \*_133_

_Notice_\*: Trying to get property ‘lire’ of non-object in **/var/www/demo/htdocs/core/ajax/selectsearchbox.php** on line \*_133_

_Notice_\*: Undefined property: stdClass::$banque in **/var/www/demo/htdocs/core/ajax/selectsearchbox.php** on line \*_143_

_Notice_\*: Trying to get property ‘lire’ of non-object in **/var/www/demo/htdocs/core/ajax/selectsearchbox.php** on line \*_143_

 ![Screenshot_2022-03-16_18-18-48](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/d/d43bd77ad8ff06f25e9ead35c3372dde4e43e2b9.png)

The errors correspond to modules that a user has not been given access to. Granting access eliminates the errors but is not an ideal solution.

Any suggestions would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![milenmk](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/milenmk/32/4128_2.png) [@milenmk](https://www.dolibarr.org/forum/u/milenmk)\
**Post date:** [May 25, 2022, 5:23am UTC](https://www.dolibarr.org/forum/t/custom-module-permissions/22031/2 "2022-05-25T05:23:28Z")

</div>

You should alter your module to adopt the Dolibarr core modules permissions. What I mean:

1. Let’s say you have a page, that shows some invoices information
2. The user that opens the page does not have permission to read/view invoices

All of the above means, that in your module you should have:

```auto
if ($user->rights->facture->lire) { //If the user have rights to view invoices, show the code below
    //your code goes here
}

```

Similar should be done for the rest.
