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,530 @@
|
|
1
|
+
module ActiveLdap
|
2
|
+
class Schema
|
3
|
+
def initialize(entries)
|
4
|
+
@entries = default_entries.merge(entries || {})
|
5
|
+
@schema_info = {}
|
6
|
+
@class_attributes_info = {}
|
7
|
+
@cache = {}
|
8
|
+
end
|
9
|
+
|
10
|
+
def ids(group)
|
11
|
+
ensure_parse(group)
|
12
|
+
info, ids, aliases = ensure_schema_info(group)
|
13
|
+
ids.keys
|
14
|
+
end
|
15
|
+
|
16
|
+
def names(group)
|
17
|
+
alias_map(group).keys
|
18
|
+
end
|
19
|
+
|
20
|
+
def exist_name?(group, name)
|
21
|
+
alias_map(group).has_key?(normalize_schema_name(name))
|
22
|
+
end
|
23
|
+
|
24
|
+
def resolve_name(group, name)
|
25
|
+
alias_map(group)[normalize_schema_name(name)]
|
26
|
+
end
|
27
|
+
|
28
|
+
# fetch
|
29
|
+
#
|
30
|
+
# This is just like LDAP::Schema#attribute except that it allows
|
31
|
+
# look up in any of the given keys.
|
32
|
+
# e.g.
|
33
|
+
# fetch('attributeTypes', 'cn', 'DESC')
|
34
|
+
# fetch('ldapSyntaxes', '1.3.6.1.4.1.1466.115.121.1.5', 'DESC')
|
35
|
+
def fetch(group, id_or_name, attribute_name)
|
36
|
+
return [] if attribute_name.empty?
|
37
|
+
attribute_name = normalize_attribute_name(attribute_name)
|
38
|
+
value = entry(group, id_or_name)[attribute_name]
|
39
|
+
value ? value.dup : []
|
40
|
+
end
|
41
|
+
alias_method :[], :fetch
|
42
|
+
|
43
|
+
NUMERIC_OID_RE = "\\d[\\d\\.]+"
|
44
|
+
DESCRIPTION_RE = "[a-zA-Z][a-zA-Z\\d\\-]*"
|
45
|
+
OID_RE = "(?:#{NUMERIC_OID_RE}|#{DESCRIPTION_RE}-oid)"
|
46
|
+
def entry(group, id_or_name)
|
47
|
+
return {} if group.empty? or id_or_name.empty?
|
48
|
+
|
49
|
+
unless @entries.has_key?(group)
|
50
|
+
raise ArgumentError, _("Unknown schema group: %s") % group
|
51
|
+
end
|
52
|
+
|
53
|
+
# Initialize anything that is required
|
54
|
+
info, ids, aliases = ensure_schema_info(group)
|
55
|
+
id, name = determine_id_or_name(id_or_name, aliases)
|
56
|
+
|
57
|
+
# Check already parsed options first
|
58
|
+
return ids[id] if ids.has_key?(id)
|
59
|
+
|
60
|
+
schemata = @entries[group] || []
|
61
|
+
while schema = schemata.shift
|
62
|
+
next unless /\A\s*\(\s*(#{OID_RE})\s*(.*)\s*\)\s*\z/ =~ schema
|
63
|
+
schema_id = $1
|
64
|
+
rest = $2
|
65
|
+
|
66
|
+
if ids.has_key?(schema_id)
|
67
|
+
attributes = ids[schema_id]
|
68
|
+
else
|
69
|
+
attributes = {}
|
70
|
+
ids[schema_id] = attributes
|
71
|
+
end
|
72
|
+
|
73
|
+
parse_attributes(rest, attributes)
|
74
|
+
(attributes["NAME"] || []).each do |v|
|
75
|
+
normalized_name = normalize_schema_name(v)
|
76
|
+
aliases[normalized_name] = schema_id
|
77
|
+
id = schema_id if id.nil? and name == normalized_name
|
78
|
+
end
|
79
|
+
|
80
|
+
break if id == schema_id
|
81
|
+
end
|
82
|
+
|
83
|
+
ids[id || aliases[name]] || {}
|
84
|
+
end
|
85
|
+
|
86
|
+
def attribute(name)
|
87
|
+
cache([:attribute, name]) do
|
88
|
+
Attribute.new(name, self)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def attributes
|
93
|
+
cache([:attributes]) do
|
94
|
+
names("attributeTypes").collect do |name|
|
95
|
+
attribute(name)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def attribute_type(name, attribute_name)
|
101
|
+
cache([:attribute_type, name, attribute_name]) do
|
102
|
+
fetch("attributeTypes", name, attribute_name)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def object_class(name)
|
107
|
+
cache([:object_class, name]) do
|
108
|
+
ObjectClass.new(name, self)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def object_classes
|
113
|
+
cache([:object_classes]) do
|
114
|
+
names("objectClasses").collect do |name|
|
115
|
+
object_class(name)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def object_class_attribute(name, attribute_name)
|
121
|
+
cache([:object_class_attribute, name, attribute_name]) do
|
122
|
+
fetch("objectClasses", name, attribute_name)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def ldap_syntax(name)
|
127
|
+
cache([:ldap_syntax, name]) do
|
128
|
+
Syntax.new(name, self)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def ldap_syntaxes
|
133
|
+
cache([:ldap_syntaxes]) do
|
134
|
+
ids("ldapSyntaxes").collect do |id|
|
135
|
+
ldap_syntax(id)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def ldap_syntax_attribute(name, attribute_name)
|
141
|
+
cache([:ldap_syntax_attribute, name, attribute_name]) do
|
142
|
+
fetch("ldapSyntaxes", name, attribute_name)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
private
|
147
|
+
def cache(key)
|
148
|
+
(@cache[key] ||= [yield])[0]
|
149
|
+
end
|
150
|
+
|
151
|
+
def ensure_schema_info(group)
|
152
|
+
@schema_info[group] ||= {:ids => {}, :aliases => {}}
|
153
|
+
info = @schema_info[group]
|
154
|
+
[info, info[:ids], info[:aliases]]
|
155
|
+
end
|
156
|
+
|
157
|
+
def determine_id_or_name(id_or_name, aliases)
|
158
|
+
if /\A[\d\.]+\z/ =~ id_or_name
|
159
|
+
id = id_or_name
|
160
|
+
name = nil
|
161
|
+
else
|
162
|
+
name = normalize_schema_name(id_or_name)
|
163
|
+
id = aliases[name]
|
164
|
+
end
|
165
|
+
[id, name]
|
166
|
+
end
|
167
|
+
|
168
|
+
# from RFC 2252
|
169
|
+
attribute_type_description_reserved_names =
|
170
|
+
["NAME", "DESC", "OBSOLETE", "SUP", "EQUALITY", "ORDERING", "SUBSTR",
|
171
|
+
"SYNTAX", "SINGLE-VALUE", "COLLECTIVE", "NO-USER-MODIFICATION", "USAGE"]
|
172
|
+
syntax_description_reserved_names = ["DESC"]
|
173
|
+
object_class_description_reserved_names =
|
174
|
+
["NAME", "DESC", "OBSOLETE", "SUP", "ABSTRACT", "STRUCTURAL",
|
175
|
+
"AUXILIARY", "MUST", "MAY"]
|
176
|
+
matching_rule_description_reserved_names =
|
177
|
+
["NAME", "DESC", "OBSOLETE", "SYNTAX"]
|
178
|
+
matching_rule_use_description_reserved_names =
|
179
|
+
["NAME", "DESC", "OBSOLETE", "APPLIES"]
|
180
|
+
private_experiment_reserved_names = ["X-[A-Z\\-_]+"]
|
181
|
+
reserved_names =
|
182
|
+
(attribute_type_description_reserved_names +
|
183
|
+
syntax_description_reserved_names +
|
184
|
+
object_class_description_reserved_names +
|
185
|
+
matching_rule_description_reserved_names +
|
186
|
+
matching_rule_use_description_reserved_names +
|
187
|
+
private_experiment_reserved_names).uniq
|
188
|
+
RESERVED_NAMES_RE = /(?:#{reserved_names.join('|')})/
|
189
|
+
|
190
|
+
def parse_attributes(str, attributes)
|
191
|
+
str.scan(/([A-Z\-_]+)\s+
|
192
|
+
(?:\(\s*([\w\-]+(?:\s+\$\s+[\w\-]+)+)\s*\)|
|
193
|
+
\(\s*([^\)]*)\s*\)|
|
194
|
+
'([^\']*)'|
|
195
|
+
((?!#{RESERVED_NAMES_RE})[a-zA-Z][a-zA-Z\d\-;]*)|
|
196
|
+
(\d[\d\.\{\}]+)|
|
197
|
+
()
|
198
|
+
)/x
|
199
|
+
) do |name, multi_amp, multi, string, literal, syntax, no_value|
|
200
|
+
case
|
201
|
+
when multi_amp
|
202
|
+
values = multi_amp.rstrip.split(/\s*\$\s*/)
|
203
|
+
when multi
|
204
|
+
values = multi.scan(/\s*'([^\']*)'\s*/).collect {|value| value[0]}
|
205
|
+
when string
|
206
|
+
values = [string]
|
207
|
+
when literal
|
208
|
+
values = [literal]
|
209
|
+
when syntax
|
210
|
+
values = [syntax]
|
211
|
+
when no_value
|
212
|
+
values = ["TRUE"]
|
213
|
+
end
|
214
|
+
attributes[normalize_attribute_name(name)] ||= []
|
215
|
+
attributes[normalize_attribute_name(name)].concat(values)
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def alias_map(group)
|
220
|
+
ensure_parse(group)
|
221
|
+
return {} if @schema_info[group].nil?
|
222
|
+
@schema_info[group][:aliases] || {}
|
223
|
+
end
|
224
|
+
|
225
|
+
def ensure_parse(group)
|
226
|
+
return if @entries[group].nil?
|
227
|
+
unless @entries[group].empty?
|
228
|
+
fetch(group, 'nonexistent', 'nonexistent')
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def normalize_schema_name(name)
|
233
|
+
name.downcase.sub(/;.*$/, '')
|
234
|
+
end
|
235
|
+
|
236
|
+
def normalize_attribute_name(name)
|
237
|
+
name.upcase.gsub(/_/, "-")
|
238
|
+
end
|
239
|
+
|
240
|
+
def default_entries
|
241
|
+
{
|
242
|
+
"objectClasses" => [],
|
243
|
+
"attributeTypes" => [],
|
244
|
+
"ldapSyntaxes" => [],
|
245
|
+
}
|
246
|
+
end
|
247
|
+
|
248
|
+
class Entry
|
249
|
+
include Comparable
|
250
|
+
|
251
|
+
attr_reader :id, :name, :aliases, :description
|
252
|
+
def initialize(name, schema, group)
|
253
|
+
@schema = schema
|
254
|
+
@name, *@aliases = attribute("NAME", name)
|
255
|
+
@name ||= name
|
256
|
+
@id = @schema.resolve_name(group, @name)
|
257
|
+
collect_info
|
258
|
+
@schema = nil
|
259
|
+
end
|
260
|
+
|
261
|
+
def eql?(other)
|
262
|
+
self.class == other.class and
|
263
|
+
id == other.id
|
264
|
+
end
|
265
|
+
|
266
|
+
def hash
|
267
|
+
id.hash
|
268
|
+
end
|
269
|
+
|
270
|
+
def <=>(other)
|
271
|
+
name <=> other.name
|
272
|
+
end
|
273
|
+
|
274
|
+
def to_param
|
275
|
+
name
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
class Syntax < Entry
|
280
|
+
attr_reader :length
|
281
|
+
def initialize(id, schema)
|
282
|
+
if /\{(\d+)\}\z/ =~ id
|
283
|
+
id = $PREMATCH
|
284
|
+
@length = Integer($1)
|
285
|
+
else
|
286
|
+
@length = nil
|
287
|
+
end
|
288
|
+
super(id, schema, "ldapSyntaxes")
|
289
|
+
@id = id
|
290
|
+
@name = nil if @name == @id
|
291
|
+
@validator = Syntaxes[@id]
|
292
|
+
end
|
293
|
+
|
294
|
+
def binary_transfer_required?
|
295
|
+
@binary_transfer_required
|
296
|
+
end
|
297
|
+
|
298
|
+
def human_readable?
|
299
|
+
@human_readable
|
300
|
+
end
|
301
|
+
|
302
|
+
def valid?(value)
|
303
|
+
validate(value).nil?
|
304
|
+
end
|
305
|
+
|
306
|
+
def validate(value)
|
307
|
+
if @validator
|
308
|
+
@validator.validate(value)
|
309
|
+
else
|
310
|
+
nil
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
def type_cast(value)
|
315
|
+
if @validator
|
316
|
+
@validator.type_cast(value)
|
317
|
+
else
|
318
|
+
value
|
319
|
+
end
|
320
|
+
end
|
321
|
+
|
322
|
+
def normalize_value(value)
|
323
|
+
if @validator
|
324
|
+
@validator.normalize_value(value)
|
325
|
+
else
|
326
|
+
value
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
def <=>(other)
|
331
|
+
id <=> other.id
|
332
|
+
end
|
333
|
+
|
334
|
+
def to_param
|
335
|
+
id
|
336
|
+
end
|
337
|
+
|
338
|
+
private
|
339
|
+
def attribute(attribute_name, name=@name)
|
340
|
+
@schema.ldap_syntax_attribute(name, attribute_name)
|
341
|
+
end
|
342
|
+
|
343
|
+
def collect_info
|
344
|
+
@description = attribute("DESC")[0]
|
345
|
+
@binary_transfer_required =
|
346
|
+
(attribute('X-BINARY-TRANSFER-REQUIRED')[0] == 'TRUE')
|
347
|
+
@human_readable = (attribute('X-NOT-HUMAN-READABLE')[0] != 'TRUE')
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
class Attribute < Entry
|
352
|
+
attr_reader :super_attribute
|
353
|
+
def initialize(name, schema)
|
354
|
+
super(name, schema, "attributeTypes")
|
355
|
+
end
|
356
|
+
|
357
|
+
# read_only?
|
358
|
+
#
|
359
|
+
# Returns true if an attribute is read-only
|
360
|
+
# NO-USER-MODIFICATION
|
361
|
+
def read_only?
|
362
|
+
@read_only
|
363
|
+
end
|
364
|
+
|
365
|
+
# single_value?
|
366
|
+
#
|
367
|
+
# Returns true if an attribute can only have one
|
368
|
+
# value defined
|
369
|
+
# SINGLE-VALUE
|
370
|
+
def single_value?
|
371
|
+
@single_value
|
372
|
+
end
|
373
|
+
|
374
|
+
# binary?
|
375
|
+
#
|
376
|
+
# Returns true if the given attribute's syntax
|
377
|
+
# is X-NOT-HUMAN-READABLE or X-BINARY-TRANSFER-REQUIRED
|
378
|
+
def binary?
|
379
|
+
@binary
|
380
|
+
end
|
381
|
+
|
382
|
+
# binary_required?
|
383
|
+
#
|
384
|
+
# Returns true if the value MUST be transferred in binary
|
385
|
+
def binary_required?
|
386
|
+
@binary_required
|
387
|
+
end
|
388
|
+
|
389
|
+
def syntax
|
390
|
+
(@derived_syntax ||= [derived_syntax])[0]
|
391
|
+
end
|
392
|
+
|
393
|
+
def valid?(value)
|
394
|
+
validate(value).nil?
|
395
|
+
end
|
396
|
+
|
397
|
+
def validate(value)
|
398
|
+
send_to_syntax(nil, :validate, value)
|
399
|
+
end
|
400
|
+
|
401
|
+
def type_cast(value)
|
402
|
+
send_to_syntax(value, :type_cast, value)
|
403
|
+
end
|
404
|
+
|
405
|
+
def normalize_value(value)
|
406
|
+
send_to_syntax(value, :normalize_value, value)
|
407
|
+
end
|
408
|
+
|
409
|
+
def syntax_description
|
410
|
+
send_to_syntax(nil, :description)
|
411
|
+
end
|
412
|
+
|
413
|
+
private
|
414
|
+
def attribute(attribute_name, name=@name)
|
415
|
+
@schema.attribute_type(name, attribute_name)
|
416
|
+
end
|
417
|
+
|
418
|
+
def collect_info
|
419
|
+
@description = attribute("DESC")[0]
|
420
|
+
@super_attribute = attribute("SUP")[0]
|
421
|
+
if @super_attribute
|
422
|
+
@super_attribute = @schema.attribute(@super_attribute)
|
423
|
+
@super_attribute = nil if @super_attribute.id.nil?
|
424
|
+
end
|
425
|
+
@read_only = attribute('NO-USER-MODIFICATION')[0] == 'TRUE'
|
426
|
+
@single_value = attribute('SINGLE-VALUE')[0] == 'TRUE'
|
427
|
+
@syntax = attribute("SYNTAX")[0]
|
428
|
+
@syntax = @schema.ldap_syntax(@syntax) if @syntax
|
429
|
+
if @syntax
|
430
|
+
@binary_required = @syntax.binary_transfer_required?
|
431
|
+
@binary = (@binary_required or !@syntax.human_readable?)
|
432
|
+
else
|
433
|
+
@binary_required = false
|
434
|
+
@binary = false
|
435
|
+
end
|
436
|
+
end
|
437
|
+
|
438
|
+
def derived_syntax
|
439
|
+
return @syntax if @syntax
|
440
|
+
return @super_attribute.syntax if @super_attribute
|
441
|
+
nil
|
442
|
+
end
|
443
|
+
|
444
|
+
def send_to_syntax(default_value, method_name, *args)
|
445
|
+
_syntax = syntax
|
446
|
+
if _syntax
|
447
|
+
_syntax.send(method_name, *args)
|
448
|
+
else
|
449
|
+
default_value
|
450
|
+
end
|
451
|
+
end
|
452
|
+
end
|
453
|
+
|
454
|
+
class ObjectClass < Entry
|
455
|
+
attr_reader :super_classes
|
456
|
+
def initialize(name, schema)
|
457
|
+
super(name, schema, "objectClasses")
|
458
|
+
end
|
459
|
+
|
460
|
+
def super_class?(object_class)
|
461
|
+
@super_classes.include?(object_class)
|
462
|
+
end
|
463
|
+
|
464
|
+
def must(include_super_class=true)
|
465
|
+
if include_super_class
|
466
|
+
@all_must
|
467
|
+
else
|
468
|
+
@must
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
472
|
+
def may(include_super_class=true)
|
473
|
+
if include_super_class
|
474
|
+
@all_may
|
475
|
+
else
|
476
|
+
@may
|
477
|
+
end
|
478
|
+
end
|
479
|
+
|
480
|
+
private
|
481
|
+
def collect_info
|
482
|
+
@description = attribute("DESC")[0]
|
483
|
+
@super_classes = collect_super_classes
|
484
|
+
@must, @may, @all_must, @all_may = collect_attributes
|
485
|
+
end
|
486
|
+
|
487
|
+
def collect_super_classes
|
488
|
+
super_classes = attribute('SUP')
|
489
|
+
loop do
|
490
|
+
start_size = super_classes.size
|
491
|
+
new_super_classes = []
|
492
|
+
super_classes.each do |super_class|
|
493
|
+
new_super_classes.concat(attribute('SUP', super_class))
|
494
|
+
end
|
495
|
+
|
496
|
+
super_classes.concat(new_super_classes)
|
497
|
+
super_classes.uniq!
|
498
|
+
break if super_classes.size == start_size
|
499
|
+
end
|
500
|
+
super_classes.collect do |name|
|
501
|
+
@schema.object_class(name)
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
def collect_attributes
|
506
|
+
must = attribute('MUST').collect {|name| @schema.attribute(name)}
|
507
|
+
may = attribute('MAY').collect {|name| @schema.attribute(name)}
|
508
|
+
|
509
|
+
all_must = must.dup
|
510
|
+
all_may = may.dup
|
511
|
+
@super_classes.each do |super_class|
|
512
|
+
all_must.concat(super_class.must(false))
|
513
|
+
all_may.concat(super_class.may(false))
|
514
|
+
end
|
515
|
+
|
516
|
+
# Clean out the dupes.
|
517
|
+
all_must.uniq!
|
518
|
+
all_may.uniq!
|
519
|
+
|
520
|
+
[must, may, all_must, all_may]
|
521
|
+
end
|
522
|
+
|
523
|
+
def attribute(attribute_name, name=@name)
|
524
|
+
@schema.object_class_attribute(name, attribute_name)
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
|
530
|
+
require 'active_ldap/schema/syntaxes'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
|
3
|
+
module Timeout
|
4
|
+
|
5
|
+
# A forking timeout implementation that relies on
|
6
|
+
# signals to interrupt blocking I/O instead of passing
|
7
|
+
# that code to run in a separate process.
|
8
|
+
#
|
9
|
+
# A process is fork()ed, sleeps for _sec_,
|
10
|
+
# then sends a ALRM signal to the Process.ppid
|
11
|
+
# process. ALRM is used to avoid conflicts with sleep()
|
12
|
+
#
|
13
|
+
# This overwrites any signal
|
14
|
+
def Timeout.alarm(sec, exception=Timeout::Error, &block)
|
15
|
+
return block.call if sec == nil or sec.zero?
|
16
|
+
|
17
|
+
|
18
|
+
# Trap an alarm in case it comes before we're ready
|
19
|
+
orig_alrm = trap(:ALRM, 'IGNORE')
|
20
|
+
|
21
|
+
# Setup a fallback in case of a race condition of an
|
22
|
+
# alarm before we set the other trap
|
23
|
+
trap(:ALRM) do
|
24
|
+
# Don't leave zombies
|
25
|
+
Process.wait2()
|
26
|
+
# Restore the original handler
|
27
|
+
trap('ALRM', orig_alrm)
|
28
|
+
# Now raise an exception!
|
29
|
+
raise exception, 'execution expired'
|
30
|
+
end
|
31
|
+
|
32
|
+
# Spawn the sleeper
|
33
|
+
pid = Process.fork {
|
34
|
+
begin
|
35
|
+
# Sleep x seconds then send SIGALRM
|
36
|
+
sleep(sec)
|
37
|
+
# Send alarm!
|
38
|
+
Process.kill(:ALRM, Process.ppid)
|
39
|
+
end
|
40
|
+
exit! 0
|
41
|
+
}
|
42
|
+
|
43
|
+
# Setup the real handler
|
44
|
+
trap(:ALRM) do
|
45
|
+
# Make sure we clean up any zombies
|
46
|
+
Process.waitpid(pid)
|
47
|
+
# Restore the original handler
|
48
|
+
trap(:ALRM, orig_alrm)
|
49
|
+
# Now raise an exception!
|
50
|
+
raise exception, 'execution expired'
|
51
|
+
end
|
52
|
+
|
53
|
+
begin
|
54
|
+
# Run the code!
|
55
|
+
return block.call
|
56
|
+
ensure
|
57
|
+
# Restore old alarm handler since we're done
|
58
|
+
trap(:ALRM, orig_alrm)
|
59
|
+
# Make sure the process is dead
|
60
|
+
# This may be run twice (trap occurs during execution) so ignore ESRCH
|
61
|
+
Process.kill(:TERM, pid) rescue Errno::ESRCH
|
62
|
+
# Don't leave zombies
|
63
|
+
Process.waitpid(pid) rescue Errno::ECHILD
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end # Timeout
|
67
|
+
|
68
|
+
if __FILE__ == $0
|
69
|
+
require 'time'
|
70
|
+
Timeout.alarm(2) do
|
71
|
+
loop do
|
72
|
+
p Time.now
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
|
3
|
+
module Timeout
|
4
|
+
# STUB
|
5
|
+
def Timeout.alarm(sec, exception=Timeout::Error, &block)
|
6
|
+
return block.call
|
7
|
+
end
|
8
|
+
end # Timeout
|
9
|
+
|
10
|
+
if __FILE__ == $0
|
11
|
+
require 'time'
|
12
|
+
Timeout.alarm(2) do
|
13
|
+
loop do
|
14
|
+
p Time.now
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'English'
|
2
|
+
require 'base64'
|
3
|
+
require 'md5'
|
4
|
+
require 'sha1'
|
5
|
+
|
6
|
+
module ActiveLdap
|
7
|
+
module UserPassword
|
8
|
+
module_function
|
9
|
+
def valid?(password, hashed_password)
|
10
|
+
unless /^\{([A-Z][A-Z\d]+)\}/ =~ hashed_password
|
11
|
+
raise ArgumentError, _("Invalid hashed password: %s") % hashed_password
|
12
|
+
end
|
13
|
+
type = $1
|
14
|
+
hashed_password_without_type = $POSTMATCH
|
15
|
+
normalized_type = type.downcase
|
16
|
+
unless respond_to?(normalized_type)
|
17
|
+
raise ArgumentError, _("Unknown Hash type: %s") % type
|
18
|
+
end
|
19
|
+
salt_extractor = "extract_salt_for_#{normalized_type}"
|
20
|
+
if respond_to?(salt_extractor)
|
21
|
+
salt = send(salt_extractor, hashed_password_without_type)
|
22
|
+
if salt.nil?
|
23
|
+
raise ArgumentError,
|
24
|
+
_("Can't extract salt from hashed password: %s") % hashed_password
|
25
|
+
end
|
26
|
+
generated_password = send(normalized_type, password, salt)
|
27
|
+
else
|
28
|
+
generated_password = send(normalized_type, password)
|
29
|
+
end
|
30
|
+
hashed_password == generated_password
|
31
|
+
end
|
32
|
+
|
33
|
+
def crypt(password, salt=nil)
|
34
|
+
salt ||= "$1$#{Salt.generate(8)}"
|
35
|
+
"{CRYPT}#{password.crypt(salt)}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def extract_salt_for_crypt(crypted_password)
|
39
|
+
if /^\$1\$/ =~ crypted_password
|
40
|
+
$MATCH + $POSTMATCH[0, 8].sub(/\$.*/, '') + "$"
|
41
|
+
else
|
42
|
+
crypted_password[0, 2]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def md5(password)
|
47
|
+
"{MD5}#{Base64.encode64(MD5.md5(password).digest).chomp}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def smd5(password, salt=nil)
|
51
|
+
if salt and salt.size != 4
|
52
|
+
raise ArgumentError, _("salt size must be == 4: %s") % salt.inspect
|
53
|
+
end
|
54
|
+
salt ||= Salt.generate(4)
|
55
|
+
md5_hash_with_salt = "#{MD5.md5(password + salt).digest}#{salt}"
|
56
|
+
"{SMD5}#{Base64.encode64(md5_hash_with_salt).chomp}"
|
57
|
+
end
|
58
|
+
|
59
|
+
def extract_salt_for_smd5(smd5ed_password)
|
60
|
+
Base64.decode64(smd5ed_password)[-4, 4]
|
61
|
+
end
|
62
|
+
|
63
|
+
def sha(password)
|
64
|
+
"{SHA}#{Base64.encode64(SHA1.sha1(password).digest).chomp}"
|
65
|
+
end
|
66
|
+
|
67
|
+
def ssha(password, salt=nil)
|
68
|
+
if salt and salt.size != 4
|
69
|
+
raise ArgumentError, _("salt size must be == 4: %s") % salt.inspect
|
70
|
+
end
|
71
|
+
salt ||= Salt.generate(4)
|
72
|
+
sha1_hash_with_salt = "#{SHA1.sha1(password + salt).digest}#{salt}"
|
73
|
+
"{SSHA}#{Base64.encode64(sha1_hash_with_salt).chomp}"
|
74
|
+
end
|
75
|
+
|
76
|
+
def extract_salt_for_ssha(sshaed_password)
|
77
|
+
extract_salt_for_smd5(sshaed_password)
|
78
|
+
end
|
79
|
+
|
80
|
+
module Salt
|
81
|
+
CHARS = ['.', '/', '0'..'9', 'A'..'Z', 'a'..'z'].collect do |x|
|
82
|
+
x.to_a
|
83
|
+
end.flatten
|
84
|
+
|
85
|
+
module_function
|
86
|
+
def generate(length)
|
87
|
+
salt = ""
|
88
|
+
length.times {salt << CHARS[rand(CHARS.length)]}
|
89
|
+
salt
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|