Hi all, Andreas made up a small JRuby app to register users, think this is pretty amazing! Just for your information. /peter ---------- Forwarded message ---------- From: Andreas Ronge 1. install jruby, http://dist.codehaus.org/jruby/ 2. Check/Update environment vars: set JAVA_HOME (or just have "java" executable in PATH) add $JRUBY_HOME/bin to PATH 3. install rails: gem install rails 4. install ldap ruby library: gem install ruby-net-ldap 5. create a rails project: rails demo 6. cd demo 7. create a controller: jruby script/generate controller UserAdmin 8. edit the app/controllers/upser_admin_controller: require 'rubygems' require 'net/ldap' class UserAdminController < ApplicationController def registration end def add_user @username = params[:username] pwd = params[:password] ldap = Net::LDAP.new ldap.host = 'localhost' ldap.port = 10389 ldap.auth "uid=admin,ou=system", "secret" dn = "uid=#@username,ou=users,ou=system" attributes = { :cn => @username, :objectclass => ["top", "person", "inetorgperson", "organizationalPerson"], :sn => @username } success = ldap.add(:dn => dn, :attributes => attributes) puts "Success #{success}" end end 9. create rhtml files: app/views/user_admin/add_user.rhtml Signed Up

You have now registered with username <%=@username%>

app/views/user_admin/registration.rhtml: Registration

Registration

Please enter user name and password

<% form_tag(:action => :add_user) do %> <%= text_field_tag :username %>
<%= password_field_tag :password %>

<%=submit_tag 'Add'%> <% end %> 10. test it in WEBrick: jruby script/server You can now add a user in the ldap by filling in the html form at http://localhost:3000/user_admin/registration 11. configure which gems should be included in the WAR file you need to tell which gems should be packed in the WAR file by adding file config/war.rb: add_gem 'ruby-net-ldap' 12. create WAR rake war:standalone:create 13. run it in jetty rake war:standalone:run