Topic: Define statement in hooks.php

I'm playing with building a new module.  In looking at other ones to figure out the structure, I see there's a define statement at the beginning of all of the hooks.php file:

define ('SS_DASHBOARD', 150<<8);

The variable name makes sense, but what are the other 2 numbers (150 and 8 in this case)?  As in if I'm creating a new module, what should I use?

Thanks!

2 (edited by apmuthu 08/10/2016 01:45:25 pm)

Re: Define statement in hooks.php

The "<<" is the binary bit left shift operator. The index 150 decimal is 96 hex which when shifted left by 8 bits (those in the first 8 bit range are reserved for system application security roles) will be 9600 hex which is 38400 dec. It is this number that you will see in the security_roles table's sections and areas fields for the various roles.

In case the said index has already been assigned, then the system automatically assigns the next available one.

Read the Wiki for more info. Read this post for insights.

add_access_extensions() have to be called inside extension files to have security areas maintained by core source code. This way module access areas does not interfere with core nor any other module security areas.

Re: Define statement in hooks.php

So if I understand correctly, the first digit (150 in this case) I can pick anything, as long as it's not used elsewhere)?  Or do I need to pick one of the existing values in those fields and work backwards to a specific value?  The wiki examples use 101, 102 and 103 and just says the exact values are not very important, which makes me think I can pick anything.  Thank you!

Re: Define statement in hooks.php

Pick something say from 100 to 250 - check what the standard existing plugins use and choose something different f you do not want the system to pick one out of it's convenience in case of a clash with existing ones.