Permissions

To add permissions, use hook_perm() in your module:

function mymodule_perm() {
   return array('access something special');
}

This will appear in Drupal's permissions list, so you can specify which roles should have this permission.

You can check if the current user has this permission like this:

if (user_access('access something special')) {
   // Do something special
}