Restrict access to a section of the site implemented by a custom module I have a site with two different type of users: clients and anonymous users.

I'm currently building custom modules to handle a "client administration" section of the site, where clients are able to change their profiles, modify custom settings, etc. There is a section of the site "client" users are able to access, but regular users are not. 

How can I restrict access to that section to only a particular class of user?
If you implement hook_permission in your custom module, you can control the access of your client administration section.


Set up roles. You've done this already with the client role.
Implement hook_permission():

function MODULE_permission()
{
    return array(
        'access client administration' =&gt; array(
            'title'       =&gt; t('Access Client Administration'),
            'description' =&gt; t('Allow users to access client administration'),
        ),
    );
}

When you define hook_menu(), make sure you set the permissions accordingly:

function MODULE_menu()
{
    $items['client_administration'] = array(
        'title' =&gt; 'Client Administration Page',
...
        'access arguments' =&gt; array('access client administration'),
    );

    return $items;
}

Go to admin/people/permissions and set the permissions for 'Access Client Administration' to your client role.