Custom Top Admin Menu: Intergrating Permissions Looking into build a top bar to be used for clients for quick access to edit/add pages. Big question I have is, how do you hook this into the Permissions module in core? Say if I want to allow another user to log in and assign this due to certain permissions.

Is this easily done? Or something a bit much? 

function mymodule_preprocess_html(&amp;$vars) {
  if (user_access('moderator')) {
    drupal_add_css(drupal_get_path('module', 'mymodule') . '/css');
    $my_links = array();
    if (in_array('manager', $vars['user']-&gt;roles)) {
      $my_links[] = array(
        'title' =&gt; t('Add new page'),
        'path' =&gt; '/location',
      )
      $my_links[] = array(
        'title' =&gt; t('Edit pages'),
        'path' =&gt; '/location',
      );
    }
  }
}


Seen some things used as below, but having issues...

function mymodule_permission() {
  return array(
    'moderator' =&gt; array(
      'title' =&gt; t('Use these top links'),
      'description' =&gt; t('Blah blah blah.'),
    ),
  );
}
First of all I assume that the Admin Menu module isn't suffient for your needs? If not then I think you're approaching the custom module in the incorrect way.

Basically all menu routes in Drupal (node/add for example) use access arguments to determine who can access the route in question. So if you're looking to build a custom admin bar, I would rather create a new custom Drupal menu, and then add all my links in there. Then if a user does not have sufficient access rights to a menu route, Drupal will not display that specific link within the menu to the user.

If your menu links are coming from a custom module that you've written, you could apply the following example to include your module's menu items into your custom menu. You would use this within your hook_menu declarations:

$items['my/custom/route'] = array(
  'title' =&gt; 'Custom module section',
  'page callback' =&gt; 'mymodule_custom_page',
  'access callback' =&gt; 'mymodule_custom_access',    
  'weight' =&gt; 0,
  'type' =&gt; MENU_NORMAL_ITEM,
  'menu_name' =&gt; 'my-custom-menu-id'
);


Using a custom menu instead of using your $my_links[] array you included above, will allow greater control over each menu item within the Drupal UI too. 

*EDIT: provided further explanation based on comments*

Regarding your comments I still think your approach of implementing access controls within hook_preprocess_html is not the best way. We should always be looking to separate our application logic from our frontend logic, and using that hook to apply access control goes against that best practise.

I still recommend that you create a custom menu and then add your admin links and restructure as you want it to be. Then set which roles can create each content type within your system from here /admin/people/permissions, and Drupal will automatically exclude the link for content types the logged in user doesn't have access to.

With regards to displaying the menu, you can just assign the menu's block to a region within your theme, and use CSS to apply styling and positioning within the browser. You can also adjust the access permissions for the block, so only certain roles will ever see your custom menu. You can do this by editing the Visibility settings for menu's block.

Wow I didn't expect this to be such a long winded answer haha! :)