Restrict permission to custom modules in drupal
Declare a permission with hook_perm(). It is recommended to somehow use your module name in the permission or something unique to your module to avoid conflicts (there is no namespacing, permission names are global).
In your hook_menu() implementation, add 'access arguments' =&gt; array('permission name here'). Since the default access callback is user_access(), the menu system will call user_access('your permission name') to check if the current user has access to that menu item. See hook_menu() documentation for more information. You can also use user_access() directly in your code, if you want to check permissions somewhere else; for example for blocks, you can use that function directly.
Then, you can create whatever roles you want to and give them the permissions of your module at admin/user/permissions. The important distinction here is that permissions are controlled in modules (which can be more or less generically written) while roles and the permissions they have are site-specific.


Then, make sure to rebuild the menu (by using devel.module or saving the modules form) and you should be good.