diff -urpN old/acl.module new/acl.module
--- old/acl.module	2007-11-18 01:32:42.000000000 +0530
+++ new/acl.module	2007-12-17 06:04:35.531250000 +0530
@@ -1,5 +1,5 @@
 <?php
-// $Id: acl.module,v 1.1.2.14 2007/11/17 20:02:41 salvis Exp $
+// $Id: acl.module,v 1.1.2.11 2007/05/18 13:23:49 fago Exp $
 
 /** 
  * @file acl.module
@@ -9,12 +9,17 @@
  * other without having to actually know much about them, and so that
  * ACLs can easily co-exist with the existing node_access system.
  */
+
+if (module_exists('workflow_ng')) {
+  include_once(drupal_get_path('module', 'acl') .'/acl_workflow_ng.inc');
+}
+
 
 /**
  * Create a new ACL.
  */
 function acl_create_new_acl($module, $name) {
-  $acl_id = db_next_id('{acl}_acl_id');
+  $acl_id = db_next_id('acl_id');
   db_query("INSERT INTO {acl} (acl_id, module, name) VALUES (%d, '%s', '%s')", $acl_id, $module, $name);
   return $acl_id;
 }
@@ -134,7 +139,7 @@ function acl_edit_form_after_build($form
   // ok tho cause #value still works for us.
   $user_list = unserialize($form['user_list']['#value']);
   if ($form['delete_button']['#value'] && is_array($form['deletions']['#value'])) {
-    foreach ($form['deletions']['#value'] as $uid) {
+    foreach($form['deletions']['#value'] as $uid) {
       unset($user_list[$uid]);
     }
   }
@@ -197,14 +202,14 @@ function acl_node_clear_acls($nid, $modu
   }
 }
 
-/**
+/*
  * Gets the id of an acl
  */
 function acl_get_id_by_name($module, $name) {
   return db_result(db_query("SELECT acl_id FROM {acl} WHERE module = '%s' AND name = '%s'", $module, $name));
 }
 
-/**
+/*
  * Determines if an acl has some assigned users
  */
 function acl_has_users($acl_id) {
@@ -234,7 +239,7 @@ function acl_node_access_records($node) 
   return $grants;
 }
 
-/**
+/*
  * Implementation of hook_node_grants
  */
 function acl_node_grants($account, $op) {
@@ -245,14 +250,3 @@ function acl_node_grants($account, $op) 
   }
   return !empty($array['acl']) ? $array : NULL;
 }
-
-/**
- * Implementation of hook_disable
- */
-function acl_disable() {
-  drupal_set_message(t('You have disabled the ACL module&mdash;to avoid permission problems you should now go to !link and click on the [!button] button!', array(
-    '!link' => l('admin/content/node-settings', 'admin/content/node-settings'),
-    '!button' => t('Rebuild permissions'),
-  )));
-}
-
diff -urpN old/acl_workflow_ng.inc new/acl_workflow_ng.inc
--- old/acl_workflow_ng.inc	1970-01-01 05:30:00.000000000 +0530
+++ new/acl_workflow_ng.inc	2007-12-17 22:08:41.984375000 +0530
@@ -0,0 +1,315 @@
+<?php
+
+/**
+ * @file ACL integration for the Workflow-ng module 
+ */
+
+
+/*
+ * Implementation of hook_action_info()
+ */
+function acl_action_info() {
+  return array(
+    'acl_workflow_ng_add_user_to_acl' => array(
+      '#label' => t('add user to ACL'),
+      '#arguments' => array(
+        'author' => array('#entity' => 'user', '#label' => t('User which will be added to the ACL')),
+      ),
+      '#module' => t('ACL'),
+    ),
+    'acl_workflow_ng_remove_user_from_acl' => array(
+      '#label' => t('remove user from ACL'),
+      '#arguments' => array(
+        'node' => array('#entity' => 'user', '#label' => t('User which will be removed from the ACL')),
+      ),
+      '#module' => t('ACL'),
+    ),
+    'acl_workflow_ng_add_node_to_acl' => array(
+      '#label' => t('add node to ACL'),
+      '#arguments' => array(
+        'node' => array('#entity' => 'node', '#label' => t('Content')),
+      ),
+      '#module' => t('ACL'),
+    ),
+    'acl_workflow_ng_remove_node_from_acl' => array(
+      '#label' => t('remove node from ACL'),
+      '#arguments' => array(
+        'node' => array('#entity' => 'node', '#label' => t('Content')),
+      ),
+      '#module' => t('ACL'),
+    ),  
+    'acl_workflow_ng_delete_whole_acl' => array(
+      '#label' => t('delete whole ACL(s) from node'),
+      '#arguments' => array(
+        'node' => array('#entity' => 'node', '#label' => t('Content')),
+      ),
+      '#module' => t('ACL'),
+    ),  
+    'acl_workflow_ng_delete_acl' => array(
+      '#label' => t('delete ACL'),
+      '#module' => t('ACL'),
+    ),     
+  );
+}
+
+
+/*
+ * Action: Add a user to ACL
+ */
+function acl_workflow_ng_add_user_to_acl($author, $settings, &$arguments, &$log) {
+  //check if arbitrary user passed instead of arguments.
+  if ($settings['user'] == ''){
+    $uid = $author->uid;
+  }
+  else {
+    $token = workflow_ng_token_replace_all (array('user','acl'), $settings, $arguments, $log);
+    $user = user_load(array('name' => $token['user']));
+    if ($user) {
+       $uid = $user->uid;
+    }
+  }
+  //Making sure we add a valid user
+  if (isset ($uid)) {
+    //Check if ACL exists, or else create it
+    $token = workflow_ng_token_replace_all (array('acl'), $settings, $arguments, $log);
+    $acl_id = acl_get_id_by_name('acl', $token['acl']);
+    if (!$acl_id) {
+     $acl_id = acl_create_new_acl ('acl', $atoken['acl']);
+    }
+    
+    //TODO: Check if user not already in ACL
+    acl_add_user($acl_id, $uid);
+  }
+}
+
+/*
+ * Action: Add a user to ACL form
+ */
+function acl_workflow_ng_add_user_to_acl_form($settings = array(), $argument_info) {
+  $form = array();
+  $form['acl'] = array(
+    '#type' => 'textfield',
+    '#title' => t('ACL name'),
+    '#description' => t('Enter the name of the ACL. You may have a single user/ node assigned to several ACL lists'),
+    '#default_value' => $settings['acl'],
+    '#required' => TRUE,
+  );
+  $form['user'] = array(
+    '#type' => 'textfield',
+    '#title' => t('User name'),
+    '#description' => t('Enter the user name or use a token replacement. If this is set, then the User argument will be disregarded.'),
+    '#default_value' => $settings['user'],
+  );  
+  workflow_ng_token_replacement_help($form, $argument_info);
+  return $form;
+}
+
+function acl_workflow_ng_add_user_to_acl_submit($form_id, $form_values) {
+  $token = workflow_ng_token_get_settings(array('acl'), $form_values);
+  $user_token = workflow_ng_token_get_settings(array('user'), $form_values);
+  $settings =  array('acl' => $form_values['acl'], 'user' => $form_values['user']);
+  return $token + $user_token + $settings;
+}
+
+/*
+ * Action: Remove a user from ACL
+ */
+function acl_workflow_ng_remove_user_from_acl($author, $settings, &$arguments, &$log) {
+  //Make sure ACL exists
+  $token = workflow_ng_token_replace_all (array('acl'), $settings, $arguments, $log);
+  $acl_id = acl_get_id_by_name('acl', $token['acl']);
+  if ($acl_id) {
+    //TODO: Check if user not already in ACL
+    acl_remove_user($acl_id, $author->uid);
+  }
+}
+
+/*
+ * Action: Remove a user from ACL form
+ */
+function acl_workflow_ng_remove_user_from_acl_form($settings = array(), $argument_info) {
+  $form = array();
+  $form['acl'] = array(
+    '#type' => 'textfield',
+    '#title' => t('ACL name'),
+    '#description' => t('Enter the name of the ACL.'),
+    '#default_value' => $settings['acl'],
+    '#required' => TRUE,
+  );
+  workflow_ng_token_replacement_help($form, $argument_info);
+  return $form;
+}
+
+function acl_workflow_ng_remove_user_from_acl_submit($form_id, $form_values) {
+  $token = workflow_ng_token_get_settings(array('acl'), $form_values);
+  $settings =  array('acl' => $form_values['acl']);
+  return $token + $settings;
+}
+
+
+/*
+ * Action: Add a node to ACL
+ */
+function acl_workflow_ng_add_node_to_acl($node, $settings, &$arguments, &$log) {
+  //Make sure ACL exists
+  $token = workflow_ng_token_replace_all (array('acl'), $settings, $arguments, $log);
+  $acl_id = acl_get_id_by_name('acl', $token['acl']);
+  if (!$acl_id) {
+    $acl_id = acl_create_new_acl ('acl', $token['acl']);
+  }
+  //TODO: Check if node not already in ACL
+  acl_node_add_acl($node->nid, $acl_id, (boolean)$settings['access_permissions']['view'], (boolean)$settings['access_permissions']['edit'], (boolean)$settings['access_permissions']['delete']);
+   //Make sure new node access grants are written.
+   node_save($node);  
+}
+
+/*
+ * Action: Add a node from ACL form
+ */
+function acl_workflow_ng_add_node_to_acl_form($settings = array(), $argument_info) {
+  $form = array();
+  $form['acl'] = array(
+    '#type' => 'textfield',
+    '#title' => t('ACL name'),
+    '#description' => t('Enter the name of the ACL.'),
+    '#default_value' => $settings['acl'],
+    '#required' => TRUE,
+  );
+  workflow_ng_token_replacement_help($form, $argument_info);
+  $form['access_permissions'] = array(
+    '#type' => 'checkboxes',
+    '#title' => t('Access permissions'),
+    '#description' => t('Select the operations users will have access rights to, when added to the node ACL.'),
+    '#default_value' => $settings['access_permissions'],
+    '#options' => array (
+      'view'=> t('View'), 
+      'edit' => t('Edit'), 
+      'delete' => t('Delete'),
+    ),  
+  );  
+  return $form;
+}
+
+function acl_workflow_ng_add_node_to_acl_submit($form_id, $form_values) {
+  $token = workflow_ng_token_get_settings(array('acl'), $form_values);
+  $settings =  array('acl' => $form_values['acl'], 'access_permissions' => $form_values['access_permissions']);
+  return $token + $settings;
+}
+
+/*
+ * Action: Remove a node from ACL
+ */
+function acl_workflow_ng_remove_node_from_acl($node, $settings, &$arguments, &$log) {
+  //Make sure ACL exists
+  $token = workflow_ng_token_replace_all (array('acl'), $settings, $arguments, $log);
+  $acl_id = acl_get_id_by_name('acl', $token['acl']);
+  if ($acl_id) {
+    //TODO: Check if node not already in ACL
+    acl_node_remove_acl($node->nid, $acl_id);
+   //Make sure new node access grants are written.
+   node_save($node);    
+  }
+}
+
+/*
+ * Action: Remove a node from ACL form
+ */
+function acl_workflow_ng_remove_node_from_acl_form($settings = array(), $argument_info) {
+  $form = array();
+  $form['acl'] = array(
+    '#type' => 'textfield',
+    '#title' => t('ACL name'),
+    '#description' => t('Enter the name of the ACL.'),
+    '#default_value' => $settings['acl'],
+    '#required' => TRUE,
+  );
+  workflow_ng_token_replacement_help($form, $argument_info);
+  return $form;
+}
+
+function acl_workflow_ng_remove_node_from_acl_submit($form_id, $form_values) {
+  $token = workflow_ng_token_get_settings(array('acl'), $form_values);
+  $settings =  array('acl' => $form_values['acl']);
+  return $token + $settings;
+}
+
+/*
+ * Action: Delete a whole ACL(s) from node
+ */
+function acl_workflow_ng_delete_whole_acl($node, $settings, &$arguments, &$log) {
+  //Make sure ACL exists
+  //TODO: Check if node has any ACL defined
+  acl_node_clear_acls($node->nid, 'acl');
+
+  //Make sure new node access grants are written.
+  node_save($node);
+}
+
+
+/*
+ * Action: Delete ACL
+ */
+function acl_workflow_ng_delete_acl($settings, &$arguments, &$log) {
+  //Make sure ACL exists
+  $token = workflow_ng_token_replace_all (array('acl'), $settings, $arguments, $log);
+  $acl_id = acl_get_id_by_name('acl', $token['acl']);
+  if ($acl_id) {
+    //TODO: Check if node not already in ACL
+    acl_delete_acl($acl_id);
+   //Make sure new node access grants are written to all nodes.
+   node_access_rebuild();    
+  }
+}
+
+/*
+ * Action: Delte ACL form
+ */
+function acl_workflow_ng_delete_acl_form($settings = array(), $argument_info) {
+  $form = array();
+  $form['acl'] = array(
+    '#type' => 'textfield',
+    '#title' => t('ACL name'),
+    '#description' => t('Enter the name of the ACL.'),
+    '#default_value' => $settings['acl'],
+    '#required' => TRUE,
+  );
+  workflow_ng_token_replacement_help($form, $argument_info);
+  return $form;
+}
+
+function acl_workflow_ng_delete_acl_submit($form_id, $form_values) {
+  $token = workflow_ng_token_get_settings(array('acl'), $form_values);
+  $settings =  array('acl' => $form_values['acl']);
+  return $token + $settings;
+}
+
+/*
+ * Used by the ACL module
+ */
+function acl_enabled() {
+  return !acl_disabling();
+}
+
+/*
+ * Implementation of hook_disable()
+ */
+function acl_disable() {
+  acl_disabling(TRUE);
+  node_access_rebuild();
+}
+
+/*
+ * Remembers if we have disabled access
+ */
+function acl_disabling($set = NULL) {
+  static $disabling = FALSE;
+
+  if (isset($set)) {
+    $disabling = $set;
+  }
+  return $disabling;
+}
+
+
+
+
