restrict some url access, based on user roles I am theming an administrative page.
There are 2 roles (admin, role2) that have access to all the administrative pages. Now, I want to restrict the access to some URLs to the role2 role: Users with that role should be redirected to other pages. How is this done using the template?

I know I can use permissions to restrict the access, but I want to restrict the access basing on the URL being visited.
You can implement hook_menu_alter in your custom module and can provide function for 'access callback' property of the menu item.

&lt;?php


/**
 * Implements hook_menu_item_alter()
 *
 */
function custom_feature_menu_alter(&amp;$items) {

  $items['admin/structure/types']['access callback'] = 'custom_feature_access_callback';

}

/**
 * Custom access callback
 */

function custom_feature_access_callback($arg) {

  global $user;

  $roles = array_keys($user-&gt;roles);

  //Adding condition for the user roles. You can change 3 to your user role. I have tested this with administrator user role
  if (in_array(3, $roles)) {

    return FALSE;
  }
  else {
    return TRUE;
  }

}