You are here

function acl_save_form in ACL 7

Same name and namespace in other branches
  1. 8 acl.admin.inc \acl_save_form()
  2. 5 acl.module \acl_save_form()
  3. 6 acl.admin.inc \acl_save_form()

Write the results of a form.

The module that embedded our form must call this function!

File

./acl.admin.inc, line 135
Implementations of administration functions for the acl module.

Code

function acl_save_form($form, $priority = NULL) {
  $users = acl_edit_form_get_user_list($form);
  db_delete('acl_user')
    ->condition('acl_id', $form['acl_id'])
    ->execute();
  $insert = db_insert('acl_user')
    ->fields(array(
    'acl_id',
    'uid',
  ));
  foreach ($users as $uid => $name) {
    $insert
      ->values(array(
      'acl_id' => $form['acl_id'],
      'uid' => $uid,
    ));
  }
  $insert
    ->execute();
  if (isset($priority)) {
    db_update('acl_node')
      ->fields(array(
      'priority' => $priority,
    ))
      ->condition('acl_id', $form['acl_id'])
      ->execute();
  }
}