I am not able to override the form #access setting I cerated a form alter with the file entity media upload browser. I studied this answer of how to alter this form. I then debugged and found that for what I wanted to do, I am in step 4 of the file upload browser as evidenced by the var: $var['#step'] (Integer) 4.

Thus my code so far is:

/**
 * Implements hook_form_FORM_ID_alter().
 *
 * Form ID = file_entity_add_upload.
 */
function MYMODULE_form_file_entity_add_upload_alter(&amp;$form, &amp;$form_state, $form_id) {
  // Check that this is the fields step.
  if ($form['#step'] == 4) {
  echo 'This is step 4';
  // yep the above prints out.

  // Set access false for the specified field.
  $form['field_usage_restricted']['#access '] = FALSE;

  // Add a dsm after to see what's going on
  dsm($form);
  }
}


You'd think this would get rid of the form field, yet, it's still present. See the dsm below:



I would think that my custom alter FALSE setting would override the TRUE setting but no such luck, the field is still there. 

I can use an unset($form['field_usage_restricted']); and that works fine to get rid of the field, but I've learned that ['#access '] = FALSE; is a better way to go, especially when there's ajax in use such as the case here. I do see in the debug that there's a form after build so I wonder if I need to do that? 

I tried this on the off chance it would work but still no joy:

if ($form['field_usage_restricted'][LANGUAGE_NONE]['#after_build'][0]) {
  // Set access false for the specified field.
  $form['field_usage_restricted']['#access '] = FALSE;
}


(Note, my field, field_usage_restricted is not a required field.)
$form['field_usage_restricted']['#access '] the #access key has a space in it. Only reason I can think of you would get two items in the array like that. Remove that space, and dump the item out again. It should be overwritten and have FALSE for a value.