Permission base on the administration menu? I have used hook_permission to limit user for some places and to created a permission rule. However, I have not combine two permission from another modules for my custom module.

I'm working on a module that would allow user to used the Administration Menu when user are on a Desktop and used the  Mobile Friendly Navigation Toolbar when the user is on a mobile. 

I'm using the hook_page_build to hide the css from mobile or desktop display. 

So now I'm trying to limited the hook_page_build to user that only have access to the Administration Menu and the Mobile Friendly Navigation Toolbar.

To be more specific here is the permission that I want user to have enable before this module is been load.

Access administration menu

 

And the another permission that user need to have is  Use the administration navbar.



Once these two permission have been granted the my custom module is going to be able load. How can I do this ?
I found the solution here is how is done....

function my_custom_module_page_build(&amp;$page) {

    // Check if user have access to the administration menu
    if (!user_access('access administration menu')) return false;

    // Check if user have access to navbar.
    if (!user_access('access navbar')) return false;

     drupal_add_css(drupal_get_path('module', 'my_custom_module') . '/css/mobile.css');

}