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,353 @@
|
|
1
|
+
require 'al-test-utils'
|
2
|
+
|
3
|
+
class TestAssociations < Test::Unit::TestCase
|
4
|
+
include AlTestUtils
|
5
|
+
|
6
|
+
priority :must
|
7
|
+
|
8
|
+
priority :normal
|
9
|
+
def test_belongs_to_many_with_dn_key
|
10
|
+
@user_class.belongs_to :groups, :many => "memberUid", :foreign_key => "dn"
|
11
|
+
@user_class.set_associated_class(:groups, @group_class)
|
12
|
+
@group_class.has_many :members, :wrap => "memberUid", :primary_key => "dn"
|
13
|
+
@group_class.set_associated_class(:members, @user_class)
|
14
|
+
make_temporary_group do |group|
|
15
|
+
make_temporary_user do |user1,|
|
16
|
+
make_temporary_user do |user2,|
|
17
|
+
group.members = [user1, user2]
|
18
|
+
assert(group.save)
|
19
|
+
assert_equal([group.cn], user1.groups.collect(&:cn))
|
20
|
+
assert_equal([group.cn], user2.groups.collect(&:cn))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_belongs_to_many_delete
|
27
|
+
make_temporary_group do |group1|
|
28
|
+
make_temporary_group do |group2|
|
29
|
+
make_temporary_user do |user,|
|
30
|
+
user.update_attribute(:cn, "new #{user.cn}")
|
31
|
+
|
32
|
+
user.groups = [group1, group2]
|
33
|
+
assert_equal([group1.id, group2.id].sort,
|
34
|
+
user.groups.collect {|g| g.id}.sort)
|
35
|
+
assert_equal([user.id].sort, group1.member_uid(true))
|
36
|
+
assert_equal([user.id].sort, group2.member_uid(true))
|
37
|
+
|
38
|
+
user.groups = []
|
39
|
+
assert_equal([], user.groups.to_a)
|
40
|
+
assert_equal([], group1.member_uid(true))
|
41
|
+
assert_equal([], group2.member_uid(true))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
priority :normal
|
48
|
+
def test_belongs_to_before_save
|
49
|
+
make_temporary_group do |group1|
|
50
|
+
make_temporary_group do |group2|
|
51
|
+
ensure_delete_group(group2.cn.succ) do |group3_name|
|
52
|
+
group3 = @group_class.new(group3_name)
|
53
|
+
group3.gid_number = group2.gid_number.succ
|
54
|
+
make_temporary_user(:gid_number => group1.gid_number) do |user,|
|
55
|
+
assert_equal(group1.gid_number, user.primary_group.gid_number)
|
56
|
+
assert_equal(group1.gid_number, user.gid_number)
|
57
|
+
|
58
|
+
user.primary_group = group2
|
59
|
+
assert_equal(group2.gid_number, user.primary_group.gid_number)
|
60
|
+
assert_equal(group2.gid_number, user.gid_number)
|
61
|
+
|
62
|
+
user_in_ldap = @user_class.find(user.id)
|
63
|
+
assert_equal(group1.gid_number,
|
64
|
+
user_in_ldap.primary_group.gid_number)
|
65
|
+
assert_equal(group1.gid_number, user_in_ldap.gid_number)
|
66
|
+
|
67
|
+
assert(group3.new_entry?)
|
68
|
+
user.primary_group = group3
|
69
|
+
assert_equal(group3.gid_number, user.primary_group.gid_number)
|
70
|
+
assert_equal(group2.gid_number, user.gid_number)
|
71
|
+
|
72
|
+
assert(user.save)
|
73
|
+
assert_equal(group3.gid_number, user.gid_number)
|
74
|
+
|
75
|
+
user_in_ldap = @user_class.find(user.id)
|
76
|
+
assert(!user_in_ldap.primary_group.exists?)
|
77
|
+
|
78
|
+
assert(group3.save)
|
79
|
+
assert(user_in_ldap.primary_group.exists?)
|
80
|
+
assert_equal(group3.gid_number,
|
81
|
+
user_in_ldap.primary_group.gid_number)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_extend
|
89
|
+
mod = Module.new
|
90
|
+
mod.__send__(:mattr_accessor, :called)
|
91
|
+
mod.__send__(:define_method, :replace) do |entries|
|
92
|
+
super
|
93
|
+
mod.called = true
|
94
|
+
end
|
95
|
+
mod.called = false
|
96
|
+
|
97
|
+
@group_class.send(:undef_method, :members, :members=)
|
98
|
+
@group_class.has_many :members, :wrap => "memberUid",
|
99
|
+
:extend => mod
|
100
|
+
@group_class.set_associated_class(:members, @user_class)
|
101
|
+
|
102
|
+
make_temporary_group do |group|
|
103
|
+
gid_number1 = group.gid_number.to_i + 1
|
104
|
+
make_temporary_user(:gid_number => gid_number1) do |user1, password1|
|
105
|
+
user1.update_attribute(:cn, "new #{user1.cn}")
|
106
|
+
|
107
|
+
assert(!mod.called)
|
108
|
+
group.members = [user1]
|
109
|
+
assert(mod.called)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_has_many_wrap_assign
|
115
|
+
make_temporary_group do |group|
|
116
|
+
gid_number1 = group.gid_number.to_i + 1
|
117
|
+
gid_number2 = group.gid_number.to_i + 2
|
118
|
+
make_temporary_user(:gid_number => gid_number1) do |user1, password1|
|
119
|
+
make_temporary_user(:gid_number => gid_number2) do |user2, password2|
|
120
|
+
user1.update_attribute(:cn, "new #{user1.cn}")
|
121
|
+
user2.update_attribute(:cn, "new #{user2.cn}")
|
122
|
+
|
123
|
+
assert_equal([], group.members.to_a)
|
124
|
+
assert_equal([], group.member_uid(true))
|
125
|
+
|
126
|
+
assert_equal(gid_number1, user1.gid_number.to_i)
|
127
|
+
assert_equal(gid_number2, user2.gid_number.to_i)
|
128
|
+
group.members = [user1, user2]
|
129
|
+
assert_equal([user1.uid, user2.uid].sort,
|
130
|
+
group.members.collect {|x| x.uid}.sort)
|
131
|
+
assert_equal([user1.uid, user2.uid].sort, group.member_uid.sort)
|
132
|
+
assert_equal(gid_number2, user2.gid_number.to_i)
|
133
|
+
|
134
|
+
group.members = [user1]
|
135
|
+
assert_equal([user1.uid].sort,
|
136
|
+
group.members.collect {|x| x.uid}.sort)
|
137
|
+
assert_equal([user1.uid].sort, group.member_uid.sort)
|
138
|
+
assert_equal(gid_number1, user1.gid_number.to_i)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_has_many_validation
|
145
|
+
group_class = Class.new(ActiveLdap::Base)
|
146
|
+
group_class.ldap_mapping :prefix => "ou=Groups",
|
147
|
+
:scope => :sub,
|
148
|
+
:classes => ["posixGroup"]
|
149
|
+
assert_raises(ArgumentError) do
|
150
|
+
group_class.has_many :members, :class_name => "User"
|
151
|
+
end
|
152
|
+
|
153
|
+
mod = Module.new
|
154
|
+
assert_nothing_raised do
|
155
|
+
group_class.has_many :members, :class => "User", :wrap => "memberUid",
|
156
|
+
:extend => mod
|
157
|
+
group_class.has_many :primary_members, :class => "User",
|
158
|
+
:foreign_key => "gidNumber",
|
159
|
+
:primary_key => "gidNumber",
|
160
|
+
:extend => mod
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_belongs_to_validation
|
165
|
+
user_class = Class.new(ActiveLdap::Base)
|
166
|
+
user_class.ldap_mapping :dn_attribute => "uid",
|
167
|
+
:prefix => "ou=Users",
|
168
|
+
:scope => :sub,
|
169
|
+
:classes => ["posixAccount", "person"]
|
170
|
+
assert_raises(ArgumentError) do
|
171
|
+
user_class.belongs_to :groups, :class_name => "Group"
|
172
|
+
end
|
173
|
+
|
174
|
+
mod = Module.new
|
175
|
+
assert_nothing_raised do
|
176
|
+
user_class.belongs_to :groups, :class => "Group", :many => "memberUid",
|
177
|
+
:extend => mod
|
178
|
+
user_class.belongs_to :primary_group, :class => "Group",
|
179
|
+
:foreign_key => "gidNumber",
|
180
|
+
:primary_key => "gidNumber",
|
181
|
+
:extend => mod
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def test_has_many_assign
|
186
|
+
make_temporary_group do |group|
|
187
|
+
gid_number1 = group.gid_number.to_i + 1
|
188
|
+
gid_number2 = group.gid_number.to_i + 2
|
189
|
+
make_temporary_user(:gid_number => gid_number1) do |user1, password1|
|
190
|
+
make_temporary_user(:gid_number => gid_number2) do |user2, password2|
|
191
|
+
assert_equal(gid_number1, user1.gid_number.to_i)
|
192
|
+
group.primary_members = [user1]
|
193
|
+
assert_equal([user1.uid].sort,
|
194
|
+
group.primary_members.collect {|x| x.uid}.sort)
|
195
|
+
assert_equal(group.gid_number, user1.gid_number)
|
196
|
+
|
197
|
+
assert_equal(gid_number2, user2.gid_number.to_i)
|
198
|
+
group.primary_members = [user1, user2]
|
199
|
+
assert_equal([user1.uid, user2.uid].sort,
|
200
|
+
group.primary_members.collect {|x| x.uid}.sort)
|
201
|
+
assert_equal(group.gid_number, user2.gid_number)
|
202
|
+
|
203
|
+
|
204
|
+
assert_raises(ActiveLdap::RequiredAttributeMissed) do
|
205
|
+
group.primary_members = []
|
206
|
+
end
|
207
|
+
|
208
|
+
assert_raises(ActiveLdap::RequiredAttributeMissed) do
|
209
|
+
group.primary_members = [user1]
|
210
|
+
end
|
211
|
+
|
212
|
+
assert_raises(ActiveLdap::RequiredAttributeMissed) do
|
213
|
+
group.primary_members = [user2]
|
214
|
+
end
|
215
|
+
|
216
|
+
assert_nothing_raised do
|
217
|
+
group.primary_members = [user1, user2]
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_belongs_to_many
|
225
|
+
make_temporary_group do |group1|
|
226
|
+
make_temporary_group do |group2|
|
227
|
+
make_temporary_user do |user,|
|
228
|
+
user.update_attribute(:cn, "new #{user.cn}")
|
229
|
+
|
230
|
+
assert_equal([], user.groups.to_a)
|
231
|
+
assert_equal([], group1.member_uid(true))
|
232
|
+
assert_equal([], group2.member_uid(true))
|
233
|
+
|
234
|
+
user.groups << group1
|
235
|
+
assert_equal([group1.id].sort, user.groups.collect {|g| g.id}.sort)
|
236
|
+
assert_equal([user.id].sort, group1.member_uid(true))
|
237
|
+
assert_equal([].sort, group2.member_uid(true))
|
238
|
+
|
239
|
+
user.groups << group2
|
240
|
+
assert_equal([group1.id, group2.id].sort,
|
241
|
+
user.groups.collect {|g| g.id}.sort)
|
242
|
+
assert_equal([user.id].sort, group1.member_uid(true))
|
243
|
+
assert_equal([user.id].sort, group2.member_uid(true))
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def test_belongs_to_many_non_exist
|
250
|
+
make_temporary_group do |group|
|
251
|
+
ensure_delete_user("temp-user1") do |user1,|
|
252
|
+
options = {:uid => "temp-user2", :gid_number => group.gid_number.succ}
|
253
|
+
make_temporary_user(options) do |user2,|
|
254
|
+
ensure_delete_user("temp-user3") do |user3,|
|
255
|
+
group.members << user2
|
256
|
+
group.member_uid = [user1, group.member_uid, user3]
|
257
|
+
assert(group.save)
|
258
|
+
group.members.reload
|
259
|
+
assert_equal([user1, user2.id, user3],
|
260
|
+
group.members.collect {|g| g.id})
|
261
|
+
assert_equal([true, false, true],
|
262
|
+
group.members.collect {|g| g.new_entry?})
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
def test_belongs_to
|
270
|
+
make_temporary_group do |group|
|
271
|
+
gid_number = group.gid_number.to_i + 1
|
272
|
+
make_temporary_user(:gid_number => group.gid_number) do |user_in_group,|
|
273
|
+
make_temporary_user(:gid_number => gid_number) do |user_not_in_group,|
|
274
|
+
assert(user_in_group.primary_group.reload)
|
275
|
+
assert(user_in_group.primary_group.loaded?)
|
276
|
+
assert_equal(group.gid_number, user_in_group.gid_number)
|
277
|
+
assert_equal(group.gid_number, user_in_group.primary_group.gid_number)
|
278
|
+
|
279
|
+
|
280
|
+
assert(!user_not_in_group.primary_group.loaded?)
|
281
|
+
|
282
|
+
assert_equal(gid_number, user_not_in_group.gid_number.to_i)
|
283
|
+
assert_not_equal(group.gid_number, user_not_in_group.gid_number)
|
284
|
+
|
285
|
+
user_not_in_group.primary_group = group
|
286
|
+
assert(user_not_in_group.primary_group.loaded?)
|
287
|
+
assert(user_not_in_group.primary_group.updated?)
|
288
|
+
assert_equal(group.gid_number, user_not_in_group.gid_number)
|
289
|
+
assert_equal(group.gid_number,
|
290
|
+
user_not_in_group.primary_group.gid_number)
|
291
|
+
assert_not_equal(gid_number, user_not_in_group.gid_number.to_i)
|
292
|
+
|
293
|
+
assert_equal(group.gid_number, user_in_group.gid_number)
|
294
|
+
assert_equal(group.gid_number, user_in_group.primary_group.gid_number)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
def test_has_many_wrap
|
301
|
+
make_temporary_group do |group|
|
302
|
+
gid_number1 = group.gid_number.to_i + 1
|
303
|
+
gid_number2 = group.gid_number.to_i + 2
|
304
|
+
make_temporary_user(:gid_number => gid_number1) do |user1, password1|
|
305
|
+
make_temporary_user(:gid_number => gid_number2) do |user2, password2|
|
306
|
+
user1.update_attribute(:cn, "new #{user1.cn}")
|
307
|
+
user2.update_attribute(:cn, "new #{user2.cn}")
|
308
|
+
|
309
|
+
assert_equal([], group.members.to_a)
|
310
|
+
assert_equal([], group.member_uid(true))
|
311
|
+
|
312
|
+
assert_equal(gid_number1, user1.gid_number.to_i)
|
313
|
+
group.members << user1
|
314
|
+
assert_equal([user1.uid].sort,
|
315
|
+
group.members.collect {|x| x.uid}.sort)
|
316
|
+
assert_equal([user1.uid].sort, group.member_uid.sort)
|
317
|
+
assert_equal(gid_number1, user1.gid_number.to_i)
|
318
|
+
|
319
|
+
assert_equal(gid_number2, user2.gid_number.to_i)
|
320
|
+
group.members << user2
|
321
|
+
assert_equal([user1.uid, user2.uid].sort,
|
322
|
+
group.members.collect {|x| x.uid}.sort)
|
323
|
+
assert_equal([user1.uid, user2.uid].sort, group.member_uid.sort)
|
324
|
+
assert_equal(gid_number2, user2.gid_number.to_i)
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
def test_has_many
|
331
|
+
make_temporary_group do |group|
|
332
|
+
gid_number1 = group.gid_number.to_i + 1
|
333
|
+
gid_number2 = group.gid_number.to_i + 2
|
334
|
+
make_temporary_user(:gid_number => gid_number1) do |user1, password1|
|
335
|
+
make_temporary_user(:gid_number => gid_number2) do |user2, password2|
|
336
|
+
assert_equal([], group.primary_members.to_a)
|
337
|
+
|
338
|
+
assert_equal(gid_number1, user1.gid_number.to_i)
|
339
|
+
group.primary_members << user1
|
340
|
+
assert_equal([user1.uid].sort,
|
341
|
+
group.primary_members.collect {|x| x.uid}.sort)
|
342
|
+
assert_equal(group.gid_number, user1.gid_number)
|
343
|
+
|
344
|
+
assert_equal(gid_number2, user2.gid_number.to_i)
|
345
|
+
group.primary_members << user2
|
346
|
+
assert_equal([user1.uid, user2.uid].sort,
|
347
|
+
group.primary_members.collect {|x| x.uid}.sort)
|
348
|
+
assert_equal(group.gid_number, user2.gid_number)
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'al-test-utils'
|
2
|
+
|
3
|
+
class TestAttributes < Test::Unit::TestCase
|
4
|
+
include AlTestUtils
|
5
|
+
|
6
|
+
priority :must
|
7
|
+
|
8
|
+
priority :normal
|
9
|
+
def test_to_real_attribute_name
|
10
|
+
user = @user_class.new("user")
|
11
|
+
assert_nil(user.__send__(:to_real_attribute_name, "objectclass"))
|
12
|
+
assert_equal("objectClass",
|
13
|
+
user.__send__(:to_real_attribute_name, "objectclass", true))
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_protect_object_class_from_mass_assignment
|
17
|
+
classes = @user_class.required_classes + ["inetOrgPerson"]
|
18
|
+
user = @user_class.new(:uid => "XXX", :object_class => classes)
|
19
|
+
assert_equal(["inetOrgPerson"],
|
20
|
+
user.classes - @user_class.required_classes)
|
21
|
+
|
22
|
+
user = @user_class.new(:uid => "XXX", :object_class => ['inetOrgPerson'])
|
23
|
+
assert_equal(["inetOrgPerson"],
|
24
|
+
user.classes - @user_class.required_classes)
|
25
|
+
|
26
|
+
user = @user_class.new("XXX")
|
27
|
+
assert_equal([], user.classes - @user_class.required_classes)
|
28
|
+
user.attributes = {:object_class => classes}
|
29
|
+
assert_equal([], user.classes - @user_class.required_classes)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_normalize_attribute
|
33
|
+
assert_equal(["usercertificate", [{"binary" => []}]],
|
34
|
+
ActiveLdap::Base.normalize_attribute("userCertificate", []))
|
35
|
+
assert_equal(["usercertificate", [{"binary" => []}]],
|
36
|
+
ActiveLdap::Base.normalize_attribute("userCertificate", nil))
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_unnormalize_attribute
|
40
|
+
assert_equal({"userCertificate;binary" => []},
|
41
|
+
ActiveLdap::Base.unnormalize_attribute("userCertificate",
|
42
|
+
[{"binary" => []}]))
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_attr_protected
|
46
|
+
user = @user_class.new(:uid => "XXX")
|
47
|
+
assert_equal("XXX", user.uid)
|
48
|
+
user.attributes = {:uid => "ZZZ"}
|
49
|
+
assert_equal("XXX", user.uid)
|
50
|
+
|
51
|
+
user = @user_class.new(:sn => "ZZZ")
|
52
|
+
assert_equal("ZZZ", user.sn)
|
53
|
+
|
54
|
+
user = @user_class.new(:uid => "XXX", :sn => "ZZZ")
|
55
|
+
assert_equal("XXX", user.uid)
|
56
|
+
assert_equal("ZZZ", user.sn)
|
57
|
+
|
58
|
+
@user_class.attr_protected :sn
|
59
|
+
user = @user_class.new(:sn => "ZZZ")
|
60
|
+
assert_nil(user.sn)
|
61
|
+
|
62
|
+
sub_user_class = Class.new(@user_class)
|
63
|
+
sub_user_class.ldap_mapping :dn_attribute => "uid"
|
64
|
+
user = sub_user_class.new(:uid => "XXX", :sn => "ZZZ")
|
65
|
+
assert_equal("XXX", user.uid)
|
66
|
+
assert_nil(user.sn)
|
67
|
+
|
68
|
+
sub_user_class.attr_protected :cn
|
69
|
+
user = sub_user_class.new(:uid => "XXX", :sn => "ZZZ", :cn => "Common Name")
|
70
|
+
assert_equal("XXX", user.uid)
|
71
|
+
assert_nil(user.sn)
|
72
|
+
assert_nil(user.cn)
|
73
|
+
|
74
|
+
user = @user_class.new(:uid => "XXX", :sn => "ZZZ", :cn => "Common Name")
|
75
|
+
assert_equal("XXX", user.uid)
|
76
|
+
assert_nil(user.sn)
|
77
|
+
assert_equal("Common Name", user.cn)
|
78
|
+
end
|
79
|
+
end
|