mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #3156 from sam-at-github/acl-shell-delete-all
Make `cake acl delete <acl-object>` delete all matching records.
This commit is contained in:
commit
d3855f869a
1 changed files with 13 additions and 6 deletions
|
@ -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
|
||||
*/
|
||||
|
@ -151,12 +152,18 @@ class AclShell extends AppShell {
|
|||
extract($this->_dataVars());
|
||||
|
||||
$identifier = $this->parseIdentifier($this->args[1]);
|
||||
$nodeId = $this->_getNodeId($class, $identifier);
|
||||
|
||||
if (!$this->Acl->{$class}->delete($nodeId)) {
|
||||
$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 (is_string($identifier)) {
|
||||
$identifier = array('alias' => $identifier);
|
||||
}
|
||||
|
||||
if ($this->Acl->{$class}->find('all', array('conditions' => $identifier))) {
|
||||
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);
|
||||
} 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");
|
||||
}
|
||||
$this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue