Views check access by PHP
The correct way is to create a custom module and implement hook_permission() to define an appropriate permission:

function hook_permission() {
  return array(
    'administer my module' =&gt; array(
      'title' =&gt; t('Administer my module'),
      'description' =&gt; t('Perform administration tasks for my module.'),
    ),
  );
}


Grant that permission to the roles that require access to it, and then use user_access() to make the access decision:

if (user_access('administer my module', $account)) {
  ...
}


As AyeshK points out in the comments, you don't actually need the second part - Views has n plugin for access based permissions already, which you can configure through the UI. So once you've added the permission and granted it to the relevant role(s), it'll be easy to get what you're looking for.