activeldap3 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/CHANGES +691 -0
- data/COPYING +340 -0
- data/LICENSE +58 -0
- data/README +154 -0
- data/Rakefile +121 -0
- data/TODO +32 -0
- data/activeldap3.gemspec +18 -0
- data/benchmark/bench-al.rb +263 -0
- data/benchmark/config.yaml.sample +5 -0
- data/examples/al-admin/README +182 -0
- data/examples/al-admin/Rakefile +16 -0
- data/examples/al-admin/app/controllers/account_controller.rb +60 -0
- data/examples/al-admin/app/controllers/application_controller.rb +46 -0
- data/examples/al-admin/app/controllers/attributes_controller.rb +17 -0
- data/examples/al-admin/app/controllers/directory_controller.rb +49 -0
- data/examples/al-admin/app/controllers/object_classes_controller.rb +17 -0
- data/examples/al-admin/app/controllers/syntaxes_controller.rb +17 -0
- data/examples/al-admin/app/controllers/users_controller.rb +66 -0
- data/examples/al-admin/app/controllers/welcome_controller.rb +12 -0
- data/examples/al-admin/app/helpers/account_helper.rb +2 -0
- data/examples/al-admin/app/helpers/application_helper.rb +46 -0
- data/examples/al-admin/app/helpers/attributes_helper.rb +15 -0
- data/examples/al-admin/app/helpers/directory_helper.rb +7 -0
- data/examples/al-admin/app/helpers/object_classes_helper.rb +10 -0
- data/examples/al-admin/app/helpers/syntaxes_helper.rb +10 -0
- data/examples/al-admin/app/helpers/url_helper.rb +17 -0
- data/examples/al-admin/app/helpers/users_helper.rb +17 -0
- data/examples/al-admin/app/helpers/welcome_helper.rb +2 -0
- data/examples/al-admin/app/models/entry.rb +23 -0
- data/examples/al-admin/app/models/ldap_user.rb +58 -0
- data/examples/al-admin/app/models/user.rb +91 -0
- data/examples/al-admin/app/views/_entry/_attributes_information.html.erb +29 -0
- data/examples/al-admin/app/views/_entry/_entry.html.erb +15 -0
- data/examples/al-admin/app/views/_schema/_aliases.html.erb +7 -0
- data/examples/al-admin/app/views/_switcher/_after.html.erb +2 -0
- data/examples/al-admin/app/views/_switcher/_before.html.erb +5 -0
- data/examples/al-admin/app/views/account/login.html.erb +26 -0
- data/examples/al-admin/app/views/account/sign_up.html.erb +29 -0
- data/examples/al-admin/app/views/attributes/_attributes.html.erb +19 -0
- data/examples/al-admin/app/views/attributes/_detail.html.erb +29 -0
- data/examples/al-admin/app/views/attributes/index.html.erb +3 -0
- data/examples/al-admin/app/views/attributes/show.html.erb +31 -0
- data/examples/al-admin/app/views/directory/_tree.html.erb +10 -0
- data/examples/al-admin/app/views/directory/_tree_view_js.html.erb +25 -0
- data/examples/al-admin/app/views/directory/index.html.erb +13 -0
- data/examples/al-admin/app/views/directory/populate.html.erb +2 -0
- data/examples/al-admin/app/views/layouts/_footer.html.erb +11 -0
- data/examples/al-admin/app/views/layouts/_header_menu.html.erb +10 -0
- data/examples/al-admin/app/views/layouts/_main_menu.html.erb +18 -0
- data/examples/al-admin/app/views/layouts/application.html.erb +57 -0
- data/examples/al-admin/app/views/object_classes/_attributes.html.erb +28 -0
- data/examples/al-admin/app/views/object_classes/_object_classes.html.erb +19 -0
- data/examples/al-admin/app/views/object_classes/index.html.erb +3 -0
- data/examples/al-admin/app/views/object_classes/show.html.erb +39 -0
- data/examples/al-admin/app/views/syntaxes/_detail.html.erb +14 -0
- data/examples/al-admin/app/views/syntaxes/_syntaxes.html.erb +19 -0
- data/examples/al-admin/app/views/syntaxes/index.html.erb +3 -0
- data/examples/al-admin/app/views/syntaxes/show.html.erb +22 -0
- data/examples/al-admin/app/views/users/_attributes_update_form.html.erb +42 -0
- data/examples/al-admin/app/views/users/_form.html.erb +13 -0
- data/examples/al-admin/app/views/users/_object_classes_update_form.html.erb +46 -0
- data/examples/al-admin/app/views/users/_password_change_form.html.erb +20 -0
- data/examples/al-admin/app/views/users/edit.html.erb +15 -0
- data/examples/al-admin/app/views/users/index.html.erb +10 -0
- data/examples/al-admin/app/views/users/show.html.erb +11 -0
- data/examples/al-admin/app/views/welcome/index.html.erb +13 -0
- data/examples/al-admin/config.ru +7 -0
- data/examples/al-admin/config/boot.rb +110 -0
- data/examples/al-admin/config/database.yml.example +19 -0
- data/examples/al-admin/config/environment.rb +73 -0
- data/examples/al-admin/config/environments/development.rb +17 -0
- data/examples/al-admin/config/environments/production.rb +24 -0
- data/examples/al-admin/config/environments/test.rb +22 -0
- data/examples/al-admin/config/initializers/exception_notifier.rb +2 -0
- data/examples/al-admin/config/initializers/fast_gettext.rb +3 -0
- data/examples/al-admin/config/initializers/inflections.rb +10 -0
- data/examples/al-admin/config/initializers/mime_types.rb +5 -0
- data/examples/al-admin/config/initializers/session_store.rb +23 -0
- data/examples/al-admin/config/ldap.yml.example +21 -0
- data/examples/al-admin/config/routes.rb +58 -0
- data/examples/al-admin/db/migrate/001_create_users.rb +16 -0
- data/examples/al-admin/doc/README_FOR_APP +2 -0
- data/examples/al-admin/lib/authenticated_system.rb +124 -0
- data/examples/al-admin/lib/authenticated_test_helper.rb +113 -0
- data/examples/al-admin/lib/ldap_test_helper.rb +38 -0
- data/examples/al-admin/lib/tasks/testing.rake +10 -0
- data/examples/al-admin/po/en/al-admin.po +343 -0
- data/examples/al-admin/po/ja/al-admin.po +343 -0
- data/examples/al-admin/po/nl/al-admin.po +380 -0
- data/examples/al-admin/public/.htaccess +40 -0
- data/examples/al-admin/public/404.html +30 -0
- data/examples/al-admin/public/500.html +30 -0
- data/examples/al-admin/public/dispatch.cgi +10 -0
- data/examples/al-admin/public/dispatch.fcgi +24 -0
- data/examples/al-admin/public/dispatch.rb +10 -0
- data/examples/al-admin/public/favicon.ico +0 -0
- data/examples/al-admin/public/images/active-ldap.svg +6351 -0
- data/examples/al-admin/public/images/al-admin.png +0 -0
- data/examples/al-admin/public/images/al-admin.svg +6371 -0
- data/examples/al-admin/public/images/header-background.png +0 -0
- data/examples/al-admin/public/images/header-background.svg +99 -0
- data/examples/al-admin/public/images/rails.png +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_left_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_left_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_middle_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_middle_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_right_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/accordion_tab_right_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_bottom_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_bottom_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_bottom_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_left_down_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_left_up_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_middle_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_middle_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_right_down_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_right_up_arrow.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_top_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_top_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/balloon_top_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/barchart_h.gif +0 -0
- data/examples/al-admin/public/images/spinelz/barchart_v.gif +0 -0
- data/examples/al-admin/public/images/spinelz/button.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_default_handler.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_delete.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_next_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_pre.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_pre_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_private_icon.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calendar_schedule.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calender_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/calender_back_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_back_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_next_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_pre.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker2_pre_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_back_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_next_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_pre.gif +0 -0
- data/examples/al-admin/public/images/spinelz/datepicker_pre_second.gif +0 -0
- data/examples/al-admin/public/images/spinelz/grid_down.gif +0 -0
- data/examples/al-admin/public/images/spinelz/grid_state.gif +0 -0
- data/examples/al-admin/public/images/spinelz/grid_up.gif +0 -0
- data/examples/al-admin/public/images/spinelz/icon_day.gif +0 -0
- data/examples/al-admin/public/images/spinelz/icon_month.gif +0 -0
- data/examples/al-admin/public/images/spinelz/icon_week.gif +0 -0
- data/examples/al-admin/public/images/spinelz/menubar_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/menubar_subcontents_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_left_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_left_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_middle_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_middle_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_right_active.gif +0 -0
- data/examples/al-admin/public/images/spinelz/navPanel_tab_right_inactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/select_date.gif +0 -0
- data/examples/al-admin/public/images/spinelz/selectabletable_selected.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_about.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_menu.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_sample.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabBottomActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabBottomInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleActive2.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabMiddleInactive2.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabTopActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabTopInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sideBarBox_tabbar.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sortableTable_down.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sortableTable_normal.gif +0 -0
- data/examples/al-admin/public/images/spinelz/sortableTable_up.gif +0 -0
- data/examples/al-admin/public/images/spinelz/switcher_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/switcher_open.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabLeftActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabLeftInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabMiddleActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabMiddleInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabRightActive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tabBox_tabRightInactive.gif +0 -0
- data/examples/al-admin/public/images/spinelz/tab_bar.gif +0 -0
- data/examples/al-admin/public/images/spinelz/table_back.gif +0 -0
- data/examples/al-admin/public/images/spinelz/timepicker_clock.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_max.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_min.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_next.gif +0 -0
- data/examples/al-admin/public/images/spinelz/toolbar_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_dir.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_file.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_group.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_group_special.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_state.gif +0 -0
- data/examples/al-admin/public/images/spinelz/treeview_user.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_bottom_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_bottom_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_bottom_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_close.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_max.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_middle_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_middle_right.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_min.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_top_left.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_top_middle.gif +0 -0
- data/examples/al-admin/public/images/spinelz/window_top_right.gif +0 -0
- data/examples/al-admin/public/javascripts/application.js +2 -0
- data/examples/al-admin/public/javascripts/controls.js +963 -0
- data/examples/al-admin/public/javascripts/dragdrop.js +973 -0
- data/examples/al-admin/public/javascripts/effects.js +1128 -0
- data/examples/al-admin/public/javascripts/prototype.js +4320 -0
- data/examples/al-admin/public/javascripts/spinelz/accordion.js +185 -0
- data/examples/al-admin/public/javascripts/spinelz/ajaxHistory.js +157 -0
- data/examples/al-admin/public/javascripts/spinelz/balloon.js +287 -0
- data/examples/al-admin/public/javascripts/spinelz/barchart.js +524 -0
- data/examples/al-admin/public/javascripts/spinelz/calendar.js +3012 -0
- data/examples/al-admin/public/javascripts/spinelz/colorpicker.js +128 -0
- data/examples/al-admin/public/javascripts/spinelz/datepicker.js +438 -0
- data/examples/al-admin/public/javascripts/spinelz/grid.js +1391 -0
- data/examples/al-admin/public/javascripts/spinelz/grid_resizeEx.js +100 -0
- data/examples/al-admin/public/javascripts/spinelz/grid_sortabletableEx.js +129 -0
- data/examples/al-admin/public/javascripts/spinelz/inplaceEditorEx.js +148 -0
- data/examples/al-admin/public/javascripts/spinelz/menubar.js +232 -0
- data/examples/al-admin/public/javascripts/spinelz/navPanel.js +170 -0
- data/examples/al-admin/public/javascripts/spinelz/selectableTable.js +433 -0
- data/examples/al-admin/public/javascripts/spinelz/sideBarBox.js +282 -0
- data/examples/al-admin/public/javascripts/spinelz/sideBarBox_effects.js +83 -0
- data/examples/al-admin/public/javascripts/spinelz/sortableTable.js +270 -0
- data/examples/al-admin/public/javascripts/spinelz/switcher.js +78 -0
- data/examples/al-admin/public/javascripts/spinelz/tabBox.js +469 -0
- data/examples/al-admin/public/javascripts/spinelz/timepicker.js +384 -0
- data/examples/al-admin/public/javascripts/spinelz/toolbar.js +152 -0
- data/examples/al-admin/public/javascripts/spinelz/treeview.js +703 -0
- data/examples/al-admin/public/javascripts/spinelz/window.js +641 -0
- data/examples/al-admin/public/javascripts/spinelz/window_resizeEx.js +130 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/builder.js +131 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/controls.js +835 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/dragdrop.js +944 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/effects.js +1090 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/json.js +139 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/prototype.js +2515 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/resize.js +215 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/scriptaculous.js +51 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/slider.js +278 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/spinelz_util.js +1266 -0
- data/examples/al-admin/public/javascripts/spinelz_lib/unittest.js +564 -0
- data/examples/al-admin/public/robots.txt +1 -0
- data/examples/al-admin/public/stylesheets/account.css +41 -0
- data/examples/al-admin/public/stylesheets/attributes.css +1 -0
- data/examples/al-admin/public/stylesheets/base.css +104 -0
- data/examples/al-admin/public/stylesheets/detail.css +36 -0
- data/examples/al-admin/public/stylesheets/directory.css +22 -0
- data/examples/al-admin/public/stylesheets/object-classes.css +6 -0
- data/examples/al-admin/public/stylesheets/rails.css +35 -0
- data/examples/al-admin/public/stylesheets/spinelz/accordion.css +59 -0
- data/examples/al-admin/public/stylesheets/spinelz/balloon.css +151 -0
- data/examples/al-admin/public/stylesheets/spinelz/calendar.css +564 -0
- data/examples/al-admin/public/stylesheets/spinelz/datepicker.css +175 -0
- data/examples/al-admin/public/stylesheets/spinelz/grid.css +137 -0
- data/examples/al-admin/public/stylesheets/spinelz/menubar.css +78 -0
- data/examples/al-admin/public/stylesheets/spinelz/modal.css +22 -0
- data/examples/al-admin/public/stylesheets/spinelz/navPanel.css +58 -0
- data/examples/al-admin/public/stylesheets/spinelz/selectableTable.css +28 -0
- data/examples/al-admin/public/stylesheets/spinelz/sideBarBox.css +82 -0
- data/examples/al-admin/public/stylesheets/spinelz/sortableTable.css +51 -0
- data/examples/al-admin/public/stylesheets/spinelz/switcher.css +23 -0
- data/examples/al-admin/public/stylesheets/spinelz/tabBox.css +94 -0
- data/examples/al-admin/public/stylesheets/spinelz/timepicker.css +508 -0
- data/examples/al-admin/public/stylesheets/spinelz/toolbar.css +82 -0
- data/examples/al-admin/public/stylesheets/spinelz/treeview.css +121 -0
- data/examples/al-admin/public/stylesheets/spinelz/window.css +140 -0
- data/examples/al-admin/public/stylesheets/structure.css +81 -0
- data/examples/al-admin/public/stylesheets/syntaxes.css +1 -0
- data/examples/al-admin/public/stylesheets/users.css +13 -0
- data/examples/al-admin/public/stylesheets/welcome.css +0 -0
- data/examples/al-admin/script/about +3 -0
- data/examples/al-admin/script/console +3 -0
- data/examples/al-admin/script/dbconsole +3 -0
- data/examples/al-admin/script/destroy +3 -0
- data/examples/al-admin/script/generate +3 -0
- data/examples/al-admin/script/performance/benchmarker +3 -0
- data/examples/al-admin/script/performance/profiler +3 -0
- data/examples/al-admin/script/performance/request +3 -0
- data/examples/al-admin/script/plugin +3 -0
- data/examples/al-admin/script/process/inspector +3 -0
- data/examples/al-admin/script/process/reaper +3 -0
- data/examples/al-admin/script/process/spawner +3 -0
- data/examples/al-admin/script/runner +3 -0
- data/examples/al-admin/script/server +3 -0
- data/examples/al-admin/test/fixtures/users.yml +9 -0
- data/examples/al-admin/test/functional/account_controller_test.rb +12 -0
- data/examples/al-admin/test/functional/attributes_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/directory_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/object_classes_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/syntaxes_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/users_controller_test.rb +8 -0
- data/examples/al-admin/test/functional/welcome_controller_test.rb +8 -0
- data/examples/al-admin/test/integration/sign_up_test.rb +44 -0
- data/examples/al-admin/test/run-test.sh +3 -0
- data/examples/al-admin/test/test_helper.rb +52 -0
- data/examples/al-admin/test/unit/user_test.rb +12 -0
- data/examples/al-admin/vendor/plugins/exception_notification/README +111 -0
- data/examples/al-admin/vendor/plugins/exception_notification/init.rb +1 -0
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifiable.rb +99 -0
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier.rb +66 -0
- data/examples/al-admin/vendor/plugins/exception_notification/lib/exception_notifier_helper.rb +78 -0
- data/examples/al-admin/vendor/plugins/exception_notification/test/exception_notifier_helper_test.rb +61 -0
- data/examples/al-admin/vendor/plugins/exception_notification/test/test_helper.rb +7 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_backtrace.rhtml +1 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_environment.rhtml +7 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_inspect_model.rhtml +16 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_request.rhtml +4 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_session.rhtml +2 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/_title.rhtml +3 -0
- data/examples/al-admin/vendor/plugins/exception_notification/views/exception_notifier/exception_notification.rhtml +6 -0
- data/examples/config.yaml.example +5 -0
- data/examples/example.der +0 -0
- data/examples/example.jpg +0 -0
- data/examples/groupadd +41 -0
- data/examples/groupdel +35 -0
- data/examples/groupls +49 -0
- data/examples/groupmod +42 -0
- data/examples/lpasswd +55 -0
- data/examples/objects/group.rb +13 -0
- data/examples/objects/ou.rb +4 -0
- data/examples/objects/user.rb +20 -0
- data/examples/ouadd +38 -0
- data/examples/useradd +45 -0
- data/examples/useradd-binary +53 -0
- data/examples/userdel +34 -0
- data/examples/userls +50 -0
- data/examples/usermod +42 -0
- data/examples/usermod-binary-add +50 -0
- data/examples/usermod-binary-add-time +54 -0
- data/examples/usermod-binary-del +48 -0
- data/examples/usermod-lang-add +43 -0
- data/lib/active_ldap.rb +105 -0
- data/lib/active_ldap/action_controller/ldap_benchmarking.rb +55 -0
- data/lib/active_ldap/acts/tree.rb +75 -0
- data/lib/active_ldap/adapter/base.rb +705 -0
- data/lib/active_ldap/adapter/jndi.rb +184 -0
- data/lib/active_ldap/adapter/jndi_connection.rb +185 -0
- data/lib/active_ldap/adapter/ldap.rb +290 -0
- data/lib/active_ldap/adapter/ldap_ext.rb +105 -0
- data/lib/active_ldap/adapter/net_ldap.rb +309 -0
- data/lib/active_ldap/adapter/net_ldap_ext.rb +23 -0
- data/lib/active_ldap/association/belongs_to.rb +47 -0
- data/lib/active_ldap/association/belongs_to_many.rb +58 -0
- data/lib/active_ldap/association/children.rb +21 -0
- data/lib/active_ldap/association/collection.rb +105 -0
- data/lib/active_ldap/association/has_many.rb +31 -0
- data/lib/active_ldap/association/has_many_utils.rb +44 -0
- data/lib/active_ldap/association/has_many_wrap.rb +62 -0
- data/lib/active_ldap/association/proxy.rb +107 -0
- data/lib/active_ldap/associations.rb +202 -0
- data/lib/active_ldap/attributes.rb +184 -0
- data/lib/active_ldap/base.rb +1594 -0
- data/lib/active_ldap/callbacks.rb +52 -0
- data/lib/active_ldap/command.rb +49 -0
- data/lib/active_ldap/compatible.rb +44 -0
- data/lib/active_ldap/configuration.rb +147 -0
- data/lib/active_ldap/connection.rb +294 -0
- data/lib/active_ldap/distinguished_name.rb +291 -0
- data/lib/active_ldap/entry_attribute.rb +78 -0
- data/lib/active_ldap/escape.rb +12 -0
- data/lib/active_ldap/get_text.rb +9 -0
- data/lib/active_ldap/get_text/parser.rb +161 -0
- data/lib/active_ldap/get_text_fallback.rb +60 -0
- data/lib/active_ldap/get_text_support.rb +20 -0
- data/lib/active_ldap/helper.rb +92 -0
- data/lib/active_ldap/human_readable.rb +132 -0
- data/lib/active_ldap/ldap_error.rb +74 -0
- data/lib/active_ldap/ldif.rb +930 -0
- data/lib/active_ldap/object_class.rb +95 -0
- data/lib/active_ldap/operations.rb +610 -0
- data/lib/active_ldap/populate.rb +53 -0
- data/lib/active_ldap/railtie.rb +31 -0
- data/lib/active_ldap/schema.rb +699 -0
- data/lib/active_ldap/schema/syntaxes.rb +417 -0
- data/lib/active_ldap/timeout.rb +75 -0
- data/lib/active_ldap/timeout_stub.rb +17 -0
- data/lib/active_ldap/user_password.rb +92 -0
- data/lib/active_ldap/validations.rb +229 -0
- data/lib/active_ldap/xml.rb +122 -0
- data/po/en/active-ldap.po +4029 -0
- data/po/ja/active-ldap.po +4060 -0
- data/rails_generators/model_active_ldap/USAGE +17 -0
- data/rails_generators/model_active_ldap/model_active_ldap_generator.rb +69 -0
- data/rails_generators/model_active_ldap/templates/model_active_ldap.rb +3 -0
- data/rails_generators/model_active_ldap/templates/unit_test.rb +8 -0
- data/rails_generators/scaffold_active_ldap/scaffold_active_ldap_generator.rb +7 -0
- data/rails_generators/scaffold_active_ldap/templates/ldap.yml +18 -0
- data/test/al-test-utils.rb +439 -0
- data/test/command.rb +112 -0
- data/test/config.yaml.sample +6 -0
- data/test/fixtures/lower_case_object_class_schema.rb +802 -0
- data/test/run-test.rb +44 -0
- data/test/test_acts_as_tree.rb +60 -0
- data/test/test_adapter.rb +121 -0
- data/test/test_associations.rb +664 -0
- data/test/test_attributes.rb +117 -0
- data/test/test_base.rb +1177 -0
- data/test/test_base_per_instance.rb +61 -0
- data/test/test_bind.rb +62 -0
- data/test/test_callback.rb +37 -0
- data/test/test_configuration.rb +40 -0
- data/test/test_connection.rb +82 -0
- data/test/test_connection_per_class.rb +112 -0
- data/test/test_connection_per_dn.rb +112 -0
- data/test/test_dn.rb +172 -0
- data/test/test_find.rb +176 -0
- data/test/test_groupadd.rb +50 -0
- data/test/test_groupdel.rb +46 -0
- data/test/test_groupls.rb +107 -0
- data/test/test_groupmod.rb +51 -0
- data/test/test_ldif.rb +1891 -0
- data/test/test_load.rb +133 -0
- data/test/test_lpasswd.rb +75 -0
- data/test/test_object_class.rb +74 -0
- data/test/test_reflection.rb +182 -0
- data/test/test_schema.rb +559 -0
- data/test/test_syntax.rb +383 -0
- data/test/test_user.rb +217 -0
- data/test/test_user_password.rb +101 -0
- data/test/test_useradd-binary.rb +62 -0
- data/test/test_useradd.rb +57 -0
- data/test/test_userdel.rb +48 -0
- data/test/test_userls.rb +91 -0
- data/test/test_usermod-binary-add-time.rb +65 -0
- data/test/test_usermod-binary-add.rb +64 -0
- data/test/test_usermod-binary-del.rb +66 -0
- data/test/test_usermod-lang-add.rb +60 -0
- data/test/test_usermod.rb +58 -0
- data/test/test_validation.rb +274 -0
- metadata +502 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
# Don't change this file!
|
2
|
+
# Configure your app in config/environment.rb and config/environments/*.rb
|
3
|
+
|
4
|
+
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
|
5
|
+
|
6
|
+
module Rails
|
7
|
+
class << self
|
8
|
+
def boot!
|
9
|
+
unless booted?
|
10
|
+
preinitialize
|
11
|
+
pick_boot.run
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def booted?
|
16
|
+
defined? Rails::Initializer
|
17
|
+
end
|
18
|
+
|
19
|
+
def pick_boot
|
20
|
+
(vendor_rails? ? VendorBoot : GemBoot).new
|
21
|
+
end
|
22
|
+
|
23
|
+
def vendor_rails?
|
24
|
+
File.exist?("#{RAILS_ROOT}/vendor/rails")
|
25
|
+
end
|
26
|
+
|
27
|
+
def preinitialize
|
28
|
+
load(preinitializer_path) if File.exist?(preinitializer_path)
|
29
|
+
end
|
30
|
+
|
31
|
+
def preinitializer_path
|
32
|
+
"#{RAILS_ROOT}/config/preinitializer.rb"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class Boot
|
37
|
+
def run
|
38
|
+
load_initializer
|
39
|
+
Rails::Initializer.run(:set_load_path)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class VendorBoot < Boot
|
44
|
+
def load_initializer
|
45
|
+
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
|
46
|
+
Rails::Initializer.run(:install_gem_spec_stubs)
|
47
|
+
Rails::GemDependency.add_frozen_gem_path
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class GemBoot < Boot
|
52
|
+
def load_initializer
|
53
|
+
self.class.load_rubygems
|
54
|
+
load_rails_gem
|
55
|
+
require 'initializer'
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_rails_gem
|
59
|
+
if version = self.class.gem_version
|
60
|
+
gem 'rails', version
|
61
|
+
else
|
62
|
+
gem 'rails'
|
63
|
+
end
|
64
|
+
rescue Gem::LoadError => load_error
|
65
|
+
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
|
66
|
+
exit 1
|
67
|
+
end
|
68
|
+
|
69
|
+
class << self
|
70
|
+
def rubygems_version
|
71
|
+
Gem::RubyGemsVersion rescue nil
|
72
|
+
end
|
73
|
+
|
74
|
+
def gem_version
|
75
|
+
if defined? RAILS_GEM_VERSION
|
76
|
+
RAILS_GEM_VERSION
|
77
|
+
elsif ENV.include?('RAILS_GEM_VERSION')
|
78
|
+
ENV['RAILS_GEM_VERSION']
|
79
|
+
else
|
80
|
+
parse_gem_version(read_environment_rb)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def load_rubygems
|
85
|
+
min_version = '1.3.2'
|
86
|
+
require 'rubygems'
|
87
|
+
unless rubygems_version >= min_version
|
88
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
rescue LoadError
|
93
|
+
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
|
94
|
+
exit 1
|
95
|
+
end
|
96
|
+
|
97
|
+
def parse_gem_version(text)
|
98
|
+
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def read_environment_rb
|
103
|
+
File.read("#{RAILS_ROOT}/config/environment.rb")
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# All that for this:
|
110
|
+
Rails.boot!
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
timeout: 5000
|
7
|
+
|
8
|
+
# Warning: The database defined as 'test' will be erased and
|
9
|
+
# re-generated from your development database when you run 'rake'.
|
10
|
+
# Do not set this db to the same as development or production.
|
11
|
+
test:
|
12
|
+
adapter: sqlite3
|
13
|
+
database: db/test.sqlite3
|
14
|
+
timeout: 5000
|
15
|
+
|
16
|
+
production:
|
17
|
+
adapter: sqlite3
|
18
|
+
database: db/production.sqlite3
|
19
|
+
timeout: 5000
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file
|
2
|
+
|
3
|
+
# Uncomment below to force Rails into production mode when
|
4
|
+
# you don't control web/app server and can't set it the proper way
|
5
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
6
|
+
|
7
|
+
# Specifies gem version of Rails to use when vendor/rails is not present
|
8
|
+
RAILS_GEM_VERSION = '2.3.8' unless defined? RAILS_GEM_VERSION
|
9
|
+
|
10
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
11
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
12
|
+
|
13
|
+
Rails::Initializer.run do |config|
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration should go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
17
|
+
# See Rails::Configuration for more options.
|
18
|
+
|
19
|
+
# Skip frameworks you're not going to use. To use Rails without a database
|
20
|
+
# you must remove the Active Record framework.
|
21
|
+
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
|
22
|
+
|
23
|
+
# Specify gems that this application depends on.
|
24
|
+
# They can then be installed with "rake gems:install" on new installations.
|
25
|
+
# You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3)
|
26
|
+
# config.gem "bj"
|
27
|
+
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
|
28
|
+
# config.gem "sqlite3-ruby", :lib => "sqlite3"
|
29
|
+
# config.gem "aws-s3", :lib => "aws/s3"
|
30
|
+
# config.gem "locale_rails", :version => "2.0.5"
|
31
|
+
# config.gem "gettext_rails", :version => "2.1.0"
|
32
|
+
config.gem "fast_gettext", :version => '>=0.5.8'
|
33
|
+
#only used for mo/po file generation in development, !do not load(:lib=>false), will needlessly eat ram!
|
34
|
+
config.gem "gettext", :lib => false, :version => '>=2.1.0'
|
35
|
+
#this is needed for language/country translations
|
36
|
+
config.gem "gettext_i18n_rails", :version => '>=0.2.2'
|
37
|
+
#this is needed for language/country translations
|
38
|
+
config.gem "i18n_data", :version => '>=0.2.3'
|
39
|
+
|
40
|
+
# Only load the plugins named here, in the order given. By default, all plugins
|
41
|
+
# in vendor/plugins are loaded in alphabetical order.
|
42
|
+
# :all can be used as a placeholder for all plugins not explicitly named
|
43
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
44
|
+
|
45
|
+
# Add additional load paths for your own custom dirs
|
46
|
+
# config.load_paths += %W( #{RAILS_ROOT}/extras )
|
47
|
+
config.load_paths += ["#{RAILS_ROOT}/../../lib"]
|
48
|
+
config.plugin_paths += %W(#{RAILS_ROOT}/../..)
|
49
|
+
|
50
|
+
# Force all environments to use the same logger level
|
51
|
+
# (by default production uses :info, the others :debug)
|
52
|
+
# config.log_level = :debug
|
53
|
+
config.log_path = Logger::LogDevice.new(config.log_path)
|
54
|
+
|
55
|
+
# Make Time.zone default to the specified zone, and make Active Record store time values
|
56
|
+
# in the database in UTC, and return them converted to the specified local zone.
|
57
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Comment line to use default local time.
|
58
|
+
config.time_zone = 'UTC'
|
59
|
+
|
60
|
+
# The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
|
61
|
+
# All files from config/locales/*.rb,yml are added automatically.
|
62
|
+
# config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
|
63
|
+
# config.i18n.default_locale = :de
|
64
|
+
|
65
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
66
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
67
|
+
# like if you have constraints or database-specific column types
|
68
|
+
# config.active_record.schema_format = :sql
|
69
|
+
|
70
|
+
# Activate observers that should always be running
|
71
|
+
# Please note that observers generated using script/generate observer need to have an _observer suffix
|
72
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
73
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# In the development environment your application's code is reloaded on
|
4
|
+
# every request. This slows down response time but is perfect for development
|
5
|
+
# since you don't have to restart the webserver when you make code changes.
|
6
|
+
config.cache_classes = false
|
7
|
+
|
8
|
+
# Log error messages when you accidentally call methods on nil.
|
9
|
+
config.whiny_nils = true
|
10
|
+
|
11
|
+
# Show full error reports and disable caching
|
12
|
+
config.action_controller.consider_all_requests_local = true
|
13
|
+
config.action_view.debug_rjs = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The production environment is meant for finished, "live" apps.
|
4
|
+
# Code is not reloaded between requests
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Enable threaded mode
|
8
|
+
# config.threadsafe!
|
9
|
+
|
10
|
+
# Use a different logger for distributed setups
|
11
|
+
# config.logger = SyslogLogger.new
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on
|
14
|
+
config.action_controller.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Use a different cache store in production
|
18
|
+
# config.cache_store = :mem_cache_store
|
19
|
+
|
20
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
21
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
22
|
+
|
23
|
+
# Disable delivery errors, bad email addresses will be ignored
|
24
|
+
# config.action_mailer.raise_delivery_errors = false
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
2
|
+
|
3
|
+
# The test environment is used exclusively to run your application's
|
4
|
+
# test suite. You never need to work with it otherwise. Remember that
|
5
|
+
# your test database is "scratch space" for the test suite and is wiped
|
6
|
+
# and recreated between test runs. Don't rely on the data there!
|
7
|
+
config.cache_classes = true
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.action_controller.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Disable request forgery protection in test environment
|
17
|
+
config.action_controller.allow_forgery_protection = false
|
18
|
+
|
19
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
20
|
+
# The :test delivery method accumulates sent emails in the
|
21
|
+
# ActionMailer::Base.deliveries array.
|
22
|
+
config.action_mailer.delivery_method = :test
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key for verifying cookie session data integrity.
|
4
|
+
# If you change this key, all old sessions will become invalid!
|
5
|
+
# Make sure the secret is at least 30 characters and all random,
|
6
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
7
|
+
session_secret_file = File.join(RAILS_ROOT, "config", "session_secret.txt")
|
8
|
+
unless File.exist?(session_secret_file)
|
9
|
+
File.open(session_secret_file, "w") do |file|
|
10
|
+
file.puts(ActiveSupport::SecureRandom.hex(64))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
session_secret = File.read(session_secret_file).strip
|
14
|
+
|
15
|
+
ActionController::Base.session = {
|
16
|
+
:key => '_al_admin_session',
|
17
|
+
:secret => session_secret,
|
18
|
+
}
|
19
|
+
|
20
|
+
# Use the database for sessions instead of the cookie-based default,
|
21
|
+
# which shouldn't be used to store highly confidential information
|
22
|
+
# (create the session table with "rake db:sessions:create")
|
23
|
+
# ActionController::Base.session_store = :active_record_store
|
@@ -0,0 +1,21 @@
|
|
1
|
+
development:
|
2
|
+
host: 127.0.0.1
|
3
|
+
port: 389
|
4
|
+
base: dc=devel,dc=local,dc=net
|
5
|
+
bind_dn: cn=admin,dc=local,dc=net
|
6
|
+
password: secret
|
7
|
+
|
8
|
+
test:
|
9
|
+
host: 127.0.0.1
|
10
|
+
port: 389
|
11
|
+
base: dc=test,dc=local,dc=net
|
12
|
+
bind_dn: cn=admin,dc=local,dc=net
|
13
|
+
password: secret
|
14
|
+
|
15
|
+
production:
|
16
|
+
host: 127.0.0.1
|
17
|
+
port: 389
|
18
|
+
method: :tls
|
19
|
+
base: dc=production,dc=local,dc=net
|
20
|
+
bind_dn: cn=admin,dc=local,dc=net
|
21
|
+
password: secret
|
@@ -0,0 +1,58 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
lang_map = Proc.new do |*args|
|
3
|
+
method, path, options = args
|
4
|
+
duped_options = (options || {}).dup
|
5
|
+
requirements = duped_options.delete(:requirements) || {}
|
6
|
+
defaults = duped_options.delete(:defaults) || {}
|
7
|
+
lang_options = {
|
8
|
+
:requirements => {:lang => /(?:[a-z]{2,2})?/}.merge(requirements),
|
9
|
+
:defaults => {},
|
10
|
+
}
|
11
|
+
lang_options[:defaults] = {:lang => nil} if method != :connect
|
12
|
+
lang_options[:defaults].merge!(defaults)
|
13
|
+
map.send(method, ":lang/#{path}", lang_options.merge(duped_options))
|
14
|
+
map.send(:connect, *args[1..-1])
|
15
|
+
end
|
16
|
+
|
17
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
18
|
+
|
19
|
+
# Sample of regular route:
|
20
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
21
|
+
# Keep in mind you can assign values other than :controller and :action
|
22
|
+
|
23
|
+
# Sample of named route:
|
24
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
25
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
26
|
+
|
27
|
+
# Sample resource route (maps HTTP verbs to controller actions automatically):
|
28
|
+
# map.resources :products
|
29
|
+
|
30
|
+
# Sample resource route with options:
|
31
|
+
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
|
32
|
+
|
33
|
+
# Sample resource route with sub-resources:
|
34
|
+
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
|
35
|
+
|
36
|
+
# Sample resource route within a namespace:
|
37
|
+
# map.namespace :admin do |admin|
|
38
|
+
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
|
39
|
+
# admin.resources :products
|
40
|
+
# end
|
41
|
+
|
42
|
+
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
|
43
|
+
# map.root :controller => "welcome"
|
44
|
+
lang_map.call(:top, '', :controller => "welcome")
|
45
|
+
|
46
|
+
# See how all your routes lay out with "rake routes"
|
47
|
+
|
48
|
+
lang_map.call(:connect, 'object_class/*id',
|
49
|
+
:controller => "object_classes", :action => "show")
|
50
|
+
lang_map.call(:connect, 'attribute/*id',
|
51
|
+
:controller => "attributes", :action => "show")
|
52
|
+
lang_map.call(:connect, 'syntax/*id',
|
53
|
+
:controller => "syntaxes", :action => "show")
|
54
|
+
|
55
|
+
# Install the default routes as the lowest priority.
|
56
|
+
lang_map.call(:connect, ':controller/:action/:id')
|
57
|
+
lang_map.call(:connect, ':controller/:action/:id.:format')
|
58
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table "users", :force => true do |t|
|
4
|
+
t.column :login, :string
|
5
|
+
t.column :dn, :string
|
6
|
+
t.column :updated_at, :datetime
|
7
|
+
t.column :salt, :string
|
8
|
+
t.column :remember_token, :string
|
9
|
+
t.column :remember_token_expires_at, :datetime
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.down
|
14
|
+
drop_table "users"
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
module AuthenticatedSystem
|
2
|
+
protected
|
3
|
+
# Returns true or false if the user is logged in.
|
4
|
+
# Preloads @current_user with the user model if they're logged in.
|
5
|
+
def logged_in?
|
6
|
+
current_user != :false
|
7
|
+
end
|
8
|
+
|
9
|
+
# Accesses the current user from the session.
|
10
|
+
def current_user
|
11
|
+
@current_user ||= (session[:user] && User.find_by_id(session[:user])) || :false
|
12
|
+
end
|
13
|
+
|
14
|
+
# Store the given user in the session.
|
15
|
+
def current_user=(new_user)
|
16
|
+
session[:user] = (new_user.nil? || new_user.is_a?(Symbol)) ? nil : new_user.id
|
17
|
+
@current_user = new_user
|
18
|
+
end
|
19
|
+
|
20
|
+
# Check if the user is authorized.
|
21
|
+
#
|
22
|
+
# Override this method in your controllers if you want to restrict access
|
23
|
+
# to only a few actions or if you want to check if the user
|
24
|
+
# has the correct rights.
|
25
|
+
#
|
26
|
+
# Example:
|
27
|
+
#
|
28
|
+
# # only allow nonbobs
|
29
|
+
# def authorize?
|
30
|
+
# current_user.login != "bob"
|
31
|
+
# end
|
32
|
+
def authorized?
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
# Filter method to enforce a login requirement.
|
37
|
+
#
|
38
|
+
# To require logins for all actions, use this in your controllers:
|
39
|
+
#
|
40
|
+
# before_filter :login_required
|
41
|
+
#
|
42
|
+
# To require logins for specific actions, use this in your controllers:
|
43
|
+
#
|
44
|
+
# before_filter :login_required, :only => [ :edit, :update ]
|
45
|
+
#
|
46
|
+
# To skip this in a subclassed controller:
|
47
|
+
#
|
48
|
+
# skip_before_filter :login_required
|
49
|
+
#
|
50
|
+
def login_required
|
51
|
+
username, passwd = get_auth_data
|
52
|
+
self.current_user ||= User.authenticate(username, passwd) || :false if username && passwd
|
53
|
+
logged_in? && authorized? ? true : access_denied
|
54
|
+
end
|
55
|
+
|
56
|
+
# Redirect as appropriate when an access request fails.
|
57
|
+
#
|
58
|
+
# The default action is to redirect to the login screen.
|
59
|
+
#
|
60
|
+
# Override this method in your controllers if you want to have special
|
61
|
+
# behavior in case the user is not authorized
|
62
|
+
# to access the requested action. For example, a popup window might
|
63
|
+
# simply close itself.
|
64
|
+
def access_denied
|
65
|
+
respond_to do |accepts|
|
66
|
+
accepts.html do
|
67
|
+
store_location
|
68
|
+
flash.now[:notice] = _("Please login.")
|
69
|
+
redirect_to :controller => '/account', :action => 'login'
|
70
|
+
end
|
71
|
+
accepts.xml do
|
72
|
+
headers["Status"] = "Unauthorized"
|
73
|
+
headers["WWW-Authenticate"] = %(Basic realm="Web Password")
|
74
|
+
render :text => "Could't authenticate you", :status => '401 Unauthorized'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
false
|
78
|
+
end
|
79
|
+
|
80
|
+
# Store the URI of the current request in the session.
|
81
|
+
#
|
82
|
+
# We can return to this location by calling #redirect_back_or_default.
|
83
|
+
def store_location
|
84
|
+
session[:return_to] = url_for(params.merge(:only_path => false))
|
85
|
+
end
|
86
|
+
|
87
|
+
# Redirect to the URI stored by the most recent store_location call or
|
88
|
+
# to the passed default.
|
89
|
+
def redirect_back_or_default(default)
|
90
|
+
redirect_to(session[:return_to] || default)
|
91
|
+
session[:return_to] = nil
|
92
|
+
end
|
93
|
+
|
94
|
+
# Inclusion hook to make #current_user and #logged_in?
|
95
|
+
# available as ActionView helper methods.
|
96
|
+
def self.included(base)
|
97
|
+
base.send :helper_method, :current_user, :logged_in?
|
98
|
+
end
|
99
|
+
|
100
|
+
# When called with before_filter :login_from_cookie will check for an :auth_token
|
101
|
+
# cookie and log the user back in if apropriate
|
102
|
+
def login_from_cookie
|
103
|
+
return unless cookies[:auth_token] && !logged_in?
|
104
|
+
user = User.find_by_remember_token(cookies[:auth_token])
|
105
|
+
if user && user.remember_token?
|
106
|
+
user.remember_me
|
107
|
+
self.current_user = user
|
108
|
+
cookies[:auth_token] = {
|
109
|
+
:value => current_user.remember_token,
|
110
|
+
:expires => current_user.remember_token_expires_at
|
111
|
+
}
|
112
|
+
flash.now[:notice] = _("Logged in successfully")
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
private
|
117
|
+
@@http_auth_headers = %w(X-HTTP_AUTHORIZATION HTTP_AUTHORIZATION Authorization)
|
118
|
+
# gets BASIC auth info
|
119
|
+
def get_auth_data
|
120
|
+
auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }
|
121
|
+
auth_data = request.env[auth_key].to_s.split unless auth_key.blank?
|
122
|
+
return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]
|
123
|
+
end
|
124
|
+
end
|