Thursday, January 28, 2010

Subversion subfolder access fun

After such a fantastic morning trying to set up subfolder access on various subversion repositories - its nice to share this little gem with anybody that might be interested.

I wanted a user to have read access to a whole project folder, but to restrict write access to just one folder inside the project. According to the docs I read this should work:

[Project1:/]
newuser = r

[Project1:/trunk/graphics]
newuser = rw

But it didn't. After a whole wasted morning, I found - much to my chagrin - that I had to grant rw rights at the root to the new user, and then deny rights where they weren't applicable, to be able to grant write rights (apache with subversion 1.6.6) to a subfolder (read rights worked ok funnily enough).

[/]
newuser = rw

[Project1:/]
newuser = r

[Project1:/trunk/graphics]
newuser = rw

[Project2:/]
newuser =

I suppose there is some kind of logic there, somewhere...

If you're reading this because you're having the same problem -I really do hope I've helped you.

Monday, January 25, 2010

AIR 2 Beta native process and the PHP CLI

With the release of the Adobe Air 2 beta comes a rake of cool new features. The most promising amongst them for future development is the ability to call and communicate with native processes on the machine on which Air is running. This obviously opens up all sorts of possibilities for extending the capacity of AIR without the need for the required API to be a part of AIR itself.

The application I'm building has so far has been slowly growing as a bunch of Flex applications, working with MYSQL via AMFPHP. But as more things are moved into AIR I wanted to get rid of the need for the webserver, in the case of the application working standalone on a local machine with a local installation of a MYSQL database.

Using the new native process API in AIR, and the CLI version of PHP, I've managed to come up with a way of communicating with AMFPHP directly through STDIN and STDOUT without the need for a webserver. The code is in its infancy, but I thought this would be a good time to share the idea and get some comments and input from those of you out there who are working in the same environment.

Rather than trying to post the code here on the blog - I've opened a Google Code project so that anybody who's interested can download the code and develop the idea if they want to. The project is at http://code.google.com/p/aircmdamfphp/ - you can download from subversion or there's a zip that you can download for convenience.

My main concern so far is security. For this to work on in a live application scenario on a user's machine the first consideration would be to have the PHP code compiled and have some way of securing the PHP installation against possible attacks. Any comments and/or suggestions on this or any other areas of concern regarding security on this particular idea would be appreciated. I suppose the other concern might be somebody hooking something in between the parent and child process...

There is a truly annoying caveat with AIR on Windows at the moment. If you install and run an AIR application using the 2 beta you get a command line pop-up window appearing each time you run php.exe (or it seems any other command line executable). I was hoping Adobe would come up with a fix for this before a production version is released, but looking at the Adobe Forums, Chris Thilgen is telling us that it won't be... (apparently its a "feature request" to not show the command window!) http://forums.adobe.com/thread/558533?tstart=0.

Maybe next time eh?