How can I make a dependable user permission?

I have created a custom permission now I want to make that permission dependable on read permission.
Like if I will turn on the default read permission of that module for any user then that custom permission should turn on with that.

Thanks & Regards
Saikat

your code will need to check if the permission is set or not.

Thanks for your reply. But that’s I need to know that is there any Dolibarr way to check in Mod file or I will have to write by my own.

My need is when standard read will be turned on then my custom permission will be turned on. As like when we turn on the create permission then read permission got turn on automatically.

okay, so I’m back from vacation.

There are several places in the dolibarr php code where they check permissions, why not just copy the look and feel of that?

Thanks your reply. I will try that. For now I left that work as it is and moved to next one.