Posts Tagged ‘cli’


CakePHP Console ACL Help File

Sunday, March 22nd, 2009

Every now and then I want to view my help files in pretty, formatted HTML instead of plain text in a text editor or terminal window. Right now I’m working on setting up some Access Control Lists (ACL) in the CakePHP Console. ACL is a powerful, yet sometimes hard-to-grasp concept. I always figure that if I want a resource like this, there has to be someone else out there who does, so for your reference and mine, here it is. (By the way, to get to this from the console, simply type cake acl help.)

Usage: cake acl <command> <arg1> <arg2>...
———————————————–
Commands:

create aro|aco <parent> <node>
Creates a new ACL object <node> under the parent specified by <parent>, an id/alias.
The <parent> and <node> references 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.

delete aro|aco <node>
Deletes the ACL object with the given <node> reference (see ‘create’ for info on node references).

setParent aro|aco <node> <parent>
Moves the ACL object specified by <node> beneath the parent ACL object specified by <parent>.
To identify the node and parent, use the row id.

getPath aro|aco <node>
Returns the path to the ACL object specified by <node>. This command is useful in determining the inhertiance of permissions for a certain object in the tree.
For more detailed parameter usage info, see help for the ‘create’ command.

check <aro_id> <aco_id> [<aco_action>] or all
Use this command to check ACL permissions.
For more detailed parameter usage info, see help for the ‘create’ command.

grant <aro_id> <aco_id> [<aco_action>] or all
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). For more detailed parameter usage info, see help for the ‘create’ command.

deny <aro_id> <aco_id> [<aco_action>]or all
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). For more detailed parameter usage info, see help for the ‘create’ command.

inherit <aro_id> <aco_id> [<aco_action>]or all
Use this command to force a child ARO object to inherit its permissions settings from its parent. For more detailed parameter usage info, see help for the ‘create’ command.

view aro|aco [<node>]
The view command will return the ARO or ACO tree. The optional id/alias parameter allows you to return only a portion of the requested tree. For more detailed parameter usage info, see help for the ‘create’ command.

initdb
Uses this command : cake schema run create DbAcl

help [<command>]
Displays this help message, or a message on a specific command.

The ‘create’ help file

Usage: cake acl <command> <arg1> <arg2>…
———————————————–

  • Commands:
    • create aro|aco <parent> <node>
      • Creates a new ACL object <node> under the parent specified by <parent>, an id/alias. The <parent> and <node> references 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.

Wordpress’ Auto Update Is OK, But The Command Line Is Faster

Tuesday, November 25th, 2008

I recently found a great article about upgrading Wordpress from the command line. If you’re familiar with a command line interface at all, it’s by far the simplest way to upgrade your Wordpress install.

You can apply the same method to upgrading your Wordpress plugins.

  1. Log in to your web server and cd to the Wordpress plugins directory:
    cd httpdocs/wp-content/plugins

    Your syntax may vary depending on your server.
  2. Download the new version of the plugin. In my case I’m upgrading the Social Homes plug in.
    wget http://downloads.wordpress.org/plugin/social-homes.2.3.zip
  3. Back up your current plugin directory
    tar -zcvf social-homes.tar.gz social-homes
  4. Unzip the zip file of the new version
    unzip social-homes.2.3.zip

    • You’ll be prompted to confirm you want to overwrite the files in the social-homes directory
      replace social-homes/COPYING.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename:
    • Type ‘A’ and hit return to overwrite the old files with the new ones.
  5. Log into Wordpress to make sure the upgrade worked by going to the “Plugins” panel in the admin area.
  6. Clean up your mess
    rm social-homes.2.3.zip
    rm social-homes.tar.gz

You’re done. You’ve successfully upgraded your plugin. This process can be much faster than downloading the plugin to your local directory, deactivating it in Wordpress and uploading the new one. Especially if the plugin is a large one.