activeldap 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +454 -0
- data/COPYING +340 -0
- data/LICENSE +58 -0
- data/README +101 -0
- data/Rakefile +175 -0
- data/TODO +25 -0
- data/benchmark/bench-al.rb +202 -0
- data/benchmark/config.yaml.sample +5 -0
- data/data/locale/en/LC_MESSAGES/active-ldap.mo +0 -0
- data/data/locale/ja/LC_MESSAGES/active-ldap.mo +0 -0
- data/examples/al-admin/README +182 -0
- data/examples/al-admin/Rakefile +10 -0
- data/examples/al-admin/app/controllers/account_controller.rb +59 -0
- data/examples/al-admin/app/controllers/application.rb +34 -0
- data/examples/al-admin/app/controllers/attributes_controller.rb +17 -0
- data/examples/al-admin/app/controllers/directory_controller.rb +47 -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 +51 -0
- data/examples/al-admin/app/controllers/welcome_controller.rb +10 -0
- data/examples/al-admin/app/helpers/account_helper.rb +2 -0
- data/examples/al-admin/app/helpers/application_helper.rb +42 -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 +13 -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 +54 -0
- data/examples/al-admin/app/models/user.rb +91 -0
- data/examples/al-admin/app/views/_entry/_attributes_information.rhtml +23 -0
- data/examples/al-admin/app/views/_entry/_entry.rhtml +15 -0
- data/examples/al-admin/app/views/_schema/_aliases.rhtml +7 -0
- data/examples/al-admin/app/views/_switcher/_after.rhtml +2 -0
- data/examples/al-admin/app/views/_switcher/_before.rhtml +5 -0
- data/examples/al-admin/app/views/account/login.rhtml +26 -0
- data/examples/al-admin/app/views/account/sign_up.rhtml +28 -0
- data/examples/al-admin/app/views/attributes/_attributes.rhtml +19 -0
- data/examples/al-admin/app/views/attributes/_detail.rhtml +29 -0
- data/examples/al-admin/app/views/attributes/index.rhtml +3 -0
- data/examples/al-admin/app/views/attributes/show.rhtml +31 -0
- data/examples/al-admin/app/views/directory/_tree.rhtml +10 -0
- data/examples/al-admin/app/views/directory/_tree_view_js.rhtml +26 -0
- data/examples/al-admin/app/views/directory/index.rhtml +13 -0
- data/examples/al-admin/app/views/directory/populate.rhtml +2 -0
- data/examples/al-admin/app/views/layouts/_flash_box.rhtml +4 -0
- data/examples/al-admin/app/views/layouts/_footer.rhtml +9 -0
- data/examples/al-admin/app/views/layouts/_header_menu.rhtml +10 -0
- data/examples/al-admin/app/views/layouts/_main_menu.rhtml +18 -0
- data/examples/al-admin/app/views/layouts/application.rhtml +56 -0
- data/examples/al-admin/app/views/object_classes/_attributes.rhtml +28 -0
- data/examples/al-admin/app/views/object_classes/_object_classes.rhtml +19 -0
- data/examples/al-admin/app/views/object_classes/index.rhtml +3 -0
- data/examples/al-admin/app/views/object_classes/show.rhtml +39 -0
- data/examples/al-admin/app/views/syntaxes/_detail.rhtml +14 -0
- data/examples/al-admin/app/views/syntaxes/_syntaxes.rhtml +19 -0
- data/examples/al-admin/app/views/syntaxes/index.rhtml +3 -0
- data/examples/al-admin/app/views/syntaxes/show.rhtml +22 -0
- data/examples/al-admin/app/views/users/_attributes_update_form.rhtml +30 -0
- data/examples/al-admin/app/views/users/_form.rhtml +13 -0
- data/examples/al-admin/app/views/users/_object_classes_update_form.rhtml +40 -0
- data/examples/al-admin/app/views/users/_password_change_form.rhtml +20 -0
- data/examples/al-admin/app/views/users/edit.rhtml +15 -0
- data/examples/al-admin/app/views/users/index.rhtml +10 -0
- data/examples/al-admin/app/views/users/show.rhtml +11 -0
- data/examples/al-admin/app/views/welcome/index.rhtml +13 -0
- data/examples/al-admin/config/boot.rb +45 -0
- data/examples/al-admin/config/database.yml.example +19 -0
- data/examples/al-admin/config/environment.rb +70 -0
- data/examples/al-admin/config/environments/development.rb +21 -0
- data/examples/al-admin/config/environments/production.rb +18 -0
- data/examples/al-admin/config/environments/test.rb +19 -0
- data/examples/al-admin/config/ldap.yml.example +21 -0
- data/examples/al-admin/config/routes.rb +46 -0
- data/examples/al-admin/db/migrate/001_create_users.rb +16 -0
- data/examples/al-admin/lib/accept_http_rails_relative_url_root.rb +9 -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/tasks/gettext.rake +35 -0
- data/examples/al-admin/po/en/al-admin.po +341 -0
- data/examples/al-admin/po/ja/al-admin.po +341 -0
- data/examples/al-admin/po/nl/al-admin.po +373 -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 +833 -0
- data/examples/al-admin/public/javascripts/dragdrop.js +942 -0
- data/examples/al-admin/public/javascripts/effects.js +1088 -0
- data/examples/al-admin/public/javascripts/prototype.js +2515 -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 +99 -0
- data/examples/al-admin/public/stylesheets/common.css +2 -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/breakpointer +3 -0
- data/examples/al-admin/script/console +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/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 +24 -0
- data/examples/al-admin/test/functional/attributes_controller_test.rb +18 -0
- data/examples/al-admin/test/functional/directory_controller_test.rb +18 -0
- data/examples/al-admin/test/functional/object_classes_controller_test.rb +18 -0
- data/examples/al-admin/test/functional/syntaxes_controller_test.rb +18 -0
- data/examples/al-admin/test/functional/users_controller_test.rb +18 -0
- data/examples/al-admin/test/functional/welcome_controller_test.rb +18 -0
- data/examples/al-admin/test/run-test.sh +3 -0
- data/examples/al-admin/test/test_helper.rb +28 -0
- data/examples/al-admin/test/unit/user_test.rb +13 -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 +67 -0
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier_helper.rb +77 -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 +3 -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 +50 -0
- data/examples/userdel +34 -0
- data/examples/userls +50 -0
- data/examples/usermod +42 -0
- data/examples/usermod-binary-add +47 -0
- data/examples/usermod-binary-add-time +51 -0
- data/examples/usermod-binary-del +48 -0
- data/examples/usermod-lang-add +43 -0
- data/lib/active_ldap/acts/tree.rb +75 -0
- data/lib/active_ldap/adapter/base.rb +531 -0
- data/lib/active_ldap/adapter/ldap.rb +231 -0
- data/lib/active_ldap/adapter/ldap_ext.rb +69 -0
- data/lib/active_ldap/adapter/net_ldap.rb +292 -0
- data/lib/active_ldap/adapter/net_ldap_ext.rb +29 -0
- data/lib/active_ldap/association/belongs_to.rb +47 -0
- data/lib/active_ldap/association/belongs_to_many.rb +42 -0
- data/lib/active_ldap/association/children.rb +21 -0
- data/lib/active_ldap/association/collection.rb +83 -0
- data/lib/active_ldap/association/has_many.rb +31 -0
- data/lib/active_ldap/association/has_many_utils.rb +35 -0
- data/lib/active_ldap/association/has_many_wrap.rb +46 -0
- data/lib/active_ldap/association/proxy.rb +102 -0
- data/lib/active_ldap/associations.rb +172 -0
- data/lib/active_ldap/attributes.rb +211 -0
- data/lib/active_ldap/base.rb +1273 -0
- data/lib/active_ldap/callbacks.rb +19 -0
- data/lib/active_ldap/command.rb +49 -0
- data/lib/active_ldap/configuration.rb +147 -0
- data/lib/active_ldap/connection.rb +237 -0
- data/lib/active_ldap/distinguished_name.rb +251 -0
- data/lib/active_ldap/escape.rb +12 -0
- data/lib/active_ldap/get_text/parser.rb +159 -0
- data/lib/active_ldap/get_text.rb +8 -0
- data/lib/active_ldap/get_text_fallback.rb +53 -0
- data/lib/active_ldap/get_text_support.rb +26 -0
- data/lib/active_ldap/helper.rb +33 -0
- data/lib/active_ldap/human_readable.rb +112 -0
- data/lib/active_ldap/ldap_error.rb +74 -0
- data/lib/active_ldap/ldif.rb +52 -0
- data/lib/active_ldap/object_class.rb +93 -0
- data/lib/active_ldap/operations.rb +429 -0
- data/lib/active_ldap/populate.rb +44 -0
- data/lib/active_ldap/schema/syntaxes.rb +386 -0
- data/lib/active_ldap/schema.rb +530 -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 +93 -0
- data/lib/active_ldap/validations.rb +171 -0
- data/lib/active_ldap.rb +982 -0
- data/po/en/active-ldap.po +3677 -0
- data/po/ja/active-ldap.po +3713 -0
- data/rails/plugin/active_ldap/README +54 -0
- data/rails/plugin/active_ldap/generators/model_active_ldap/USAGE +17 -0
- data/rails/plugin/active_ldap/generators/model_active_ldap/model_active_ldap_generator.rb +70 -0
- data/rails/plugin/active_ldap/generators/model_active_ldap/templates/fixtures.yml +11 -0
- data/rails/plugin/active_ldap/generators/model_active_ldap/templates/model_active_ldap.rb +3 -0
- data/rails/plugin/active_ldap/generators/model_active_ldap/templates/unit_test.rb +10 -0
- data/rails/plugin/active_ldap/generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +7 -0
- data/rails/plugin/active_ldap/generators/scaffold_al/scaffold_al_generator.rb +20 -0
- data/rails/plugin/active_ldap/init.rb +26 -0
- data/test/al-test-utils.rb +362 -0
- data/test/command.rb +62 -0
- data/test/config.yaml.sample +6 -0
- data/test/run-test.rb +31 -0
- data/test/test-unit-ext/always-show-result.rb +28 -0
- data/test/test-unit-ext/backtrace-filter.rb +17 -0
- data/test/test-unit-ext/long-display-for-emacs.rb +25 -0
- data/test/test-unit-ext/priority.rb +163 -0
- data/test/test-unit-ext.rb +4 -0
- data/test/test_acts_as_tree.rb +57 -0
- data/test/test_adapter.rb +98 -0
- data/test/test_associations.rb +353 -0
- data/test/test_attributes.rb +79 -0
- data/test/test_base.rb +547 -0
- data/test/test_base_per_instance.rb +55 -0
- data/test/test_bind.rb +62 -0
- data/test/test_callback.rb +35 -0
- data/test/test_configuration.rb +40 -0
- data/test/test_connection.rb +59 -0
- data/test/test_connection_per_class.rb +58 -0
- data/test/test_connection_per_dn.rb +78 -0
- data/test/test_dn.rb +160 -0
- data/test/test_find.rb +96 -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 +35 -0
- data/test/test_lpasswd.rb +75 -0
- data/test/test_object_class.rb +56 -0
- data/test/test_reflection.rb +179 -0
- data/test/test_schema.rb +433 -0
- data/test/test_syntax.rb +329 -0
- data/test/test_user.rb +227 -0
- data/test/test_user_password.rb +93 -0
- data/test/test_useradd-binary.rb +61 -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 +64 -0
- data/test/test_usermod-binary-add.rb +63 -0
- data/test/test_usermod-binary-del.rb +66 -0
- data/test/test_usermod-lang-add.rb +59 -0
- data/test/test_usermod.rb +58 -0
- data/test/test_validation.rb +110 -0
- metadata +536 -0
@@ -0,0 +1,429 @@
|
|
1
|
+
module ActiveLdap
|
2
|
+
module Operations
|
3
|
+
class << self
|
4
|
+
def included(base)
|
5
|
+
super
|
6
|
+
base.class_eval do
|
7
|
+
extend(Common)
|
8
|
+
extend(Find)
|
9
|
+
extend(LDIF)
|
10
|
+
extend(Delete)
|
11
|
+
extend(Update)
|
12
|
+
|
13
|
+
include(Common)
|
14
|
+
include(Find)
|
15
|
+
include(LDIF)
|
16
|
+
include(Delete)
|
17
|
+
include(Update)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
module Common
|
23
|
+
VALID_SEARCH_OPTIONS = [:attribute, :value, :filter, :prefix,
|
24
|
+
:classes, :scope, :limit, :attributes,
|
25
|
+
:sort_by, :order, :connection, :base]
|
26
|
+
|
27
|
+
def search(options={}, &block)
|
28
|
+
validate_search_options(options)
|
29
|
+
attr = options[:attribute]
|
30
|
+
value = options[:value] || '*'
|
31
|
+
filter = options[:filter]
|
32
|
+
prefix = options[:prefix]
|
33
|
+
classes = options[:classes]
|
34
|
+
|
35
|
+
value = value.first if value.is_a?(Array) and value.first.size == 1
|
36
|
+
if filter.nil? and !value.is_a?(String)
|
37
|
+
message = _("Search value must be a String: %s") % value.inspect
|
38
|
+
raise ArgumentError, message
|
39
|
+
end
|
40
|
+
|
41
|
+
_attr, value, _prefix = split_search_value(value)
|
42
|
+
attr ||= _attr || ensure_search_attribute
|
43
|
+
prefix ||= _prefix
|
44
|
+
filter ||= [attr, value]
|
45
|
+
filter = [:and, filter, *object_class_filters(classes)]
|
46
|
+
_base = options[:base]
|
47
|
+
_base ||= [prefix, base].compact.reject{|x| x.empty?}.join(",")
|
48
|
+
if options.has_key?(:ldap_scope)
|
49
|
+
logger.warning do
|
50
|
+
_(":ldap_scope search option is deprecated. Use :scope instead.")
|
51
|
+
end
|
52
|
+
options[:scope] ||= options[:ldap_scope]
|
53
|
+
end
|
54
|
+
search_options = {
|
55
|
+
:base => _base,
|
56
|
+
:scope => options[:scope] || scope,
|
57
|
+
:filter => filter,
|
58
|
+
:limit => options[:limit],
|
59
|
+
:attributes => options[:attributes],
|
60
|
+
:sort_by => options[:sort_by] || sort_by,
|
61
|
+
:order => options[:order] || order,
|
62
|
+
}
|
63
|
+
|
64
|
+
options[:connection] ||= connection
|
65
|
+
options[:connection].search(search_options) do |dn, attrs|
|
66
|
+
attributes = {}
|
67
|
+
attrs.each do |key, value|
|
68
|
+
normalized_attr, normalized_value =
|
69
|
+
normalize_attribute_options(key, value)
|
70
|
+
attributes[normalized_attr] ||= []
|
71
|
+
attributes[normalized_attr].concat(normalized_value)
|
72
|
+
end
|
73
|
+
value = [dn, attributes]
|
74
|
+
value = yield(value) if block_given?
|
75
|
+
value
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def exist?(dn, options={})
|
80
|
+
attr, value, prefix = split_search_value(dn)
|
81
|
+
|
82
|
+
options_for_leaf = {
|
83
|
+
:attribute => attr,
|
84
|
+
:value => value,
|
85
|
+
:prefix => prefix,
|
86
|
+
}
|
87
|
+
|
88
|
+
attribute = attr || ensure_search_attribute
|
89
|
+
options_for_non_leaf = {
|
90
|
+
:attribute => attr,
|
91
|
+
:value => value,
|
92
|
+
:prefix => ["#{attribute}=#{value}", prefix].compact.join(","),
|
93
|
+
:scope => :base,
|
94
|
+
}
|
95
|
+
|
96
|
+
!search(options_for_leaf.merge(options)).empty? or
|
97
|
+
!search(options_for_non_leaf.merge(options)).empty?
|
98
|
+
end
|
99
|
+
alias_method :exists?, :exist?
|
100
|
+
|
101
|
+
def count(options={})
|
102
|
+
search(options).size
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
def validate_search_options(options)
|
107
|
+
options.assert_valid_keys(VALID_SEARCH_OPTIONS)
|
108
|
+
end
|
109
|
+
|
110
|
+
def extract_options_from_args!(args)
|
111
|
+
args.last.is_a?(Hash) ? args.pop : {}
|
112
|
+
end
|
113
|
+
|
114
|
+
def ensure_search_attribute(*candidates)
|
115
|
+
default_search_attribute || "objectClass"
|
116
|
+
end
|
117
|
+
|
118
|
+
def ensure_dn_attribute(target)
|
119
|
+
"#{dn_attribute}=" +
|
120
|
+
target.gsub(/^\s*#{Regexp.escape(dn_attribute)}\s*=\s*/i, '')
|
121
|
+
end
|
122
|
+
|
123
|
+
def ensure_base(target)
|
124
|
+
[truncate_base(target), base].join(',')
|
125
|
+
end
|
126
|
+
|
127
|
+
def truncate_base(target)
|
128
|
+
if /,/ =~ target
|
129
|
+
begin
|
130
|
+
(DN.parse(target) - DN.parse(base)).to_s
|
131
|
+
rescue DistinguishedNameInvalid, ArgumentError
|
132
|
+
target
|
133
|
+
end
|
134
|
+
else
|
135
|
+
target
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def object_class_filters(classes=nil)
|
140
|
+
(classes || required_classes).collect do |name|
|
141
|
+
["objectClass", Escape.ldap_filter_escape(name)]
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def split_search_value(value)
|
146
|
+
attr = prefix = nil
|
147
|
+
begin
|
148
|
+
dn = DN.parse(value)
|
149
|
+
attr, value = dn.rdns.first.to_a.first
|
150
|
+
rest = dn.rdns[1..-1]
|
151
|
+
prefix = DN.new(*rest).to_s unless rest.empty?
|
152
|
+
rescue DistinguishedNameInvalid
|
153
|
+
begin
|
154
|
+
dn = DN.parse("DUMMY=#{value}")
|
155
|
+
_, value = dn.rdns.first.to_a.first
|
156
|
+
rest = dn.rdns[1..-1]
|
157
|
+
prefix = DN.new(*rest).to_s unless rest.empty?
|
158
|
+
rescue DistinguishedNameInvalid
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
prefix = nil if prefix == base
|
163
|
+
prefix = truncate_base(prefix) if prefix
|
164
|
+
[attr, value, prefix]
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
module Find
|
169
|
+
# find
|
170
|
+
#
|
171
|
+
# Finds the first match for value where |value| is the value of some
|
172
|
+
# |field|, or the wildcard match. This is only useful for derived classes.
|
173
|
+
# usage: Subclass.find(:attribute => "cn", :value => "some*val")
|
174
|
+
# Subclass.find('some*val')
|
175
|
+
def find(*args)
|
176
|
+
options = extract_options_from_args!(args)
|
177
|
+
args = [:first] if args.empty? and !options.empty?
|
178
|
+
case args.first
|
179
|
+
when :first
|
180
|
+
find_initial(options)
|
181
|
+
when :all
|
182
|
+
options[:value] ||= args[1]
|
183
|
+
find_every(options)
|
184
|
+
else
|
185
|
+
find_from_dns(args, options)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
private
|
190
|
+
def find_initial(options)
|
191
|
+
find_every(options.merge(:limit => 1)).first
|
192
|
+
end
|
193
|
+
|
194
|
+
def normalize_sort_order(value)
|
195
|
+
case value.to_s
|
196
|
+
when /\Aasc(?:end)?\z/i
|
197
|
+
:ascend
|
198
|
+
when /\Adesc(?:end)?\z/i
|
199
|
+
:descend
|
200
|
+
else
|
201
|
+
raise ArgumentError, _("Invalid order: %s") % value.inspect
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
def find_every(options)
|
206
|
+
options = options.dup
|
207
|
+
sort_by = options.delete(:sort_by) || sort_by
|
208
|
+
order = options.delete(:order) || order
|
209
|
+
limit = options.delete(:limit) if sort_by or order
|
210
|
+
|
211
|
+
results = search(options).collect do |dn, attrs|
|
212
|
+
instantiate([dn, attrs, {:connection => options[:connection]}])
|
213
|
+
end
|
214
|
+
return results if sort_by.nil? and order.nil?
|
215
|
+
|
216
|
+
sort_by ||= "dn"
|
217
|
+
if sort_by.downcase == "dn"
|
218
|
+
results = results.sort_by {|result| DN.parse(result.dn)}
|
219
|
+
else
|
220
|
+
results = results.sort_by {|result| result.send(sort_by)}
|
221
|
+
end
|
222
|
+
|
223
|
+
results.reverse! if normalize_sort_order(order || "ascend") == :descend
|
224
|
+
results = results[0, limit] if limit
|
225
|
+
results
|
226
|
+
end
|
227
|
+
|
228
|
+
def find_from_dns(dns, options)
|
229
|
+
expects_array = dns.first.is_a?(Array)
|
230
|
+
return [] if expects_array and dns.first.empty?
|
231
|
+
|
232
|
+
dns = dns.flatten.compact.uniq
|
233
|
+
|
234
|
+
case dns.size
|
235
|
+
when 0
|
236
|
+
raise EntryNotFound, _("Couldn't find %s without a DN") % name
|
237
|
+
when 1
|
238
|
+
result = find_one(dns.first, options)
|
239
|
+
expects_array ? [result] : result
|
240
|
+
else
|
241
|
+
find_some(dns, options)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def find_one(dn, options)
|
246
|
+
attr, value, prefix = split_search_value(dn)
|
247
|
+
filter = [attr || ensure_search_attribute,
|
248
|
+
Escape.ldap_filter_escape(value)]
|
249
|
+
filter = [:and, filter, options[:filter]] if options[:filter]
|
250
|
+
options = {:prefix => prefix}.merge(options.merge(:filter => filter))
|
251
|
+
result = find_initial(options)
|
252
|
+
if result
|
253
|
+
result
|
254
|
+
else
|
255
|
+
args = [self.is_a?(Class) ? name : self.class.name,
|
256
|
+
dn]
|
257
|
+
if options[:filter]
|
258
|
+
format = _("Couldn't find %s: DN: %s: filter: %s")
|
259
|
+
args << options[:filter].inspect
|
260
|
+
else
|
261
|
+
format = _("Couldn't find %s: DN: %s")
|
262
|
+
end
|
263
|
+
raise EntryNotFound, format % args
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
def find_some(dns, options)
|
268
|
+
dn_filters = dns.collect do |dn|
|
269
|
+
attr, value, prefix = split_search_value(dn)
|
270
|
+
attr ||= ensure_search_attribute
|
271
|
+
filter = [attr, value]
|
272
|
+
if prefix
|
273
|
+
filter = [:and,
|
274
|
+
filter,
|
275
|
+
[dn, "*,#{Escape.ldap_filter_escape(prefix)},#{base}"]]
|
276
|
+
end
|
277
|
+
filter
|
278
|
+
end
|
279
|
+
filter = [:or, *dn_filters]
|
280
|
+
filter = [:and, filter, options[:filter]] if options[:filter]
|
281
|
+
result = find_every(options.merge(:filter => filter))
|
282
|
+
if result.size == dns.size
|
283
|
+
result
|
284
|
+
else
|
285
|
+
args = [self.is_a?(Class) ? name : self.class.name,
|
286
|
+
dns.join(", ")]
|
287
|
+
if options[:filter]
|
288
|
+
format = _("Couldn't find all %s: DNs (%s): filter: %s")
|
289
|
+
args << options[:filter].inspect
|
290
|
+
else
|
291
|
+
format = _("Couldn't find all %s: DNs (%s)")
|
292
|
+
end
|
293
|
+
raise EntryNotFound, format % args
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
def ensure_dn(target)
|
298
|
+
attr, value, prefix = split_search_value(target)
|
299
|
+
"#{attr || dn_attribute}=#{value},#{prefix || base}"
|
300
|
+
end
|
301
|
+
end
|
302
|
+
|
303
|
+
module LDIF
|
304
|
+
def dump(options={})
|
305
|
+
ldifs = []
|
306
|
+
options = {:base => base, :scope => scope}.merge(options)
|
307
|
+
options[:connection] ||= connection
|
308
|
+
options[:connection].search(options) do |dn, attributes|
|
309
|
+
ldifs << to_ldif(dn, attributes)
|
310
|
+
end
|
311
|
+
ldifs.join("\n")
|
312
|
+
end
|
313
|
+
|
314
|
+
def to_ldif(dn, attributes, options={})
|
315
|
+
options[:connection] ||= connection
|
316
|
+
options[:connection].to_ldif(dn, unnormalize_attributes(attributes))
|
317
|
+
end
|
318
|
+
|
319
|
+
def load(ldifs, options={})
|
320
|
+
options[:connection] ||= connection
|
321
|
+
options[:connection].load(ldifs)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
module Delete
|
326
|
+
def destroy(targets, options={})
|
327
|
+
targets = [targets] unless targets.is_a?(Array)
|
328
|
+
targets.each do |target|
|
329
|
+
find(target, options).destroy
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
def destroy_all(filter=nil, options={})
|
334
|
+
targets = []
|
335
|
+
if filter.is_a?(Hash)
|
336
|
+
options = options.merge(filter)
|
337
|
+
filter = nil
|
338
|
+
end
|
339
|
+
options = options.merge(:filter => filter) if filter
|
340
|
+
find(:all, options).sort_by do |target|
|
341
|
+
target.dn.reverse
|
342
|
+
end.reverse.each do |target|
|
343
|
+
target.destroy
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
def delete(targets, options={})
|
348
|
+
targets = [targets] unless targets.is_a?(Array)
|
349
|
+
targets = targets.collect do |target|
|
350
|
+
ensure_dn_attribute(ensure_base(target))
|
351
|
+
end
|
352
|
+
options[:connection] ||= connection
|
353
|
+
options[:connection].delete(targets, options)
|
354
|
+
end
|
355
|
+
|
356
|
+
def delete_all(filter=nil, options={})
|
357
|
+
options = {:base => base, :scope => scope}.merge(options)
|
358
|
+
options = options.merge(:filter => filter) if filter
|
359
|
+
options[:connection] ||= connection
|
360
|
+
conn = options[:connection]
|
361
|
+
targets = conn.search(options).collect do |dn, attributes|
|
362
|
+
dn
|
363
|
+
end.sort_by do |dn|
|
364
|
+
dn.upcase.reverse
|
365
|
+
end.reverse
|
366
|
+
|
367
|
+
conn.delete(targets)
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
module Update
|
372
|
+
def add_entry(dn, attributes, options={})
|
373
|
+
unnormalized_attributes = attributes.collect do |type, key, value|
|
374
|
+
[type, key, unnormalize_attribute(key, value)]
|
375
|
+
end
|
376
|
+
options[:connection] ||= connection
|
377
|
+
options[:connection].add(dn, unnormalized_attributes, options)
|
378
|
+
end
|
379
|
+
|
380
|
+
def modify_entry(dn, attributes, options={})
|
381
|
+
unnormalized_attributes = attributes.collect do |type, key, value|
|
382
|
+
[type, key, unnormalize_attribute(key, value)]
|
383
|
+
end
|
384
|
+
options[:connection] ||= connection
|
385
|
+
options[:connection].modify(dn, unnormalized_attributes, options)
|
386
|
+
end
|
387
|
+
|
388
|
+
def update(dn, attributes, options={})
|
389
|
+
if dn.is_a?(Array)
|
390
|
+
i = -1
|
391
|
+
dns = dn
|
392
|
+
dns.collect do |dn|
|
393
|
+
i += 1
|
394
|
+
update(dn, attributes[i], options)
|
395
|
+
end
|
396
|
+
else
|
397
|
+
object = find(dn, options)
|
398
|
+
object.update_attributes(attributes)
|
399
|
+
object
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
def update_all(attributes, filter=nil, options={})
|
404
|
+
search_options = options.dup
|
405
|
+
if filter
|
406
|
+
if filter.is_a?(String) and /[=\(\)&\|]/ !~ filter
|
407
|
+
search_options = search_options.merge(:value => filter)
|
408
|
+
else
|
409
|
+
search_options = search_options.merge(:filter => filter)
|
410
|
+
end
|
411
|
+
end
|
412
|
+
targets = search(search_options).collect do |dn, attrs|
|
413
|
+
dn
|
414
|
+
end
|
415
|
+
|
416
|
+
unnormalized_attributes = attributes.collect do |name, value|
|
417
|
+
normalized_name, normalized_value = normalize_attribute(name, value)
|
418
|
+
[:replace, normalized_name,
|
419
|
+
unnormalize_attribute(normalized_name, normalized_value)]
|
420
|
+
end
|
421
|
+
options[:connection] ||= connection
|
422
|
+
conn = options[:connection]
|
423
|
+
targets.each do |dn|
|
424
|
+
conn.modify(dn, unnormalized_attributes, options)
|
425
|
+
end
|
426
|
+
end
|
427
|
+
end
|
428
|
+
end
|
429
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module ActiveLdap
|
2
|
+
module Populate
|
3
|
+
module_function
|
4
|
+
def ensure_base(base_class=nil)
|
5
|
+
base_class ||= Base
|
6
|
+
return unless base_class.search(:scope => :base).empty?
|
7
|
+
|
8
|
+
base_dn = DN.parse(base_class.base)
|
9
|
+
suffixes = []
|
10
|
+
|
11
|
+
base_dn.rdns.reverse_each do |rdn|
|
12
|
+
name, value = rdn.to_a[0]
|
13
|
+
prefix = suffixes.join(",")
|
14
|
+
suffixes.unshift("#{name}=#{value}")
|
15
|
+
next unless name == "dc"
|
16
|
+
dc_class = Class.new(base_class)
|
17
|
+
dc_class.ldap_mapping :dn_attribute => "dc",
|
18
|
+
:prefix => "",
|
19
|
+
:scope => :base,
|
20
|
+
:classes => ["top", "dcObject", "organization"]
|
21
|
+
dc_class.base = prefix
|
22
|
+
next if dc_class.exist?(value)
|
23
|
+
dc = dc_class.new(value)
|
24
|
+
dc.o = dc.dc
|
25
|
+
begin
|
26
|
+
dc.save
|
27
|
+
rescue ActiveLdap::OperationNotPermitted
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def ensure_ou(name, base_class=nil)
|
33
|
+
base_class ||= Base
|
34
|
+
name = name.gsub(/\Aou\s*=\s*/, '')
|
35
|
+
|
36
|
+
ou_class = Class.new(base_class)
|
37
|
+
ou_class.ldap_mapping(:dn_attribute => "ou",
|
38
|
+
:prefix => "",
|
39
|
+
:classes => ["top", "organizationalUnit"])
|
40
|
+
return if ou_class.exist?(name)
|
41
|
+
ou_class.new(name).save
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|