Question: I'm working on a Drupal 7 project. And for this I need to get all the users that have a certain permission for a `node`. I need this info in the `hook_node_update` method, which means that I can currently get the `$node` object just fine but I'm unable to find a way to query a list of users that have edit rights to the particular node that's being updated.

Can anyone provide an insight? That would be great!

Thanks.

Answer: 
This:

```
node-accommodation-form

```

Is the **HTML ID** of the form, found in `$form['#id']` (confusing I know). You need the **internal ID**, which is

```
node_accommodation_form

```

As in:

```
function zeilschepen_form_alter(&$form, &$form_state, $form_id){
  switch ($form_id) {
    case 'node_accommodation_form':

```

Using `#attached`, as mentioned in comments, is far preferable to `drupal_add_js()` when you get to that part.

As an aside, you may find coming back to your code later on a bit easier if you separate out your form alters like so:

```
function MYMODULE_form_node_accommodation_form_alter(&$form, &$form_state, $form_id) {
  // Logic specific to the accommodation node form, no need to check form ID.
}

```

Also, as noted in another answer, theme hooks are only run when the theme is actually in use. So if you're using the admin theme for your node edit forms, your code will never run. If that's the case, you need to move the logic to a module.
I think **hook\_form\_alter()** will help you. Try this:

```
   function yourmodule_form_alter(&$form, &$form_state, $form_id){
     if($form_id == "your form id") {
       drupal_add_js('your js file');
     }
    }

```