How to add css to a form according to the user's role? I know how to add css to individual form types using: 

function theme_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  switch ($form_id) {
    case 'formtype_form':
      global $theme;
      $form['#attached']['css'] = array(
        drupal_get_path('theme', 'projectname') . '/css/new.css',
      );
    break;
 }
}


but how can I restrict this attached css to users with a single role?
You need to call $user object and compare user role with current logged in user.

function theme_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  global $user, $theme;

  switch ($form_id) {
    case 'formtype_form':
      // change user_role to whatever role you want to restrict this css
      if (in_array('user_role', array_values($user-&gt;roles))) {
        $form['#attached']['css'] = array(
          drupal_get_path('theme', 'projectname') . '/css/new.css',
        );
      }
      break;
  }
}