activeldap3 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/CHANGES +691 -0
- data/COPYING +340 -0
- data/LICENSE +58 -0
- data/README +154 -0
- data/Rakefile +121 -0
- data/TODO +32 -0
- data/activeldap3.gemspec +18 -0
- data/benchmark/bench-al.rb +263 -0
- data/benchmark/config.yaml.sample +5 -0
- data/examples/al-admin/README +182 -0
- data/examples/al-admin/Rakefile +16 -0
- data/examples/al-admin/app/controllers/account_controller.rb +60 -0
- data/examples/al-admin/app/controllers/application_controller.rb +46 -0
- data/examples/al-admin/app/controllers/attributes_controller.rb +17 -0
- data/examples/al-admin/app/controllers/directory_controller.rb +49 -0
- data/examples/al-admin/app/controllers/object_classes_controller.rb +17 -0
- data/examples/al-admin/app/controllers/syntaxes_controller.rb +17 -0
- data/examples/al-admin/app/controllers/users_controller.rb +66 -0
- data/examples/al-admin/app/controllers/welcome_controller.rb +12 -0
- data/examples/al-admin/app/helpers/account_helper.rb +2 -0
- data/examples/al-admin/app/helpers/application_helper.rb +46 -0
- data/examples/al-admin/app/helpers/attributes_helper.rb +15 -0
- data/examples/al-admin/app/helpers/directory_helper.rb +7 -0
- data/examples/al-admin/app/helpers/object_classes_helper.rb +10 -0
- data/examples/al-admin/app/helpers/syntaxes_helper.rb +10 -0
- data/examples/al-admin/app/helpers/url_helper.rb +17 -0
- data/examples/al-admin/app/helpers/users_helper.rb +17 -0
- data/examples/al-admin/app/helpers/welcome_helper.rb +2 -0
- data/examples/al-admin/app/models/entry.rb +23 -0
- data/examples/al-admin/app/models/ldap_user.rb +58 -0
- data/examples/al-admin/app/models/user.rb +91 -0
- data/examples/al-admin/app/views/_entry/_attributes_information.html.erb +29 -0
- data/examples/al-admin/app/views/_entry/_entry.html.erb +15 -0
- data/examples/al-admin/app/views/_schema/_aliases.html.erb +7 -0
- data/examples/al-admin/app/views/_switcher/_after.html.erb +2 -0
- data/examples/al-admin/app/views/_switcher/_before.html.erb +5 -0
- data/examples/al-admin/app/views/account/login.html.erb +26 -0
- data/examples/al-admin/app/views/account/sign_up.html.erb +29 -0
- data/examples/al-admin/app/views/attributes/_attributes.html.erb +19 -0
- data/examples/al-admin/app/views/attributes/_detail.html.erb +29 -0
- data/examples/al-admin/app/views/attributes/index.html.erb +3 -0
- data/examples/al-admin/app/views/attributes/show.html.erb +31 -0
- data/examples/al-admin/app/views/directory/_tree.html.erb +10 -0
- data/examples/al-admin/app/views/directory/_tree_view_js.html.erb +25 -0
- data/examples/al-admin/app/views/directory/index.html.erb +13 -0
- data/examples/al-admin/app/views/directory/populate.html.erb +2 -0
- data/examples/al-admin/app/views/layouts/_footer.html.erb +11 -0
- data/examples/al-admin/app/views/layouts/_header_menu.html.erb +10 -0
- data/examples/al-admin/app/views/layouts/_main_menu.html.erb +18 -0
- data/examples/al-admin/app/views/layouts/application.html.erb +57 -0
- data/examples/al-admin/app/views/object_classes/_attributes.html.erb +28 -0
- data/examples/al-admin/app/views/object_classes/_object_classes.html.erb +19 -0
- data/examples/al-admin/app/views/object_classes/index.html.erb +3 -0
- data/examples/al-admin/app/views/object_classes/show.html.erb +39 -0
- data/examples/al-admin/app/views/syntaxes/_detail.html.erb +14 -0
- data/examples/al-admin/app/views/syntaxes/_syntaxes.html.erb +19 -0
- data/examples/al-admin/app/views/syntaxes/index.html.erb +3 -0
- data/examples/al-admin/app/views/syntaxes/show.html.erb +22 -0
- data/examples/al-admin/app/views/users/_attributes_update_form.html.erb +42 -0
- data/examples/al-admin/app/views/users/_form.html.erb +13 -0
- data/examples/al-admin/app/views/users/_object_classes_update_form.html.erb +46 -0
- data/examples/al-admin/app/views/users/_password_change_form.html.erb +20 -0
- data/examples/al-admin/app/views/users/edit.html.erb +15 -0
- data/examples/al-admin/app/views/users/index.html.erb +10 -0
- data/examples/al-admin/app/views/users/show.html.erb +11 -0
- data/examples/al-admin/app/views/welcome/index.html.erb +13 -0
- data/examples/al-admin/config.ru +7 -0
- data/examples/al-admin/config/boot.rb +110 -0
- data/examples/al-admin/config/database.yml.example +19 -0
- data/examples/al-admin/config/environment.rb +73 -0
- data/examples/al-admin/config/environments/development.rb +17 -0
- data/examples/al-admin/config/environments/production.rb +24 -0
- data/examples/al-admin/config/environments/test.rb +22 -0
- data/examples/al-admin/config/initializers/exception_notifier.rb +2 -0
- data/examples/al-admin/config/initializers/fast_gettext.rb +3 -0
- data/examples/al-admin/config/initializers/inflections.rb +10 -0
- data/examples/al-admin/config/initializers/mime_types.rb +5 -0
- data/examples/al-admin/config/initializers/session_store.rb +23 -0
- data/examples/al-admin/config/ldap.yml.example +21 -0
- data/examples/al-admin/config/routes.rb +58 -0
- data/examples/al-admin/db/migrate/001_create_users.rb +16 -0
- data/examples/al-admin/doc/README_FOR_APP +2 -0
- data/examples/al-admin/lib/authenticated_system.rb +124 -0
- data/examples/al-admin/lib/authenticated_test_helper.rb +113 -0
- data/examples/al-admin/lib/ldap_test_helper.rb +38 -0
- data/examples/al-admin/lib/tasks/testing.rake +10 -0
- data/examples/al-admin/po/en/al-admin.po +343 -0
- data/examples/al-admin/po/ja/al-admin.po +343 -0
- data/examples/al-admin/po/nl/al-admin.po +380 -0
- data/examples/al-admin/public/.htaccess +40 -0
- data/examples/al-admin/public/404.html +30 -0
- data/examples/al-admin/public/500.html +30 -0
- data/examples/al-admin/public/dispatch.cgi +10 -0
- data/examples/al-admin/public/dispatch.fcgi +24 -0
- data/examples/al-admin/public/dispatch.rb +10 -0
- data/examples/al-admin/public/favicon.ico +0 -0
- data/examples/al-admin/public/images/active-ldap.svg +6351 -0
- data/examples/al-admin/public/images/al-admin.png +0 -0
- data/examples/al-admin/public/images/al-admin.svg +6371 -0
- data/examples/al-admin/public/images/header-background.png +0 -0
- data/examples/al-admin/public/images/header-background.svg +99 -0
- data/examples/al-admin/public/images/rails.png +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_left_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_left_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_middle_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_middle_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_right_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_right_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_bottom_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_bottom_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_bottom_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_left_down_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_left_up_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_middle_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_middle_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_right_down_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_right_up_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_top_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_top_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_top_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/barchart_h.gif +0 -0
- data/examples/al-admin/public/images/spinelz/barchart_v.gif +0 -0
- data/examples/al-admin/public/images/spinelz/button.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_default_handler.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_delete.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_next_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_pre.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_pre_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_private_icon.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_schedule.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calender_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calender_back_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_back_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_next_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_pre.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_pre_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_back_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_next_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_pre.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_pre_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/grid_down.gif +0 -0
- data/examples/al-admin/public/images/spinelz/grid_state.gif +0 -0
- data/examples/al-admin/public/images/spinelz/grid_up.gif +0 -0
- data/examples/al-admin/public/images/spinelz/icon_day.gif +0 -0
- data/examples/al-admin/public/images/spinelz/icon_month.gif +0 -0
- data/examples/al-admin/public/images/spinelz/icon_week.gif +0 -0
- data/examples/al-admin/public/images/spinelz/menubar_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/menubar_subcontents_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_left_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_left_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_middle_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_middle_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_right_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_right_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/select_date.gif +0 -0
- data/examples/al-admin/public/images/spinelz/selectabletable_selected.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_about.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_menu.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_sample.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabBottomActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabBottomInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleActive2.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleInactive2.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabTopActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabTopInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabbar.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sortableTable_down.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sortableTable_normal.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sortableTable_up.gif +0 -0
- data/examples/al-admin/public/images/spinelz/switcher_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/switcher_open.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabLeftActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabLeftInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabMiddleActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabMiddleInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabRightActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabRightInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tab_bar.gif +0 -0
- data/examples/al-admin/public/images/spinelz/table_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/timepicker_clock.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_max.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_min.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_dir.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_file.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_group.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_group_special.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_state.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_user.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_bottom_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_bottom_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_bottom_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_max.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_middle_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_middle_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_min.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_top_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_top_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_top_right.gif +0 -0
- data/examples/al-admin/public/javascripts/application.js +2 -0
- data/examples/al-admin/public/javascripts/controls.js +963 -0
- data/examples/al-admin/public/javascripts/dragdrop.js +973 -0
- data/examples/al-admin/public/javascripts/effects.js +1128 -0
- data/examples/al-admin/public/javascripts/prototype.js +4320 -0
- data/examples/al-admin/public/javascripts/spinelz/accordion.js +185 -0
- data/examples/al-admin/public/javascripts/spinelz/ajaxHistory.js +157 -0
- data/examples/al-admin/public/javascripts/spinelz/balloon.js +287 -0
- data/examples/al-admin/public/javascripts/spinelz/barchart.js +524 -0
- data/examples/al-admin/public/javascripts/spinelz/calendar.js +3012 -0
- data/examples/al-admin/public/javascripts/spinelz/colorpicker.js +128 -0
- data/examples/al-admin/public/javascripts/spinelz/datepicker.js +438 -0
- data/examples/al-admin/public/javascripts/spinelz/grid.js +1391 -0
- data/examples/al-admin/public/javascripts/spinelz/grid_resizeEx.js +100 -0
- data/examples/al-admin/public/javascripts/spinelz/grid_sortabletableEx.js +129 -0
- data/examples/al-admin/public/javascripts/spinelz/inplaceEditorEx.js +148 -0
- data/examples/al-admin/public/javascripts/spinelz/menubar.js +232 -0
- data/examples/al-admin/public/javascripts/spinelz/navPanel.js +170 -0
- data/examples/al-admin/public/javascripts/spinelz/selectableTable.js +433 -0
- data/examples/al-admin/public/javascripts/spinelz/sideBarBox.js +282 -0
- data/examples/al-admin/public/javascripts/spinelz/sideBarBox_effects.js +83 -0
- data/examples/al-admin/public/javascripts/spinelz/sortableTable.js +270 -0
- data/examples/al-admin/public/javascripts/spinelz/switcher.js +78 -0
- data/examples/al-admin/public/javascripts/spinelz/tabBox.js +469 -0
- data/examples/al-admin/public/javascripts/spinelz/timepicker.js +384 -0
- data/examples/al-admin/public/javascripts/spinelz/toolbar.js +152 -0
- data/examples/al-admin/public/javascripts/spinelz/treeview.js +703 -0
- data/examples/al-admin/public/javascripts/spinelz/window.js +641 -0
- data/examples/al-admin/public/javascripts/spinelz/window_resizeEx.js +130 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/builder.js +131 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/controls.js +835 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/dragdrop.js +944 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/effects.js +1090 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/json.js +139 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/prototype.js +2515 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/resize.js +215 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/scriptaculous.js +51 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/slider.js +278 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/spinelz_util.js +1266 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/unittest.js +564 -0
- data/examples/al-admin/public/robots.txt +1 -0
- data/examples/al-admin/public/stylesheets/account.css +41 -0
- data/examples/al-admin/public/stylesheets/attributes.css +1 -0
- data/examples/al-admin/public/stylesheets/base.css +104 -0
- data/examples/al-admin/public/stylesheets/detail.css +36 -0
- data/examples/al-admin/public/stylesheets/directory.css +22 -0
- data/examples/al-admin/public/stylesheets/object-classes.css +6 -0
- data/examples/al-admin/public/stylesheets/rails.css +35 -0
- data/examples/al-admin/public/stylesheets/spinelz/accordion.css +59 -0
- data/examples/al-admin/public/stylesheets/spinelz/balloon.css +151 -0
- data/examples/al-admin/public/stylesheets/spinelz/calendar.css +564 -0
- data/examples/al-admin/public/stylesheets/spinelz/datepicker.css +175 -0
- data/examples/al-admin/public/stylesheets/spinelz/grid.css +137 -0
- data/examples/al-admin/public/stylesheets/spinelz/menubar.css +78 -0
- data/examples/al-admin/public/stylesheets/spinelz/modal.css +22 -0
- data/examples/al-admin/public/stylesheets/spinelz/navPanel.css +58 -0
- data/examples/al-admin/public/stylesheets/spinelz/selectableTable.css +28 -0
- data/examples/al-admin/public/stylesheets/spinelz/sideBarBox.css +82 -0
- data/examples/al-admin/public/stylesheets/spinelz/sortableTable.css +51 -0
- data/examples/al-admin/public/stylesheets/spinelz/switcher.css +23 -0
- data/examples/al-admin/public/stylesheets/spinelz/tabBox.css +94 -0
- data/examples/al-admin/public/stylesheets/spinelz/timepicker.css +508 -0
- data/examples/al-admin/public/stylesheets/spinelz/toolbar.css +82 -0
- data/examples/al-admin/public/stylesheets/spinelz/treeview.css +121 -0
- data/examples/al-admin/public/stylesheets/spinelz/window.css +140 -0
- data/examples/al-admin/public/stylesheets/structure.css +81 -0
- data/examples/al-admin/public/stylesheets/syntaxes.css +1 -0
- data/examples/al-admin/public/stylesheets/users.css +13 -0
- data/examples/al-admin/public/stylesheets/welcome.css +0 -0
- data/examples/al-admin/script/about +3 -0
- data/examples/al-admin/script/console +3 -0
- data/examples/al-admin/script/dbconsole +3 -0
- data/examples/al-admin/script/destroy +3 -0
- data/examples/al-admin/script/generate +3 -0
- data/examples/al-admin/script/performance/benchmarker +3 -0
- data/examples/al-admin/script/performance/profiler +3 -0
- data/examples/al-admin/script/performance/request +3 -0
- data/examples/al-admin/script/plugin +3 -0
- data/examples/al-admin/script/process/inspector +3 -0
- data/examples/al-admin/script/process/reaper +3 -0
- data/examples/al-admin/script/process/spawner +3 -0
- data/examples/al-admin/script/runner +3 -0
- data/examples/al-admin/script/server +3 -0
- data/examples/al-admin/test/fixtures/users.yml +9 -0
- data/examples/al-admin/test/functional/account_controller_test.rb +12 -0
- data/examples/al-admin/test/functional/attributes_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/directory_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/object_classes_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/syntaxes_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/users_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/welcome_controller_test.rb +8 -0
- data/examples/al-admin/test/integration/sign_up_test.rb +44 -0
- data/examples/al-admin/test/run-test.sh +3 -0
- data/examples/al-admin/test/test_helper.rb +52 -0
- data/examples/al-admin/test/unit/user_test.rb +12 -0
- data/examples/al-admin/vendor/plugins/exception_notification/README +111 -0
- data/examples/al-admin/vendor/plugins/exception_notification/init.rb +1 -0
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifiable.rb +99 -0
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier.rb +66 -0
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier_helper.rb +78 -0
- data/examples/al-admin/vendor/plugins/exception_notification/test/exception_notifier_helper_test.rb +61 -0
- data/examples/al-admin/vendor/plugins/exception_notification/test/test_helper.rb +7 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml +1 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml +7 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml +16 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml +4 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml +2 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml +3 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml +6 -0
- data/examples/config.yaml.example +5 -0
- data/examples/example.der +0 -0
- data/examples/example.jpg +0 -0
- data/examples/groupadd +41 -0
- data/examples/groupdel +35 -0
- data/examples/groupls +49 -0
- data/examples/groupmod +42 -0
- data/examples/lpasswd +55 -0
- data/examples/objects/group.rb +13 -0
- data/examples/objects/ou.rb +4 -0
- data/examples/objects/user.rb +20 -0
- data/examples/ouadd +38 -0
- data/examples/useradd +45 -0
- data/examples/useradd-binary +53 -0
- data/examples/userdel +34 -0
- data/examples/userls +50 -0
- data/examples/usermod +42 -0
- data/examples/usermod-binary-add +50 -0
- data/examples/usermod-binary-add-time +54 -0
- data/examples/usermod-binary-del +48 -0
- data/examples/usermod-lang-add +43 -0
- data/lib/active_ldap.rb +105 -0
- data/lib/active_ldap/action_controller/ldap_benchmarking.rb +55 -0
- data/lib/active_ldap/acts/tree.rb +75 -0
- data/lib/active_ldap/adapter/base.rb +705 -0
- data/lib/active_ldap/adapter/jndi.rb +184 -0
- data/lib/active_ldap/adapter/jndi_connection.rb +185 -0
- data/lib/active_ldap/adapter/ldap.rb +290 -0
- data/lib/active_ldap/adapter/ldap_ext.rb +105 -0
- data/lib/active_ldap/adapter/net_ldap.rb +309 -0
- data/lib/active_ldap/adapter/net_ldap_ext.rb +23 -0
- data/lib/active_ldap/association/belongs_to.rb +47 -0
- data/lib/active_ldap/association/belongs_to_many.rb +58 -0
- data/lib/active_ldap/association/children.rb +21 -0
- data/lib/active_ldap/association/collection.rb +105 -0
- data/lib/active_ldap/association/has_many.rb +31 -0
- data/lib/active_ldap/association/has_many_utils.rb +44 -0
- data/lib/active_ldap/association/has_many_wrap.rb +62 -0
- data/lib/active_ldap/association/proxy.rb +107 -0
- data/lib/active_ldap/associations.rb +202 -0
- data/lib/active_ldap/attributes.rb +184 -0
- data/lib/active_ldap/base.rb +1594 -0
- data/lib/active_ldap/callbacks.rb +52 -0
- data/lib/active_ldap/command.rb +49 -0
- data/lib/active_ldap/compatible.rb +44 -0
- data/lib/active_ldap/configuration.rb +147 -0
- data/lib/active_ldap/connection.rb +294 -0
- data/lib/active_ldap/distinguished_name.rb +291 -0
- data/lib/active_ldap/entry_attribute.rb +78 -0
- data/lib/active_ldap/escape.rb +12 -0
- data/lib/active_ldap/get_text.rb +9 -0
- data/lib/active_ldap/get_text/parser.rb +161 -0
- data/lib/active_ldap/get_text_fallback.rb +60 -0
- data/lib/active_ldap/get_text_support.rb +20 -0
- data/lib/active_ldap/helper.rb +92 -0
- data/lib/active_ldap/human_readable.rb +132 -0
- data/lib/active_ldap/ldap_error.rb +74 -0
- data/lib/active_ldap/ldif.rb +930 -0
- data/lib/active_ldap/object_class.rb +95 -0
- data/lib/active_ldap/operations.rb +610 -0
- data/lib/active_ldap/populate.rb +53 -0
- data/lib/active_ldap/railtie.rb +31 -0
- data/lib/active_ldap/schema.rb +699 -0
- data/lib/active_ldap/schema/syntaxes.rb +417 -0
- data/lib/active_ldap/timeout.rb +75 -0
- data/lib/active_ldap/timeout_stub.rb +17 -0
- data/lib/active_ldap/user_password.rb +92 -0
- data/lib/active_ldap/validations.rb +229 -0
- data/lib/active_ldap/xml.rb +122 -0
- data/po/en/active-ldap.po +4029 -0
- data/po/ja/active-ldap.po +4060 -0
- data/rails_generators/model_active_ldap/USAGE +17 -0
- data/rails_generators/model_active_ldap/model_active_ldap_generator.rb +69 -0
- data/rails_generators/model_active_ldap/templates/model_active_ldap.rb +3 -0
- data/rails_generators/model_active_ldap/templates/unit_test.rb +8 -0
- data/rails_generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +7 -0
- data/rails_generators/scaffold_active_ldap/templates/ldap.yml +18 -0
- data/test/al-test-utils.rb +439 -0
- data/test/command.rb +112 -0
- data/test/config.yaml.sample +6 -0
- data/test/fixtures/lower_case_object_class_schema.rb +802 -0
- data/test/run-test.rb +44 -0
- data/test/test_acts_as_tree.rb +60 -0
- data/test/test_adapter.rb +121 -0
- data/test/test_associations.rb +664 -0
- data/test/test_attributes.rb +117 -0
- data/test/test_base.rb +1177 -0
- data/test/test_base_per_instance.rb +61 -0
- data/test/test_bind.rb +62 -0
- data/test/test_callback.rb +37 -0
- data/test/test_configuration.rb +40 -0
- data/test/test_connection.rb +82 -0
- data/test/test_connection_per_class.rb +112 -0
- data/test/test_connection_per_dn.rb +112 -0
- data/test/test_dn.rb +172 -0
- data/test/test_find.rb +176 -0
- data/test/test_groupadd.rb +50 -0
- data/test/test_groupdel.rb +46 -0
- data/test/test_groupls.rb +107 -0
- data/test/test_groupmod.rb +51 -0
- data/test/test_ldif.rb +1891 -0
- data/test/test_load.rb +133 -0
- data/test/test_lpasswd.rb +75 -0
- data/test/test_object_class.rb +74 -0
- data/test/test_reflection.rb +182 -0
- data/test/test_schema.rb +559 -0
- data/test/test_syntax.rb +383 -0
- data/test/test_user.rb +217 -0
- data/test/test_user_password.rb +101 -0
- data/test/test_useradd-binary.rb +62 -0
- data/test/test_useradd.rb +57 -0
- data/test/test_userdel.rb +48 -0
- data/test/test_userls.rb +91 -0
- data/test/test_usermod-binary-add-time.rb +65 -0
- data/test/test_usermod-binary-add.rb +64 -0
- data/test/test_usermod-binary-del.rb +66 -0
- data/test/test_usermod-lang-add.rb +60 -0
- data/test/test_usermod.rb +58 -0
- data/test/test_validation.rb +274 -0
- metadata +502 -0
data/Rakefile
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require 'find'
|
6
|
+
|
7
|
+
base_dir = File.expand_path(File.dirname(__FILE__))
|
8
|
+
$LOAD_PATH.unshift(File.join(base_dir, 'lib'))
|
9
|
+
require 'active_ldap'
|
10
|
+
|
11
|
+
truncate_base_dir = Proc.new do |x|
|
12
|
+
x.gsub(/\A#{Regexp.escape(base_dir + File::SEPARATOR)}/, '')
|
13
|
+
end
|
14
|
+
|
15
|
+
manifest = File.join(base_dir, "Manifest.txt")
|
16
|
+
manifest_contents = []
|
17
|
+
base_dir_included_components = %w(CHANGES COPYING LICENSE Manifest.txt
|
18
|
+
README Rakefile TODO)
|
19
|
+
excluded_components = %w(.svn .test-result .config doc log tmp
|
20
|
+
pkg html config.yaml database.yml ldap.yml)
|
21
|
+
excluded_suffixes = %w(.help .sqlite3)
|
22
|
+
white_list_paths =
|
23
|
+
[
|
24
|
+
"rails/plugin/active_ldap/generators/scaffold_al/templates/ldap.yml",
|
25
|
+
"rails_generators/scaffold_active_ldap/templates/ldap.yml",
|
26
|
+
]
|
27
|
+
Find.find(base_dir + File::SEPARATOR) do |target|
|
28
|
+
target = truncate_base_dir[target]
|
29
|
+
components = target.split(File::SEPARATOR)
|
30
|
+
next if components.empty?
|
31
|
+
if components.size == 1 and !File.directory?(target)
|
32
|
+
next unless base_dir_included_components.include?(components[0])
|
33
|
+
end
|
34
|
+
unless white_list_paths.include?(target)
|
35
|
+
Find.prune if (excluded_components - components) != excluded_components
|
36
|
+
next if excluded_suffixes.include?(File.extname(target))
|
37
|
+
end
|
38
|
+
manifest_contents << target if File.file?(target)
|
39
|
+
end
|
40
|
+
|
41
|
+
File.open(manifest, "w") do |f|
|
42
|
+
f.puts manifest_contents.sort.join("\n")
|
43
|
+
end
|
44
|
+
at_exit do
|
45
|
+
FileUtils.rm_f(manifest)
|
46
|
+
end
|
47
|
+
|
48
|
+
# For Hoe's no user friendly default behavior. :<
|
49
|
+
File.open("README.txt", "w") {|file| file << "= Dummy README\n== XXX\n"}
|
50
|
+
FileUtils.cp("CHANGES", "History.txt")
|
51
|
+
at_exit do
|
52
|
+
FileUtils.rm_f("README.txt")
|
53
|
+
FileUtils.rm_f("History.txt")
|
54
|
+
end
|
55
|
+
|
56
|
+
ENV["VERSION"] = ActiveLdap::VERSION
|
57
|
+
project = Hoe.spec('activeldap') do
|
58
|
+
self.version = ActiveLdap::VERSION
|
59
|
+
self.rubyforge_name = 'ruby-activeldap'
|
60
|
+
self.author = ['Will Drewry', 'Kouhei Sutou']
|
61
|
+
self.email = ['redpig@dataspill.org', 'kou@cozmixng.org']
|
62
|
+
self.summary = 'ActiveLdap is a object-oriented API to LDAP'
|
63
|
+
self.url = 'http://rubyforge.org/projects/ruby-activeldap/'
|
64
|
+
self.test_globs = ['test/test_*.rb']
|
65
|
+
self.changes = self.paragraphs_of('CHANGES', 1..2).join("\n\n")
|
66
|
+
self.extra_deps = [
|
67
|
+
# ['ruby-ldap', '= 0.9.9'],
|
68
|
+
# ['net-ldap', '= 0.1.1'],
|
69
|
+
['activerecord', '= 2.3.8'],
|
70
|
+
['locale', '= 2.0.5'],
|
71
|
+
['gettext', '= 2.1.0'],
|
72
|
+
['fast_gettext', '= 0.5.8'],
|
73
|
+
['gettext_i18n_rails', '= 0.2.2'],
|
74
|
+
]
|
75
|
+
self.remote_rdoc_dir = "doc"
|
76
|
+
self.rsync_args += " --chmod=Dg+ws,Fg+w"
|
77
|
+
self.description = String.new(<<-EOF)
|
78
|
+
'ActiveLdap' is a ruby extension library which provides a clean
|
79
|
+
objected oriented interface to the Ruby/LDAP library. It was inspired
|
80
|
+
by ActiveRecord. This is not nearly as clean or as flexible as
|
81
|
+
ActiveRecord, but it is still trivial to define new objects and manipulate
|
82
|
+
them with minimal difficulty.
|
83
|
+
EOF
|
84
|
+
end
|
85
|
+
|
86
|
+
project.spec.extra_rdoc_files = ["README", "CHANGES", "COPYING", "LICENSE"]
|
87
|
+
|
88
|
+
publish_docs_actions = task(:publish_docs).instance_variable_get("@actions")
|
89
|
+
original_project_name = nil
|
90
|
+
before_publish_docs = Proc.new do
|
91
|
+
original_project_name = project.name
|
92
|
+
project.name = "doc"
|
93
|
+
end
|
94
|
+
after_publish_docs = Proc.new do
|
95
|
+
project.name = original_project_name
|
96
|
+
end
|
97
|
+
publish_docs_actions.unshift(before_publish_docs)
|
98
|
+
publish_docs_actions.push(after_publish_docs)
|
99
|
+
|
100
|
+
|
101
|
+
rdoc_main = "lib/active_ldap.rb"
|
102
|
+
project.spec.rdoc_options.each do |option|
|
103
|
+
option.replace(rdoc_main) if option == "README.txt"
|
104
|
+
end
|
105
|
+
ObjectSpace.each_object(Rake::RDocTask) do |task|
|
106
|
+
task.main = rdoc_main if task.main == "README.txt"
|
107
|
+
task.rdoc_files = project.spec.require_paths + project.spec.extra_rdoc_files
|
108
|
+
end
|
109
|
+
|
110
|
+
begin
|
111
|
+
require "gettext_i18n_rails/tasks"
|
112
|
+
rescue LoadError
|
113
|
+
puts "gettext_i18n_rails is not installed, you probably should run 'rake gems:install' or 'bundle install'."
|
114
|
+
end
|
115
|
+
|
116
|
+
desc 'Tag the repository for release.'
|
117
|
+
task :tag do
|
118
|
+
system "svn copy -m 'New release tag' https://ruby-activeldap.googlecode.com/svn/trunk https://ruby-activeldap.googlecode.com/svn/tags/r#{ActiveLdap::VERSION}"
|
119
|
+
end
|
120
|
+
|
121
|
+
# vim: syntax=ruby
|
data/TODO
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
- [1.1.x] add :readonly option to :has_many.
|
2
|
+
- Work as framework on Rails.
|
3
|
+
- How to support dSCorePropagationData? ignore it?
|
4
|
+
all systemOnly == "TRUE" attribute can be ignored?
|
5
|
+
- Add parsing position to DistinguishedNameInvalid error like
|
6
|
+
<NAME=VALUE,INVALID_HERE>@<REST=INPUT>.
|
7
|
+
- Support TLS optioins (e.g. CA certification file and so on)
|
8
|
+
- Provide FormHelper for LDAP entry's attribute to handle multiple values
|
9
|
+
(["foo", "bar", ...]) and option value ({"binary" => "..."},
|
10
|
+
{"lang-en-us" => "..."})
|
11
|
+
- Test SASL bind.
|
12
|
+
- Add result pagination via LDAP::Controls
|
13
|
+
- serialize & serialized_attributes
|
14
|
+
- schema mgmt - how does AR handle it?
|
15
|
+
- columns() -- ?
|
16
|
+
http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000865
|
17
|
+
- provide full documentation for new API.
|
18
|
+
- handle all exception raised from Ruby/LDAP and wrap as
|
19
|
+
ActiveLdap exception. I think we need to develop an
|
20
|
+
application using ActiveLdap.
|
21
|
+
- Add locking around Timeout.alarm() to ensure a multithreaded ruby
|
22
|
+
app doesn't hit any race conditions
|
23
|
+
- Add AR matching exceptions:
|
24
|
+
* ActiveRecordError -- ActiveLdapError as base
|
25
|
+
* AssociationTypeMismatch
|
26
|
+
* SerializationTypeMismatch
|
27
|
+
* ConnectionNotEstablished
|
28
|
+
* RecordNotFound
|
29
|
+
* LdapActionInvalid - like StatementInvalid
|
30
|
+
* MultiparameterAssignmentErrors
|
31
|
+
* AttributeAssignmentError
|
32
|
+
* RecordNotSaved
|
data/activeldap3.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "activeldap3"
|
6
|
+
s.version = '1.2.3'
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.authors = ["Will Drewry", "Kouhei Sutou", "koutou", "Kenny Ortmann"]
|
9
|
+
s.email = ['kenny.ortmann@gmail.com']
|
10
|
+
s.homepage = "https://github.com/asynchrony/ruby-activeldap"
|
11
|
+
s.summary = %q{working towards getting active ldap to work on rails 3}
|
12
|
+
s.description = %q{working towards getting active ldap to work on rails 3}
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib", "po"]
|
18
|
+
end
|
@@ -0,0 +1,263 @@
|
|
1
|
+
base = File.dirname(__FILE__)
|
2
|
+
$LOAD_PATH.unshift(File.expand_path(base))
|
3
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(base, "..", "lib")))
|
4
|
+
|
5
|
+
require "active_ldap"
|
6
|
+
require "benchmark"
|
7
|
+
|
8
|
+
include ActiveLdap::GetTextSupport
|
9
|
+
|
10
|
+
argv, opts, options = ActiveLdap::Command.parse_options do |opts, options|
|
11
|
+
options.prefix = "ou=People"
|
12
|
+
|
13
|
+
opts.on("--prefix=PREFIX",
|
14
|
+
_("Specify prefix for benchmarking"),
|
15
|
+
_("(default: %s)") % options.prefix) do |prefix|
|
16
|
+
options.prefix = prefix
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
ActiveLdap::Base.setup_connection
|
21
|
+
config = ActiveLdap::Base.configuration
|
22
|
+
|
23
|
+
LDAP_HOST = config[:host]
|
24
|
+
LDAP_METHOD = config[:method]
|
25
|
+
if LDAP_METHOD == :ssl
|
26
|
+
LDAP_PORT = config[:port] || URI::LDAPS::DEFAULT_PORT
|
27
|
+
else
|
28
|
+
LDAP_PORT = config[:port] || URI::LDAP::DEFAULT_PORT
|
29
|
+
end
|
30
|
+
LDAP_BASE = config[:base]
|
31
|
+
LDAP_PREFIX = options.prefix
|
32
|
+
LDAP_USER = config[:bind_dn]
|
33
|
+
LDAP_PASSWORD = config[:password]
|
34
|
+
|
35
|
+
class ALUser < ActiveLdap::Base
|
36
|
+
ldap_mapping :dn_attribute => 'uid', :prefix => LDAP_PREFIX,
|
37
|
+
:classes => ['posixAccount', 'person']
|
38
|
+
end
|
39
|
+
|
40
|
+
class ALUserLdap < ALUser
|
41
|
+
end
|
42
|
+
ALUserLdap.setup_connection(config.merge(:adapter => "ldap"))
|
43
|
+
|
44
|
+
class ALUserNetLdap < ALUser
|
45
|
+
end
|
46
|
+
ALUserNetLdap.setup_connection(config.merge(:adapter => "net-ldap"))
|
47
|
+
|
48
|
+
def search_al_ldap
|
49
|
+
count = 0
|
50
|
+
ALUserLdap.find(:all).each do |e|
|
51
|
+
count += 1
|
52
|
+
end
|
53
|
+
count
|
54
|
+
end
|
55
|
+
|
56
|
+
def search_al_net_ldap
|
57
|
+
count = 0
|
58
|
+
ALUserNetLdap.find(:all).each do |e|
|
59
|
+
count += 1
|
60
|
+
end
|
61
|
+
count
|
62
|
+
end
|
63
|
+
|
64
|
+
def search_al_ldap_without_object_creation
|
65
|
+
count = 0
|
66
|
+
ALUserLdap.search.each do |e|
|
67
|
+
count += 1
|
68
|
+
end
|
69
|
+
count
|
70
|
+
end
|
71
|
+
|
72
|
+
def search_al_net_ldap_without_object_creation
|
73
|
+
count = 0
|
74
|
+
ALUserNetLdap.search.each do |e|
|
75
|
+
count += 1
|
76
|
+
end
|
77
|
+
count
|
78
|
+
end
|
79
|
+
|
80
|
+
# === search_ldap
|
81
|
+
#
|
82
|
+
def search_ldap(conn)
|
83
|
+
count = 0
|
84
|
+
conn.search("#{LDAP_PREFIX},#{LDAP_BASE}",
|
85
|
+
LDAP::LDAP_SCOPE_SUBTREE,
|
86
|
+
"(uid=*)") do |e|
|
87
|
+
count += 1
|
88
|
+
end
|
89
|
+
count
|
90
|
+
end # -- search_ldap
|
91
|
+
|
92
|
+
def search_net_ldap(conn)
|
93
|
+
count = 0
|
94
|
+
conn.search(:base => "#{LDAP_PREFIX},#{LDAP_BASE}",
|
95
|
+
:scope => Net::LDAP::SearchScope_WholeSubtree,
|
96
|
+
:filter => "(uid=*)") do |e|
|
97
|
+
count += 1
|
98
|
+
end
|
99
|
+
count
|
100
|
+
end
|
101
|
+
|
102
|
+
def ldap_connection
|
103
|
+
require 'ldap'
|
104
|
+
if LDAP_METHOD == :tls
|
105
|
+
conn = LDAP::SSLConn.new(LDAP_HOST, LDAP_PORT, true)
|
106
|
+
else
|
107
|
+
conn = LDAP::Conn.new(LDAP_HOST, LDAP_PORT)
|
108
|
+
end
|
109
|
+
conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)
|
110
|
+
conn.bind(LDAP_USER, LDAP_PASSWORD) if LDAP_USER and LDAP_PASSWORD
|
111
|
+
conn
|
112
|
+
rescue LoadError
|
113
|
+
nil
|
114
|
+
end
|
115
|
+
|
116
|
+
def net_ldap_connection
|
117
|
+
require 'net/ldap'
|
118
|
+
net_ldap_conn = Net::LDAP::Connection.new(:host => LDAP_HOST,
|
119
|
+
:port => LDAP_PORT)
|
120
|
+
if LDAP_USER and LDAP_PASSWORD
|
121
|
+
net_ldap_conn.setup_encryption(:method => :start_tls) if LDAP_METHOD == :tls
|
122
|
+
net_ldap_conn.bind(:method => :simple,
|
123
|
+
:username => LDAP_USER,
|
124
|
+
:password => LDAP_PASSWORD)
|
125
|
+
end
|
126
|
+
net_ldap_conn
|
127
|
+
rescue LoadError
|
128
|
+
nil
|
129
|
+
end
|
130
|
+
|
131
|
+
def populate_base
|
132
|
+
suffixes = []
|
133
|
+
ActiveLdap::Base.base.split(/,/).reverse_each do |suffix|
|
134
|
+
prefix = suffixes.join(",")
|
135
|
+
suffixes.unshift(suffix)
|
136
|
+
name, value = suffix.split(/=/, 2)
|
137
|
+
next unless name == "dc"
|
138
|
+
dc_class = Class.new(ActiveLdap::Base)
|
139
|
+
dc_class.ldap_mapping :dn_attribute => "dc",
|
140
|
+
:prefix => "",
|
141
|
+
:scope => :base,
|
142
|
+
:classes => ["top", "dcObject", "organization"]
|
143
|
+
dc_class.instance_variable_set("@base", prefix)
|
144
|
+
next if dc_class.exists?(value, :prefix => "dc=#{value}")
|
145
|
+
dc = dc_class.new(value)
|
146
|
+
dc.o = dc.dc
|
147
|
+
begin
|
148
|
+
dc.save
|
149
|
+
rescue ActiveLdap::OperationNotPermitted
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
if ActiveLdap::Base.search.empty?
|
154
|
+
raise "Can't populate #{ActiveLdap::Base.base}"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def populate_users
|
159
|
+
ou_class = Class.new(ActiveLdap::Base)
|
160
|
+
ou_class.ldap_mapping :dn_attribute => "ou",
|
161
|
+
:prefix => "",
|
162
|
+
:classes => ["top", "organizationalUnit"]
|
163
|
+
ou_class.new(LDAP_PREFIX.split(/=/)[1]).save!
|
164
|
+
|
165
|
+
100.times do |i|
|
166
|
+
name = i.to_s
|
167
|
+
user = ALUser.new(name)
|
168
|
+
user.uid_number = 100000 + i
|
169
|
+
user.gid_number = 100000 + i
|
170
|
+
user.cn = name
|
171
|
+
user.sn = name
|
172
|
+
user.home_directory = "/nonexistent"
|
173
|
+
user.save!
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
def populate
|
178
|
+
populate_base
|
179
|
+
populate_users
|
180
|
+
end
|
181
|
+
|
182
|
+
# === main
|
183
|
+
#
|
184
|
+
def main(do_populate)
|
185
|
+
if do_populate
|
186
|
+
puts(_("Populating..."))
|
187
|
+
dumped_data = ActiveLdap::Base.dump(:scope => :sub)
|
188
|
+
ActiveLdap::Base.delete_all(nil, :scope => :sub)
|
189
|
+
populate
|
190
|
+
puts
|
191
|
+
end
|
192
|
+
|
193
|
+
# Standard connection
|
194
|
+
#
|
195
|
+
ldap_conn = ldap_connection
|
196
|
+
net_ldap_conn = net_ldap_connection
|
197
|
+
|
198
|
+
al_ldap_count = 0
|
199
|
+
al_net_ldap_count = 0
|
200
|
+
al_ldap_count_without_object_creation = 0
|
201
|
+
al_net_ldap_count_without_object_creation = 0
|
202
|
+
ldap_count = 0
|
203
|
+
net_ldap_count = 0
|
204
|
+
Benchmark.bmbm(20) do |x|
|
205
|
+
[1].each do |n|
|
206
|
+
GC.start
|
207
|
+
x.report("%3dx: AL(LDAP)" % n) do
|
208
|
+
n.times {al_ldap_count = search_al_ldap}
|
209
|
+
end
|
210
|
+
GC.start
|
211
|
+
x.report("%3dx: AL(Net::LDAP)" % n) do
|
212
|
+
n.times {al_net_ldap_count = search_al_net_ldap}
|
213
|
+
end
|
214
|
+
GC.start
|
215
|
+
x.report("%3dx: AL(LDAP: No Obj)" % n) do
|
216
|
+
n.times do
|
217
|
+
al_ldap_count_without_object_creation =
|
218
|
+
search_al_ldap_without_object_creation
|
219
|
+
end
|
220
|
+
end
|
221
|
+
x.report("%3dx: AL(Net::LDAP: No Obj)" % n) do
|
222
|
+
n.times do
|
223
|
+
al_net_ldap_count_without_object_creation =
|
224
|
+
search_al_net_ldap_without_object_creation
|
225
|
+
end
|
226
|
+
end
|
227
|
+
GC.start
|
228
|
+
if ldap_conn
|
229
|
+
x.report("%3dx: LDAP" % n) do
|
230
|
+
n.times {ldap_count = search_ldap(ldap_conn)}
|
231
|
+
end
|
232
|
+
end
|
233
|
+
GC.start
|
234
|
+
if net_ldap_conn
|
235
|
+
x.report("%3dx: Net::LDAP" % n) do
|
236
|
+
n.times {net_ldap_count = search_net_ldap(net_ldap_conn)}
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
puts
|
243
|
+
puts(_("Entries processed by Ruby/ActiveLdap + LDAP: %d") % al_ldap_count)
|
244
|
+
puts(_("Entries processed by Ruby/ActiveLdap + Net::LDAP: %d") % \
|
245
|
+
al_net_ldap_count)
|
246
|
+
puts(_("Entries processed by Ruby/ActiveLdap + LDAP: " \
|
247
|
+
"(without object creation): %d") % \
|
248
|
+
al_ldap_count_without_object_creation)
|
249
|
+
puts(_("Entries processed by Ruby/ActiveLdap + Net::LDAP: " \
|
250
|
+
"(without object creation): %d") % \
|
251
|
+
al_net_ldap_count_without_object_creation)
|
252
|
+
puts(_("Entries processed by Ruby/LDAP: %d") % ldap_count)
|
253
|
+
puts(_("Entries processed by Net::LDAP: %d") % net_ldap_count)
|
254
|
+
ensure
|
255
|
+
if do_populate
|
256
|
+
puts
|
257
|
+
puts(_("Cleaning..."))
|
258
|
+
ActiveLdap::Base.delete_all(nil, :scope => :sub)
|
259
|
+
ActiveLdap::Base.load(dumped_data)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
main(LDAP_USER && LDAP_PASSWORD)
|
@@ -0,0 +1,182 @@
|
|
1
|
+
== Welcome to Rails
|
2
|
+
|
3
|
+
Rails is a web-application and persistence framework that includes everything
|
4
|
+
needed to create database-backed web-applications according to the
|
5
|
+
Model-View-Control pattern of separation. This pattern splits the view (also
|
6
|
+
called the presentation) into "dumb" templates that are primarily responsible
|
7
|
+
for inserting pre-built data in between HTML tags. The model contains the
|
8
|
+
"smart" domain objects (such as Account, Product, Person, Post) that holds all
|
9
|
+
the business logic and knows how to persist themselves to a database. The
|
10
|
+
controller handles the incoming requests (such as Save New Account, Update
|
11
|
+
Product, Show Post) by manipulating the model and directing data to the view.
|
12
|
+
|
13
|
+
In Rails, the model is handled by what's called an object-relational mapping
|
14
|
+
layer entitled Active Record. This layer allows you to present the data from
|
15
|
+
database rows as objects and embellish these data objects with business logic
|
16
|
+
methods. You can read more about Active Record in
|
17
|
+
link:files/vendor/rails/activerecord/README.html.
|
18
|
+
|
19
|
+
The controller and view are handled by the Action Pack, which handles both
|
20
|
+
layers by its two parts: Action View and Action Controller. These two layers
|
21
|
+
are bundled in a single package due to their heavy interdependence. This is
|
22
|
+
unlike the relationship between the Active Record and Action Pack that is much
|
23
|
+
more separate. Each of these packages can be used independently outside of
|
24
|
+
Rails. You can read more about Action Pack in
|
25
|
+
link:files/vendor/rails/actionpack/README.html.
|
26
|
+
|
27
|
+
|
28
|
+
== Getting started
|
29
|
+
|
30
|
+
1. At the command prompt, start a new rails application using the rails command
|
31
|
+
and your application name. Ex: rails myapp
|
32
|
+
(If you've downloaded rails in a complete tgz or zip, this step is already done)
|
33
|
+
2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
|
34
|
+
3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
|
35
|
+
4. Follow the guidelines to start developing your application
|
36
|
+
|
37
|
+
|
38
|
+
== Web Servers
|
39
|
+
|
40
|
+
By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
|
41
|
+
Rails will use the WEBrick, the webserver that ships with Ruby. When you run script/server,
|
42
|
+
Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
|
43
|
+
that you can always get up and running quickly.
|
44
|
+
|
45
|
+
Mongrel is a Ruby-based webserver with a C-component (which requires compilation) that is
|
46
|
+
suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
|
47
|
+
getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
|
48
|
+
More info at: http://mongrel.rubyforge.org
|
49
|
+
|
50
|
+
If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
|
51
|
+
Mongrel and WEBrick and also suited for production use, but requires additional
|
52
|
+
installation and currently only works well on OS X/Unix (Windows users are encouraged
|
53
|
+
to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
|
54
|
+
http://www.lighttpd.net.
|
55
|
+
|
56
|
+
And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
|
57
|
+
web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
|
58
|
+
for production.
|
59
|
+
|
60
|
+
But of course its also possible to run Rails on any platform that supports FCGI.
|
61
|
+
Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
|
62
|
+
please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
|
63
|
+
|
64
|
+
|
65
|
+
== Debugging Rails
|
66
|
+
|
67
|
+
Have "tail -f" commands running on the server.log and development.log. Rails will
|
68
|
+
automatically display debugging and runtime information to these files. Debugging
|
69
|
+
info will also be shown in the browser on requests from 127.0.0.1.
|
70
|
+
|
71
|
+
|
72
|
+
== Breakpoints
|
73
|
+
|
74
|
+
Breakpoint support is available through the script/breakpointer client. This
|
75
|
+
means that you can break out of execution at any point in the code, investigate
|
76
|
+
and change the model, AND then resume execution! Example:
|
77
|
+
|
78
|
+
class WeblogController < ActionController::Base
|
79
|
+
def index
|
80
|
+
@posts = Post.find(:all)
|
81
|
+
breakpoint "Breaking out from the list"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
So the controller will accept the action, run the first line, then present you
|
86
|
+
with a IRB prompt in the breakpointer window. Here you can do things like:
|
87
|
+
|
88
|
+
Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
|
89
|
+
|
90
|
+
>> @posts.inspect
|
91
|
+
=> "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
|
92
|
+
#<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
|
93
|
+
>> @posts.first.title = "hello from a breakpoint"
|
94
|
+
=> "hello from a breakpoint"
|
95
|
+
|
96
|
+
...and even better is that you can examine how your runtime objects actually work:
|
97
|
+
|
98
|
+
>> f = @posts.first
|
99
|
+
=> #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
|
100
|
+
>> f.
|
101
|
+
Display all 152 possibilities? (y or n)
|
102
|
+
|
103
|
+
Finally, when you're ready to resume execution, you press CTRL-D
|
104
|
+
|
105
|
+
|
106
|
+
== Console
|
107
|
+
|
108
|
+
You can interact with the domain model by starting the console through <tt>script/console</tt>.
|
109
|
+
Here you'll have all parts of the application configured, just like it is when the
|
110
|
+
application is running. You can inspect domain models, change values, and save to the
|
111
|
+
database. Starting the script without arguments will launch it in the development environment.
|
112
|
+
Passing an argument will specify a different environment, like <tt>script/console production</tt>.
|
113
|
+
|
114
|
+
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
115
|
+
|
116
|
+
To reload your controllers and models after launching the console run <tt>reload!</tt>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
== Description of contents
|
121
|
+
|
122
|
+
app
|
123
|
+
Holds all the code that's specific to this particular application.
|
124
|
+
|
125
|
+
app/controllers
|
126
|
+
Holds controllers that should be named like weblogs_controller.rb for
|
127
|
+
automated URL mapping. All controllers should descend from ApplicationController
|
128
|
+
which itself descends from ActionController::Base.
|
129
|
+
|
130
|
+
app/models
|
131
|
+
Holds models that should be named like post.rb.
|
132
|
+
Most models will descend from ActiveRecord::Base.
|
133
|
+
|
134
|
+
app/views
|
135
|
+
Holds the template files for the view that should be named like
|
136
|
+
weblogs/index.rhtml for the WeblogsController#index action. All views use eRuby
|
137
|
+
syntax.
|
138
|
+
|
139
|
+
app/views/layouts
|
140
|
+
Holds the template files for layouts to be used with views. This models the common
|
141
|
+
header/footer method of wrapping views. In your views, define a layout using the
|
142
|
+
<tt>layout :default</tt> and create a file named default.rhtml. Inside default.rhtml,
|
143
|
+
call <% yield %> to render the view using this layout.
|
144
|
+
|
145
|
+
app/helpers
|
146
|
+
Holds view helpers that should be named like weblogs_helper.rb. These are generated
|
147
|
+
for you automatically when using script/generate for controllers. Helpers can be used to
|
148
|
+
wrap functionality for your views into methods.
|
149
|
+
|
150
|
+
config
|
151
|
+
Configuration files for the Rails environment, the routing map, the database, and other dependencies.
|
152
|
+
|
153
|
+
components
|
154
|
+
Self-contained mini-applications that can bundle together controllers, models, and views.
|
155
|
+
|
156
|
+
db
|
157
|
+
Contains the database schema in schema.rb. db/migrate contains all
|
158
|
+
the sequence of Migrations for your schema.
|
159
|
+
|
160
|
+
doc
|
161
|
+
This directory is where your application documentation will be stored when generated
|
162
|
+
using <tt>rake doc:app</tt>
|
163
|
+
|
164
|
+
lib
|
165
|
+
Application specific libraries. Basically, any kind of custom code that doesn't
|
166
|
+
belong under controllers, models, or helpers. This directory is in the load path.
|
167
|
+
|
168
|
+
public
|
169
|
+
The directory available for the web server. Contains subdirectories for images, stylesheets,
|
170
|
+
and javascripts. Also contains the dispatchers and the default HTML files. This should be
|
171
|
+
set as the DOCUMENT_ROOT of your web server.
|
172
|
+
|
173
|
+
script
|
174
|
+
Helper scripts for automation and generation.
|
175
|
+
|
176
|
+
test
|
177
|
+
Unit and functional tests along with fixtures. When using the script/generate scripts, template
|
178
|
+
test files will be generated for you and placed in this directory.
|
179
|
+
|
180
|
+
vendor
|
181
|
+
External libraries that the application depends on. Also includes the plugins subdirectory.
|
182
|
+
This directory is in the load path.
|