Invoke an additonal action after an event

61 views Asked by At

I'm wondering if there is a pattern for this problem:

I have a ruby webfrontend for CRUD'ing' ftp-users. The backend for the webfrontend is a MySQL DB. The webfrontend is strict separated from the daemon and it's auth-backend (proftpd with sql-mysql or mod_auth_file).

After creating a user via the webgui I would like to invoke the bridge to the daemon backend.

Coding this bridge isn't the problem, I don't have an idea how to put everything together without strong coupling (due to switch the proftpd auth backend).

Thank you.

1

There are 1 answers

1
Professor Todd On

There will be some coupling between your front end and your back end. Assuming you are using a technology like Ruby on Rails for our front end, you can modify your model to do an after_create method that can call some custom ruby code to talk to your proftpd code.

I put my custom ruby code in a rake file in my lib/tasks directory. Depending upon your use case, this can be called from a scheduler (like cron-tab, every hour for maintenance work) or from your model code that represents your user.)

BTW, there is a Chef plugin for proftpd. See http://wiki.opscode.com/display/chef/Home and http://rubyreflector.com/ProFTPD