$this->error(__d('cake_console','Node Not Deleted. ').__d('cake_console','There was an error deleting the %s. Node does not exist.',$class)."\n");
}
}
/**
*SetparentforanARO/ACOnode.
*
*@returnvoid
*/
publicfunctionsetParent(){
extract($this->_dataVars());
$target=$this->parseIdentifier($this->args[1]);
$parent=$this->parseIdentifier($this->args[2]);
$data=array(
$class=>array(
'id'=>$this->_getNodeId($class,$target),
'parent_id'=>$this->_getNodeId($class,$parent)
)
);
$this->Acl->{$class}->create();
if(!$this->Acl->{$class}->save($data)){
$this->out(__d('cake_console','Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.'));
}else{
$this->out(__d('cake_console','Node parent set to %s',$this->args[2])."\n");
'help'=>__d('cake_console','Type of node to create.')
);
$parser->description(
__d('cake_console','A console tool for managing the DbAcl')
)->addSubcommand('create',array(
'help'=>__d('cake_console','Create a new ACL node'),
'parser'=>array(
'description'=>__d('cake_console','Creates a new ACL object <node> under the parent'),
'epilog'=>__d('cake_console','You can use `root` as the parent when creating nodes to create top level nodes.'),
'arguments'=>array(
'type'=>$type,
'parent'=>array(
'help'=>__d('cake_console','The node selector for the parent.'),
'required'=>true
),
'alias'=>array(
'help'=>__d('cake_console','The alias to use for the newly created node.'),
'required'=>true
)
)
)
))->addSubcommand('delete',array(
'help'=>__d('cake_console','Deletes the ACL object with the given <node> reference'),
'parser'=>array(
'description'=>__d('cake_console','Delete an ACL node.'),
'arguments'=>array(
'type'=>$type,
'node'=>array(
'help'=>__d('cake_console','The node identifier to delete.'),
'required'=>true,
)
)
)
))->addSubcommand('setparent',array(
'help'=>__d('cake_console','Moves the ACL node under a new parent.'),
'parser'=>array(
'description'=>__d('cake_console','Moves the ACL object specified by <node> beneath <parent>'),
'arguments'=>array(
'type'=>$type,
'node'=>array(
'help'=>__d('cake_console','The node to move'),
'required'=>true,
),
'parent'=>array(
'help'=>__d('cake_console','The new parent for <node>.'),
'required'=>true
)
)
)
))->addSubcommand('getpath',array(
'help'=>__d('cake_console','Print out the path to an ACL node.'),
'parser'=>array(
'description'=>array(
__d('cake_console',"Returns the path to the ACL object specified by <node>."),
__d('cake_console',"This command is useful in determining the inheritance of permissions for a certain object in the tree.")
),
'arguments'=>array(
'type'=>$type,
'node'=>array(
'help'=>__d('cake_console','The node to get the path of'),
'required'=>true,
)
)
)
))->addSubcommand('check',array(
'help'=>__d('cake_console','Check the permissions between an ACO and ARO.'),
'parser'=>array(
'description'=>array(
__d('cake_console','Use this command to check ACL permissions.')
),
'arguments'=>array(
'aro'=>array('help'=>__d('cake_console','ARO to check.'),'required'=>true),
'aco'=>array('help'=>__d('cake_console','ACO to check.'),'required'=>true),
'action'=>array('help'=>__d('cake_console','Action to check'),'default'=>'all')
)
)
))->addSubcommand('grant',array(
'help'=>__d('cake_console','Grant an ARO permissions to an ACO.'),
'parser'=>array(
'description'=>array(
__d('cake_console','Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
),
'arguments'=>array(
'aro'=>array('help'=>__d('cake_console','ARO to grant permission to.'),'required'=>true),
'aco'=>array('help'=>__d('cake_console','ACO to grant access to.'),'required'=>true),
'action'=>array('help'=>__d('cake_console','Action to grant'),'default'=>'all')
)
)
))->addSubcommand('deny',array(
'help'=>__d('cake_console','Deny an ARO permissions to an ACO.'),
'parser'=>array(
'description'=>array(
__d('cake_console','Use this command to deny ACL permissions. Once executed, the ARO specified (and its children, if any) will have DENY access to the specified ACO action (and the ACO\'s children, if any).')
),
'arguments'=>array(
'aro'=>array('help'=>__d('cake_console','ARO to deny.'),'required'=>true),
'aco'=>array('help'=>__d('cake_console','ACO to deny.'),'required'=>true),
'action'=>array('help'=>__d('cake_console','Action to deny'),'default'=>'all')
)
)
))->addSubcommand('inherit',array(
'help'=>__d('cake_console','Inherit an ARO\'s parent permissions.'),
'parser'=>array(
'description'=>array(
__d('cake_console',"Use this command to force a child ARO object to inherit its permissions settings from its parent.")
),
'arguments'=>array(
'aro'=>array('help'=>__d('cake_console','ARO to have permissions inherit.'),'required'=>true),
'aco'=>array('help'=>__d('cake_console','ACO to inherit permissions on.'),'required'=>true),
'action'=>array('help'=>__d('cake_console','Action to inherit'),'default'=>'all')
)
)
))->addSubcommand('view',array(
'help'=>__d('cake_console','View a tree or a single node\'s subtree.'),
'parser'=>array(
'description'=>array(
__d('cake_console',"The view command will return the ARO or ACO tree."),
__d('cake_console',"The optional node parameter allows you to return"),
__d('cake_console',"only a portion of the requested tree.")
),
'arguments'=>array(
'type'=>$type,
'node'=>array('help'=>__d('cake_console','The optional node to view the subtree of.'))
)
)
))->addSubcommand('initdb',array(
'help'=>__d('cake_console','Initialize the DbAcl tables. Uses this command : cake schema create DbAcl')
))->epilog(array(
'Node and parent arguments can be in one of the following formats:',
'',
' - <model>.<id> - The node will be bound to a specific record of the given model.',
'',
' - <alias> - The node will be given a string alias (or path, in the case of <parent>)',
" i.e. 'John'. When used with <parent>, this takes the form of an alias path,",
" i.e. <group>/<subgroup>/<parent>.",
'',
"To add a node at the root level, enter 'root' or '/' as the <parent> parameter."