Guest User

Untitled

a guest
Sep 16th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. Moving net-ldap query into model
  2. treebase = "OU=Organisation,DC=foo,DC=com"
  3. filter = Net::LDAP::Filter.eq( "cn", "#{CGI.escape(params[:collect])}" )
  4. attrs = ["givenname", "cn", "mail"]
  5. host = "somehost"
  6. port = "389"
  7. base = "OU=Organisation,DC=foo,DC=com"
  8. username = "CN=Foo"
  9. password = "bar"
  10.  
  11. @collection = Net::LDAP.open( :host => host, :port => port, :base => base, :auth => {:method => :simple, :username => username , :password => password} ) do |ldap|ldap.search( :base => treebase, :attributes => attrs, :filter => filter)
  12. end
  13.  
  14. <%= form_tag new_ticket_path(@ticket), :method => 'get' do %>
  15. <p>
  16. <%= text_field_tag :collect, params[:collect] %>
  17. <%= submit_tag "Weiter", :name => nil %>
  18. </p>
  19. <% end %>
  20.  
  21. @collection = Ticket.ldap(params[:collect])
  22.  
  23. <%= f.text_field :supervisor, :value => @collection.first.mail.first %>
  24.  
  25. wrong number of arguments (1 for 0)
Add Comment
Please, Sign In to add comment