on cake acl delete <> delete all matching records. Makes more sense than deleting one of possibly many.

This commit is contained in:
sam-at-github 2014-03-29 13:37:08 +11:00
parent 77db212b38
commit a3fe7cd245

View file

@ -143,7 +143,8 @@ class AclShell extends AppShell {
} }
/** /**
* Delete an ARO/ACO node. * Delete an ARO/ACO node. Note there may be (as a result of poor configuration)
* multiple records with the same logical identifier. All are deleted.
* *
* @return void * @return void
*/ */
@ -151,12 +152,18 @@ class AclShell extends AppShell {
extract($this->_dataVars()); extract($this->_dataVars());
$identifier = $this->parseIdentifier($this->args[1]); $identifier = $this->parseIdentifier($this->args[1]);
$nodeId = $this->_getNodeId($class, $identifier); if(is_string($identifier)) {
$identifier = ['alias' => $identifier];
}
if (!$this->Acl->{$class}->delete($nodeId)) { if($this->Acl->{$class}->find('all')) {
$this->error(__d('cake_console', 'Node Not Deleted') . __d('cake_console', 'There was an error deleting the %s. Check that the node exists.', $class) . "\n"); if (!$this->Acl->{$class}->deleteAll($identifier)) {
$this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s.', $class) . "\n");
} }
$this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2); $this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2);
} else {
$this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s. Node does not exist.', $class) . "\n");
}
} }
/** /**