hydra-head 3.0.0pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +71 -0
- data/.gitmodules +6 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +257 -0
- data/README.textile +150 -0
- data/README_RAILS3_CHANGES.textile +42 -0
- data/Rakefile +5 -0
- data/TESTING.textile +85 -0
- data/app/controllers/assets_controller.rb +117 -0
- data/app/controllers/contributors_controller.rb +54 -0
- data/app/controllers/file_assets_controller.rb +152 -0
- data/app/controllers/permissions_controller.rb +137 -0
- data/app/controllers/user_sessions_controller.rb +14 -0
- data/app/helpers/article_metadata_helper.rb +80 -0
- data/app/helpers/blacklight_helper.rb +192 -0
- data/app/helpers/downloads_helper.rb +19 -0
- data/app/helpers/generic_content_objects_helper.rb +16 -0
- data/app/helpers/hydra_assets_helper.rb +75 -0
- data/app/helpers/hydra_djatoka_helper.rb +23 -0
- data/app/helpers/hydra_fedora_metadata_helper.rb +365 -0
- data/app/helpers/hydra_helper.rb +155 -0
- data/app/helpers/hydra_uploader_helper.rb +18 -0
- data/app/helpers/inline_editable_metadata_helper.rb +15 -0
- data/app/helpers/javascript_includes_helper.rb +93 -0
- data/app/helpers/release_process_helper.rb +32 -0
- data/app/models/audio_asset.rb +8 -0
- data/app/models/file_asset.rb +111 -0
- data/app/models/generic_content.rb +21 -0
- data/app/models/generic_image.rb +62 -0
- data/app/models/image_asset.rb +8 -0
- data/app/models/mods_asset.rb +6 -0
- data/app/models/role_mapper.rb +22 -0
- data/app/models/superuser.rb +6 -0
- data/app/models/video_asset.rb +8 -0
- data/app/views/_add_assets_links.html.erb +13 -0
- data/app/views/_brown_sidebar.html +15 -0
- data/app/views/_user_util_links.html.erb +31 -0
- data/app/views/catalog/_citation.html.erb +11 -0
- data/app/views/catalog/_constraints_element.html.erb +34 -0
- data/app/views/catalog/_delete_partials/_default.html.erb +29 -0
- data/app/views/catalog/_document_list.html.erb +11 -0
- data/app/views/catalog/_edit_partials/_default.html.erb +64 -0
- data/app/views/catalog/_edit_partials/_default_details.html.erb +15 -0
- data/app/views/catalog/_email_form.html.erb +9 -0
- data/app/views/catalog/_facets.html.erb +37 -0
- data/app/views/catalog/_flash_msg.html.erb +17 -0
- data/app/views/catalog/_home.html.erb +6 -0
- data/app/views/catalog/_home_text.html.erb +10 -0
- data/app/views/catalog/_index_partials/_default.html.erb +20 -0
- data/app/views/catalog/_index_partials/_default_details.html.erb +11 -0
- data/app/views/catalog/_index_partials/_default_group.html.erb +15 -0
- data/app/views/catalog/_search_form.html.erb +12 -0
- data/app/views/catalog/_show_partials/_default.html.erb +23 -0
- data/app/views/catalog/_show_partials/_default_details.html.erb +12 -0
- data/app/views/catalog/_show_partials/_facets.html.erb +52 -0
- data/app/views/catalog/_sms_form.html.erb +21 -0
- data/app/views/catalog/_sort_and_per_page.html.erb +22 -0
- data/app/views/catalog/_uva_tabs.html.erb +10 -0
- data/app/views/catalog/about.html.erb +0 -0
- data/app/views/catalog/show.html.erb +48 -0
- data/app/views/contributors/_add_contributor_split_button.html.erb +10 -0
- data/app/views/contributors/_edit_conference.html.erb +29 -0
- data/app/views/contributors/_edit_organization.html.erb +29 -0
- data/app/views/contributors/_edit_person.html.erb +42 -0
- data/app/views/contributors/_index.html.erb +12 -0
- data/app/views/contributors/_new.html.erb +10 -0
- data/app/views/contributors/_show_conference.html.erb +22 -0
- data/app/views/contributors/_show_organization.html.erb +29 -0
- data/app/views/contributors/_show_person.html.erb +17 -0
- data/app/views/contributors/new.html.erb +13 -0
- data/app/views/downloads/index.html.erb +1 -0
- data/app/views/file_assets/_deletable_result.html.erb +5 -0
- data/app/views/file_assets/_index.html.erb +15 -0
- data/app/views/file_assets/_new.html.erb +2 -0
- data/app/views/file_assets/_result.html.erb +16 -0
- data/app/views/file_assets/index.html.erb +5 -0
- data/app/views/fluid_infusion/_uploader.html.erb +81 -0
- data/app/views/fluid_infusion/_uploader_generic_content_objects.js.erb +38 -0
- data/app/views/fluid_infusion/_uploader_js.erb +45 -0
- data/app/views/generic_content_objects/_edit_description.html.erb +50 -0
- data/app/views/generic_content_objects/_new.html.erb +0 -0
- data/app/views/generic_content_objects/_show_description.html.erb +68 -0
- data/app/views/generic_content_objects/contributors/_edit_conference.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_organization.html.erb +29 -0
- data/app/views/generic_content_objects/contributors/_edit_person.html.erb +37 -0
- data/app/views/generic_content_objects/contributors/_new.html.erb +10 -0
- data/app/views/generic_content_objects/contributors/_show_conference.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_organization.html.erb +22 -0
- data/app/views/generic_content_objects/contributors/_show_person.html.erb +38 -0
- data/app/views/generic_contents/_edit.html.erb +59 -0
- data/app/views/generic_contents/_index.html.erb +23 -0
- data/app/views/generic_contents/_show.html.erb +18 -0
- data/app/views/generic_contents/_show_content.html.erb +4 -0
- data/app/views/generic_images/_edit.html.erb +59 -0
- data/app/views/generic_images/_index.html.erb +24 -0
- data/app/views/generic_images/_show.html.erb +18 -0
- data/app/views/generic_images/_show_all.html.erb +14 -0
- data/app/views/generic_images/_show_content.html.erb +7 -0
- data/app/views/layouts/application.html.erb +57 -0
- data/app/views/layouts/hydra-head.html.erb +12 -0
- data/app/views/mods_assets/_edit.html.erb +49 -0
- data/app/views/mods_assets/_edit_description.html.erb +82 -0
- data/app/views/mods_assets/_edit_journal.html.erb +72 -0
- data/app/views/mods_assets/_index.html.erb +1 -0
- data/app/views/mods_assets/_index_list.html.erb +37 -0
- data/app/views/mods_assets/_index_table.html.erb +7 -0
- data/app/views/mods_assets/_progress_box.html.erb +82 -0
- data/app/views/mods_assets/_show.html.erb +44 -0
- data/app/views/mods_assets/_show_description.html.erb +44 -0
- data/app/views/mods_assets/_show_journal.html.erb +42 -0
- data/app/views/mods_assets/_show_permissions.html.erb +14 -0
- data/app/views/permissions/_edit_person_permissions.html.erb +35 -0
- data/app/views/permissions/_index.html.erb +55 -0
- data/app/views/permissions/_new.html.erb +18 -0
- data/app/views/permissions/index.html.erb +1 -0
- data/app/views/permissions/new.html.erb +1 -0
- data/app/views/shared/_delete_asset_confirmation.html.erb +17 -0
- data/app/views/user_sessions/_login_form.html.erb +10 -0
- data/app/views/user_sessions/logged_out.html.erb +1 -0
- data/config/routes.rb +12 -0
- data/fedora_conf/conf/fedora.fcfg +1021 -0
- data/hydra-head.gemspec +70 -0
- data/lib/application_controller.rb +25 -0
- data/lib/application_helper.rb +2 -0
- data/lib/engine.rb +30 -0
- data/lib/generators/hydra/head_generator.rb +152 -0
- data/lib/generators/hydra/templates/config/fedora.yml +17 -0
- data/lib/generators/hydra/templates/config/initializers/blacklight_config.rb +246 -0
- data/lib/generators/hydra/templates/config/initializers/fedora_config.rb +23 -0
- data/lib/generators/hydra/templates/config/initializers/hydra_config.rb +29 -0
- data/lib/generators/hydra/templates/config/role_map_cucumber.yml +10 -0
- data/lib/generators/hydra/templates/config/role_map_development.yml +12 -0
- data/lib/generators/hydra/templates/config/role_map_production.yml +2 -0
- data/lib/generators/hydra/templates/config/role_map_test.yml +15 -0
- data/lib/generators/hydra/templates/config/solr.yml +10 -0
- data/lib/generators/hydra/templates/config/solr_mappings.yml +22 -0
- data/lib/generators/hydra/templates/fedora_conf/conf/fedora.fcfg +1021 -0
- data/lib/generators/hydra/templates/migrations/add_user_attributes_table.rb +15 -0
- data/lib/generators/hydra/templates/migrations/create_superusers.rb +12 -0
- data/lib/generators/hydra/templates/solr_conf/conf/schema.xml +118 -0
- data/lib/generators/hydra/templates/solr_conf/conf/solrconfig.xml +332 -0
- data/lib/generators/hydra/templates/solr_conf/solr.xml +35 -0
- data/lib/hydra-head.rb +29 -0
- data/lib/hydra-head/engine.rb +9 -0
- data/lib/hydra-head/routes.rb +87 -0
- data/lib/hydra-head/version.rb +4 -0
- data/lib/hydra.rb +22 -0
- data/lib/hydra/access_controls_enforcement.rb +236 -0
- data/lib/hydra/access_controls_evaluation.rb +97 -0
- data/lib/hydra/assets_controller_helper.rb +144 -0
- data/lib/hydra/catalog.rb +64 -0
- data/lib/hydra/common_mods_index_methods.rb +42 -0
- data/lib/hydra/controller.rb +7 -0
- data/lib/hydra/file_assets_helper.rb +144 -0
- data/lib/hydra/fixtures.rb +43 -0
- data/lib/hydra/generic_content.rb +113 -0
- data/lib/hydra/generic_image.rb +100 -0
- data/lib/hydra/image.rb +177 -0
- data/lib/hydra/model_methods.rb +95 -0
- data/lib/hydra/model_mixins.rb +2 -0
- data/lib/hydra/model_mixins/common_metadata.rb +24 -0
- data/lib/hydra/model_mixins/mods_object.rb +16 -0
- data/lib/hydra/mods_article.rb +505 -0
- data/lib/hydra/mods_dataset.rb +165 -0
- data/lib/hydra/mods_generic_content.rb +494 -0
- data/lib/hydra/mods_image.rb +494 -0
- data/lib/hydra/repository_controller.rb +102 -0
- data/lib/hydra/rights_metadata.rb +189 -0
- data/lib/hydra/superuser_attributes.rb +12 -0
- data/lib/hydra/testing_server.rb +183 -0
- data/lib/hydra/user.rb +22 -0
- data/lib/mediashelf/active_fedora_helper.rb +72 -0
- data/lib/railties/all_tests.rake +23 -0
- data/lib/railties/hydra-fixtures.rake +184 -0
- data/lib/railties/hydra_jetty.rake +79 -0
- data/lib/railties/hyhead_cucumber.rake +127 -0
- data/lib/railties/hyhead_rspec.rake +137 -0
- data/lib/stanford/searchworks_helper.rb +1338 -0
- data/lib/stanford/solr_helper.rb +108 -0
- data/lib/uva/mods_index_methods.rb +24 -0
- data/solr_conf/conf/schema.xml +122 -0
- data/solr_conf/conf/solrconfig.xml +332 -0
- data/solr_conf/solr.xml +35 -0
- data/tasks/hydra-head-fixtures.rake +54 -0
- data/tasks/hydra-head.rake +247 -0
- data/tasks/hydra_jetty.rake +79 -0
- data/tasks/replicator.rake +27 -0
- data/tasks/solrizer-fedora.rake +53 -0
- data/tasks/solrizer.rake +13 -0
- data/test_support/etc/Gemfile +29 -0
- data/test_support/etc/rvmrc +32 -0
- data/test_support/features/button_add_assets.feature +22 -0
- data/test_support/features/button_add_generic_content.feature +11 -0
- data/test_support/features/button_add_image.feature +11 -0
- data/test_support/features/button_add_mods_asset.feature +11 -0
- data/test_support/features/contributor_add.feature +39 -0
- data/test_support/features/file_assets_list.feature +32 -0
- data/test_support/features/file_upload.feature +40 -0
- data/test_support/features/home_page.feature +9 -0
- data/test_support/features/html_validity.feature +47 -0
- data/test_support/features/mods_asset_contributors_edit.feature +80 -0
- data/test_support/features/mods_asset_create.feature +12 -0
- data/test_support/features/mods_asset_edit.feature +33 -0
- data/test_support/features/mods_asset_edit_without_permission.feature +10 -0
- data/test_support/features/mods_asset_search_result.feature +13 -0
- data/test_support/features/mods_asset_show.feature +39 -0
- data/test_support/features/permissions_add.feature +15 -0
- data/test_support/features/permissions_edit.feature +63 -0
- data/test_support/features/step_definitions/catalog_index_steps.rb +14 -0
- data/test_support/features/step_definitions/create_asset_steps.rb +7 -0
- data/test_support/features/step_definitions/edit_metadata_steps.rb +73 -0
- data/test_support/features/step_definitions/file_list_steps.rb +28 -0
- data/test_support/features/step_definitions/hydra_metadata_steps.rb +3 -0
- data/test_support/features/step_definitions/hydra_steps.rb +8 -0
- data/test_support/features/step_definitions/inline_editable_edit_steps.rb +77 -0
- data/test_support/features/step_definitions/search_steps.rb +88 -0
- data/test_support/features/step_definitions/searching_steps.rb +22 -0
- data/test_support/features/step_definitions/show_document_steps.rb +85 -0
- data/test_support/features/step_definitions/user_steps.rb +36 -0
- data/test_support/features/step_definitions/web_steps.rb +219 -0
- data/test_support/features/support/env.rb +55 -0
- data/test_support/features/support/paths.rb +80 -0
- data/test_support/features/switch_users.feature +14 -0
- data/test_support/features/view_catalog_index.feature +18 -0
- data/test_support/fixtures/empty_file.txt +0 -0
- data/test_support/fixtures/hydrangea_fixture_archivist_only_mods_article.foxml.xml +1212 -0
- data/test_support/fixtures/hydrangea_fixture_file_asset1.foxml.xml +4946 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article1.foxml.xml +234 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article2.foxml.xml +177 -0
- data/test_support/fixtures/hydrangea_fixture_mods_article3.foxml.xml +170 -0
- data/test_support/fixtures/hydrangea_fixture_mods_dataset1.foxml.xml +187 -0
- data/test_support/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +676 -0
- data/test_support/fixtures/image.jp2 +0 -0
- data/test_support/fixtures/libra-oa_1.foxml.xml +2324 -0
- data/test_support/fixtures/libra-oa_2.foxml.xml +2422 -0
- data/test_support/spec/controllers/assets_controller_spec.rb +113 -0
- data/test_support/spec/controllers/catalog_controller_spec.rb +148 -0
- data/test_support/spec/controllers/catalog_controller_viewing_context_spec.rb +62 -0
- data/test_support/spec/controllers/contributors_controller_spec.rb +47 -0
- data/test_support/spec/controllers/file_assets_controller_spec.rb +189 -0
- data/test_support/spec/controllers/hydra_controller_spec.rb +15 -0
- data/test_support/spec/controllers/permissions_controller_spec.rb +80 -0
- data/test_support/spec/controllers/user_sessions_controller_spec.rb +35 -0
- data/test_support/spec/generators/hydra-head_generator_spec.rb +14 -0
- data/test_support/spec/helpers/access_controls_enforcement_spec.rb +212 -0
- data/test_support/spec/helpers/access_controls_evaluation_spec.rb +35 -0
- data/test_support/spec/helpers/assets_controller_helper_spec.rb +71 -0
- data/test_support/spec/helpers/blacklight_helper_spec.rb +64 -0
- data/test_support/spec/helpers/file_assets_helper_spec.rb +107 -0
- data/test_support/spec/helpers/hydra-repository_controller_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_assets_helper_spec.rb +195 -0
- data/test_support/spec/helpers/hydra_djatoka_helper_spec.rb +32 -0
- data/test_support/spec/helpers/hydra_fedora_metadata_helper_spec.rb +215 -0
- data/test_support/spec/helpers/hydra_helper_spec.rb +73 -0
- data/test_support/spec/helpers/hydra_model_methods_spec.rb +95 -0
- data/test_support/spec/helpers/hydra_uploader_helper_spec.rb +18 -0
- data/test_support/spec/helpers/javascript_includes_helper_spec.rb +43 -0
- data/test_support/spec/integration/file_asset_spec.rb +150 -0
- data/test_support/spec/lib/active_fedora_helper_spec.rb +56 -0
- data/test_support/spec/lib/catalog_spec.rb +16 -0
- data/test_support/spec/lib/common_mods_index_methods_spec.rb +28 -0
- data/test_support/spec/models/audio_asset_spec.rb +23 -0
- data/test_support/spec/models/file_asset_spec.rb +42 -0
- data/test_support/spec/models/generic_content_spec.rb +29 -0
- data/test_support/spec/models/generic_image_spec.rb +58 -0
- data/test_support/spec/models/hydra_rights_metadata_spec.rb +162 -0
- data/test_support/spec/models/image_asset_spec.rb +23 -0
- data/test_support/spec/models/mods_asset_spec.rb +29 -0
- data/test_support/spec/models/role_mapper_spec.rb +22 -0
- data/test_support/spec/models/user_spec.rb +52 -0
- data/test_support/spec/models/video_asset_spec.rb +23 -0
- data/test_support/spec/rcov.opts +3 -0
- data/test_support/spec/spec.opts +4 -0
- data/test_support/spec/spec_helper.rb +44 -0
- data/test_support/spec/support/matchers/helper_matcher.rb +14 -0
- data/test_support/spec/support/matchers/solr_matchers.rb +60 -0
- data/test_support/spec/unit/hydra-head-engine_spec.rb +8 -0
- data/test_support/spec/unit/hydra-head_spec.rb +8 -0
- data/test_support/spec/utilities/hydra_testing_server_spec.rb +49 -0
- data/test_support/spec/views/uploader.html.erb_spec.rb +30 -0
- data/vendor/cache/RedCloth-4.2.3.gem +0 -0
- data/vendor/cache/abstract-1.0.0.gem +0 -0
- data/vendor/cache/actionmailer-3.0.9.gem +0 -0
- data/vendor/cache/actionpack-3.0.9.gem +0 -0
- data/vendor/cache/active-fedora-2.3.3.gem +0 -0
- data/vendor/cache/activemodel-3.0.9.gem +0 -0
- data/vendor/cache/activerecord-3.0.9.gem +0 -0
- data/vendor/cache/activeresource-3.0.9.gem +0 -0
- data/vendor/cache/activesupport-3.0.9.gem +0 -0
- data/vendor/cache/arel-2.0.10.gem +0 -0
- data/vendor/cache/blacklight-3.0.0.gem +0 -0
- data/vendor/cache/block_helpers-0.3.3.gem +0 -0
- data/vendor/cache/builder-2.1.2.gem +0 -0
- data/vendor/cache/capybara-1.0.0.gem +0 -0
- data/vendor/cache/childprocess-0.2.0.gem +0 -0
- data/vendor/cache/columnize-0.3.4.gem +0 -0
- data/vendor/cache/crack-0.1.8.gem +0 -0
- data/vendor/cache/cucumber-1.0.2.gem +0 -0
- data/vendor/cache/cucumber-rails-1.0.2.gem +0 -0
- data/vendor/cache/curb-0.7.15.gem +0 -0
- data/vendor/cache/daemons-1.1.4.gem +0 -0
- data/vendor/cache/database_cleaner-0.6.7.gem +0 -0
- data/vendor/cache/diff-lcs-1.1.2.gem +0 -0
- data/vendor/cache/equivalent-xml-0.2.7.gem +0 -0
- data/vendor/cache/erubis-2.6.6.gem +0 -0
- data/vendor/cache/facets-2.8.4.gem +0 -0
- data/vendor/cache/factory_girl-1.3.3.gem +0 -0
- data/vendor/cache/fastercsv-1.5.4.gem +0 -0
- data/vendor/cache/ffi-1.0.9.gem +0 -0
- data/vendor/cache/gherkin-2.4.5.gem +0 -0
- data/vendor/cache/haml-3.1.2.gem +0 -0
- data/vendor/cache/httparty-0.7.8.gem +0 -0
- data/vendor/cache/i18n-0.5.0.gem +0 -0
- data/vendor/cache/jettywrapper-0.0.10.gem +0 -0
- data/vendor/cache/json-1.5.3.gem +0 -0
- data/vendor/cache/json_pure-1.5.3.gem +0 -0
- data/vendor/cache/kaminari-0.12.4.gem +0 -0
- data/vendor/cache/launchy-2.0.3.gem +0 -0
- data/vendor/cache/linecache-0.46.gem +0 -0
- data/vendor/cache/logger-1.2.8.gem +0 -0
- data/vendor/cache/mail-2.2.19.gem +0 -0
- data/vendor/cache/marc-0.4.3.gem +0 -0
- data/vendor/cache/mediashelf-loggable-0.4.2.gem +0 -0
- data/vendor/cache/mime-types-1.16.gem +0 -0
- data/vendor/cache/mocha-0.9.12.gem +0 -0
- data/vendor/cache/multipart-post-1.1.2.gem +0 -0
- data/vendor/cache/nokogiri-1.5.0.gem +0 -0
- data/vendor/cache/om-1.2.5.gem +0 -0
- data/vendor/cache/polyglot-0.3.1.gem +0 -0
- data/vendor/cache/rack-1.2.3.gem +0 -0
- data/vendor/cache/rack-mount-0.6.14.gem +0 -0
- data/vendor/cache/rack-test-0.5.7.gem +0 -0
- data/vendor/cache/rails-3.0.9.gem +0 -0
- data/vendor/cache/railties-3.0.9.gem +0 -0
- data/vendor/cache/rake-0.9.2.gem +0 -0
- data/vendor/cache/rbx-require-relative-0.0.5.gem +0 -0
- data/vendor/cache/rcov-0.9.9.gem +0 -0
- data/vendor/cache/rdoc-3.8.gem +0 -0
- data/vendor/cache/rsolr-1.0.2.gem +0 -0
- data/vendor/cache/rsolr-ext-1.0.3.gem +0 -0
- data/vendor/cache/rspec-2.6.0.gem +0 -0
- data/vendor/cache/rspec-core-2.6.4.gem +0 -0
- data/vendor/cache/rspec-expectations-2.6.0.gem +0 -0
- data/vendor/cache/rspec-mocks-2.6.0.gem +0 -0
- data/vendor/cache/rspec-rails-2.6.1.gem +0 -0
- data/vendor/cache/ruby-debug-0.10.4.gem +0 -0
- data/vendor/cache/ruby-debug-base-0.10.4.gem +0 -0
- data/vendor/cache/rubyzip-0.9.4.gem +0 -0
- data/vendor/cache/sanitize-2.0.3.gem +0 -0
- data/vendor/cache/selenium-webdriver-0.2.2.gem +0 -0
- data/vendor/cache/solr-ruby-0.0.8.gem +0 -0
- data/vendor/cache/solrizer-1.1.0.gem +0 -0
- data/vendor/cache/solrizer-fedora-1.1.0.gem +0 -0
- data/vendor/cache/sqlite3-ruby-1.2.5.gem +0 -0
- data/vendor/cache/stomp-1.1.9.gem +0 -0
- data/vendor/cache/term-ansicolor-1.0.5.gem +0 -0
- data/vendor/cache/thor-0.14.6.gem +0 -0
- data/vendor/cache/treetop-1.4.9.gem +0 -0
- data/vendor/cache/trollop-1.16.2.gem +0 -0
- data/vendor/cache/tzinfo-0.3.29.gem +0 -0
- data/vendor/cache/unicode-0.4.0.gem +0 -0
- data/vendor/cache/will_paginate-2.3.15.gem +0 -0
- data/vendor/cache/xml-simple-1.1.0.gem +0 -0
- data/vendor/cache/xpath-0.1.4.gem +0 -0
- data/vendor/cache/yard-0.7.2.gem +0 -0
- metadata +1110 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
+
<!--
|
3
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
+
contributor license agreements. See the NOTICE file distributed with
|
5
|
+
this work for additional information regarding copyright ownership.
|
6
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
+
(the "License"); you may not use this file except in compliance with
|
8
|
+
the License. You may obtain a copy of the License at
|
9
|
+
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
Unless required by applicable law or agreed to in writing, software
|
13
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
See the License for the specific language governing permissions and
|
16
|
+
limitations under the License.
|
17
|
+
-->
|
18
|
+
|
19
|
+
<!--
|
20
|
+
All (relative) paths are relative to the installation path
|
21
|
+
|
22
|
+
persistent: Save changes made via the API to this file
|
23
|
+
sharedLib: path to a lib directory that will be shared across all cores
|
24
|
+
-->
|
25
|
+
<solr persistent="false">
|
26
|
+
|
27
|
+
<!--
|
28
|
+
adminPath: RequestHandler path to manage cores.
|
29
|
+
If 'null' (or absent), cores will not be manageable via REST
|
30
|
+
-->
|
31
|
+
<cores adminPath="/admin/cores">
|
32
|
+
<core name="core0" instanceDir="core0" />
|
33
|
+
<core name="core1" instanceDir="core1" />
|
34
|
+
</cores>
|
35
|
+
</solr>
|
data/lib/hydra-head.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module HydraHead
|
2
|
+
require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3
|
3
|
+
require 'application_controller'
|
4
|
+
|
5
|
+
require 'hydra-head/version'
|
6
|
+
require 'hydra-head/routes'
|
7
|
+
|
8
|
+
def self.version
|
9
|
+
HydraHead::VERSION
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.root
|
13
|
+
@root ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
|
14
|
+
end
|
15
|
+
|
16
|
+
# If you put this in your application's routes.rb, it will add the Hydra Head routes to the app.
|
17
|
+
# The hydra:head generator puts this in routes.rb for you by default.
|
18
|
+
# See {HydraHead::Routes} for information about how to modify which routes are generated.
|
19
|
+
# @example
|
20
|
+
# # in config/routes.rb
|
21
|
+
# MyAppName::Application.routes.draw do
|
22
|
+
# Blacklight.add_routes(self)
|
23
|
+
# HydraHead.add_routes(self)
|
24
|
+
# end
|
25
|
+
def self.add_routes(router, options = {})
|
26
|
+
HydraHead::Routes.new(router, options).draw
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module HydraHead
|
3
|
+
class Routes
|
4
|
+
|
5
|
+
def initialize(router, options)
|
6
|
+
@router = router
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def draw
|
11
|
+
route_sets.each do |r|
|
12
|
+
self.send(r)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def add_routes &blk
|
19
|
+
@router.instance_exec(@options, &blk)
|
20
|
+
end
|
21
|
+
|
22
|
+
def route_sets
|
23
|
+
(@options[:only] || default_route_sets) - (@options[:except] || [])
|
24
|
+
end
|
25
|
+
|
26
|
+
def default_route_sets
|
27
|
+
#[:file_assets, :assets, :downloads, :contributors, :grants, :permissions, :superuser,:catalog, :get]
|
28
|
+
[:get, :catalog, :superuser, :assets_with_all_nested_routes]
|
29
|
+
end
|
30
|
+
|
31
|
+
module RouteSets
|
32
|
+
|
33
|
+
|
34
|
+
def assets_with_all_nested_routes
|
35
|
+
add_routes do |options|
|
36
|
+
resources :file_assets
|
37
|
+
match "withdraw", :to => "assets#withdraw", :as => "withdraw"
|
38
|
+
resources :assets do
|
39
|
+
# this is to remove documents from SOLR but not from Fedora.
|
40
|
+
resources :contributors, :only=>[:new,:create]
|
41
|
+
match 'contributors/:contributor_type/:index', :to => 'contributors#show', :as => 'contributor', :via => 'get'
|
42
|
+
match 'contributors/:contributor_type/:index', :to => 'contributors#destroy', :as => 'connect', :via => 'delete'
|
43
|
+
resources :file_assets
|
44
|
+
resources :downloads, :only=>[:index]
|
45
|
+
resources :grants, :only=>[:new,:create]
|
46
|
+
resources :permissions
|
47
|
+
# Allow updates to assets/:asset_id/permissions (no :id necessary)
|
48
|
+
match '/permissions', :to => 'permissions#update', :as => 'update_group_permissions'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
def superuser
|
55
|
+
add_routes do |options|
|
56
|
+
match 'superuser', :to => 'user_sessions#superuser', :as => 'superuser'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def catalog
|
61
|
+
add_routes do |options|
|
62
|
+
match 'catalog/:id/edit', :to => 'catalog#edit', :as => 'edit_catalog'
|
63
|
+
# The delete method renders a confirmation page with a button to submit actual destroy request
|
64
|
+
match 'catalog/:id/delete', :to => 'catalog#delete', :as => 'delete_catalog'
|
65
|
+
### The rest of these routes are defined in blacklight
|
66
|
+
#resources :catalog, :id=> /.+/
|
67
|
+
# resources :catalog, :only => [:index, :show], :controller => "hydra_head/catalog", :path_prefix => HydraHead::Engine.config.mount_at, :as => "hydra_head", :id=> /.+/
|
68
|
+
#match 'catalog/:id', :to => "hydra_head/catalog#show", :path_prefix => HydraHead::Engine.config.mount_at, :as => "catalog", :id => /.+/
|
69
|
+
#match 'catalog/:id', :to => "hydra_head/catalog#show", :id => /.+/
|
70
|
+
# match 'about', :to => 'catalog#about', :as => 'about'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
def get
|
76
|
+
add_routes do |options|
|
77
|
+
resources :get, :only=>:show
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
end
|
83
|
+
include RouteSets
|
84
|
+
|
85
|
+
#match 'generic_contents_object/content/:container_id', :to => 'generic_content_objects#create', :as => 'generic_content_object', :via => :post
|
86
|
+
end
|
87
|
+
end
|
data/lib/hydra.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "blacklight"
|
2
|
+
# Hydra libraries
|
3
|
+
module Hydra
|
4
|
+
autoload :Configurable, 'blacklight/configurable'
|
5
|
+
extend Blacklight::Configurable
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
require 'mediashelf/active_fedora_helper'
|
10
|
+
|
11
|
+
require 'hydra/repository_controller'
|
12
|
+
require 'hydra/access_controls_enforcement'
|
13
|
+
require 'hydra/testing_server'
|
14
|
+
require 'hydra/assets_controller_helper'
|
15
|
+
require 'hydra/file_assets_helper'
|
16
|
+
|
17
|
+
require 'hydra/rights_metadata'
|
18
|
+
require 'hydra/common_mods_index_methods'
|
19
|
+
require 'hydra/mods_article'
|
20
|
+
require 'hydra/model_methods'
|
21
|
+
|
22
|
+
Dir[File.join(File.dirname(__FILE__), "hydra", "*.rb")].each {|f| require f}
|
@@ -0,0 +1,236 @@
|
|
1
|
+
module Hydra::AccessControlsEnforcement
|
2
|
+
|
3
|
+
def self.included(klass)
|
4
|
+
klass.send(:include, Hydra::AccessControlsEvaluation)
|
5
|
+
end
|
6
|
+
|
7
|
+
#
|
8
|
+
# Access Controls Enforcement Filters
|
9
|
+
#
|
10
|
+
|
11
|
+
# Controller "before" filter that delegates enforcement based on the controller action
|
12
|
+
# Action-specific implementations are enforce_index_permissions, enforce_show_permissions, etc.
|
13
|
+
# @param [Hash] opts (optional, not currently used)
|
14
|
+
#
|
15
|
+
# @example
|
16
|
+
# class CatalogController < ApplicationController
|
17
|
+
# before_filter :enforce_access_controls
|
18
|
+
# end
|
19
|
+
def enforce_access_controls(opts={})
|
20
|
+
controller_action = params[:action].to_s
|
21
|
+
if params[:action] == "destroy" then controller_action = "edit" end
|
22
|
+
delegate_method = "enforce_#{controller_action}_permissions"
|
23
|
+
self.send(delegate_method.to_sym)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
#
|
28
|
+
# Solr integration
|
29
|
+
#
|
30
|
+
|
31
|
+
# returns a params hash with the permissions info for a single solr document
|
32
|
+
# If the id arg is nil, then the value is fetched from params[:id]
|
33
|
+
# This method is primary called by the get_permissions_solr_response_for_doc_id method.
|
34
|
+
# Modeled on Blacklight::SolrHelper.solr_doc_params
|
35
|
+
# @param [String] id of the documetn to retrieve
|
36
|
+
def permissions_solr_doc_params(id=nil)
|
37
|
+
id ||= params[:id]
|
38
|
+
# just to be consistent with the other solr param methods:
|
39
|
+
{
|
40
|
+
:qt => :permissions,
|
41
|
+
:id => id # this assumes the document request handler will map the 'id' param to the unique key field
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
# a solr query method
|
46
|
+
# retrieve a solr document, given the doc id
|
47
|
+
# Modeled on Blacklight::SolrHelper.get_permissions_solr_response_for_doc_id
|
48
|
+
# @param [String] id of the documetn to retrieve
|
49
|
+
# @param [Hash] extra_controller_params (optional)
|
50
|
+
def get_permissions_solr_response_for_doc_id(id=nil, extra_controller_params={})
|
51
|
+
raise Blacklight::Exceptions::InvalidSolrID.new("The application is trying to retrieve permissions without specifying an asset id") if id.nil?
|
52
|
+
solr_response = Blacklight.solr.find permissions_solr_doc_params(id).merge(extra_controller_params)
|
53
|
+
raise Blacklight::Exceptions::InvalidSolrID.new("The solr permissions search handler didn't return anything for id \"#{id}\"") if solr_response.docs.empty?
|
54
|
+
document = SolrDocument.new(solr_response.docs.first, solr_response)
|
55
|
+
[solr_response, document]
|
56
|
+
end
|
57
|
+
|
58
|
+
# Loads permissions info into @permissions_solr_response and @permissions_solr_document
|
59
|
+
def load_permissions_from_solr(id=params[:id], extra_controller_params={})
|
60
|
+
unless !@permissions_solr_document.nil? && !@permissions_solr_response.nil?
|
61
|
+
@permissions_solr_response, @permissions_solr_document = get_permissions_solr_response_for_doc_id(id, extra_controller_params)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
# If someone hits the show action while their session's viewing_context is in edit mode,
|
68
|
+
# this will redirect them to the edit action.
|
69
|
+
# If they do not have sufficient privileges to edit documents, it will silently switch their session to browse mode.
|
70
|
+
def enforce_viewing_context_for_show_requests
|
71
|
+
if params[:viewing_context] == "browse"
|
72
|
+
session[:viewing_context] = params[:viewing_context]
|
73
|
+
elsif session[:viewing_context] == "edit"
|
74
|
+
if editor?
|
75
|
+
logger.debug("enforce_viewing_context_for_show_requests redirecting to edit")
|
76
|
+
if params[:files]
|
77
|
+
redirect_to :action=>:edit, :files=>true
|
78
|
+
else
|
79
|
+
redirect_to :action=>:edit
|
80
|
+
end
|
81
|
+
else
|
82
|
+
session[:viewing_context] = "browse"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# Action-specific enforcement
|
89
|
+
#
|
90
|
+
|
91
|
+
# Controller "before" filter for enforcing access controls on show actions
|
92
|
+
# @param [Hash] opts (optional, not currently used)
|
93
|
+
def enforce_show_permissions(opts={})
|
94
|
+
load_permissions_from_solr
|
95
|
+
unless @permissions_solr_document['access_t'] && (@permissions_solr_document['access_t'].first == "public" || @permissions_solr_document['access_t'].first == "Public")
|
96
|
+
if @permissions_solr_document["embargo_release_date_dt"]
|
97
|
+
embargo_date = Date.parse(@permissions_solr_document["embargo_release_date_dt"].split(/T/)[0])
|
98
|
+
if embargo_date > Date.parse(Time.now.to_s)
|
99
|
+
# check for depositor raise "#{@document["depositor_t"].first} --- #{current_user.login}"
|
100
|
+
unless current_user && current_user.login == @permissions_solr_document["depositor_t"].first
|
101
|
+
flash[:notice] = "This item is under embargo. You do not have sufficient access privileges to read this document."
|
102
|
+
redirect_to(:action=>'index', :q=>nil, :f=>nil) and return false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
unless reader?
|
107
|
+
flash[:notice]= "You do not have sufficient access privileges to read this document, which has been marked private."
|
108
|
+
redirect_to(:action => 'index', :q => nil , :f => nil) and return false
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Controller "before" filter for enforcing access controls on edit actions
|
114
|
+
# @param [Hash] opts (optional, not currently used)
|
115
|
+
def enforce_edit_permissions(opts={})
|
116
|
+
logger.debug("Enforcing edit permissions")
|
117
|
+
load_permissions_from_solr
|
118
|
+
if !editor?
|
119
|
+
session[:viewing_context] = "browse"
|
120
|
+
flash[:notice] = "You do not have sufficient privileges to edit this document. You have been redirected to the read-only view."
|
121
|
+
redirect_to :action=>:show
|
122
|
+
else
|
123
|
+
session[:viewing_context] = "edit"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
## proxies to enforce_edit_permssions. This method is here for you to override
|
128
|
+
def enforce_update_permissions(opts={})
|
129
|
+
enforce_edit_permissions(opts)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Controller "before" filter for enforcing access controls on index actions
|
133
|
+
# Currently does nothing, instead relies on
|
134
|
+
# @param [Hash] opts (optional, not currently used)
|
135
|
+
def enforce_index_permissions(opts={})
|
136
|
+
return true
|
137
|
+
# Do nothing. Relies on enforce_search_permissions being included in the Controller's solr_search_params_logic
|
138
|
+
# apply_gated_discovery
|
139
|
+
# if !reader?
|
140
|
+
# solr_parameters[:qt] = Blacklight.config[:public_qt]
|
141
|
+
# end
|
142
|
+
end
|
143
|
+
|
144
|
+
#
|
145
|
+
# Solr query modifications
|
146
|
+
#
|
147
|
+
|
148
|
+
# Set solr_parameters to enforce appropriate permissions
|
149
|
+
# * Applies a lucene query to the solr :q parameter for gated discovery
|
150
|
+
# * Uses public_qt search handler if user does not have "read" permissions
|
151
|
+
# @param solr_parameters the current solr parameters
|
152
|
+
# @param user_parameters the current user-subitted parameters
|
153
|
+
#
|
154
|
+
# @example This method should be added to your Catalog Controller's solr_search_params_logic
|
155
|
+
# class CatalogController < ApplicationController
|
156
|
+
# include Hydra::Catalog
|
157
|
+
# CatalogController.solr_search_params_logic << :add_access_controls_to_solr_params
|
158
|
+
# end
|
159
|
+
def add_access_controls_to_solr_params(solr_parameters, user_parameters)
|
160
|
+
apply_gated_discovery(solr_parameters, user_parameters)
|
161
|
+
if !reader?
|
162
|
+
solr_parameters[:qt] = Blacklight.config[:public_qt]
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Contrller before filter that sets up access-controlled lucene query in order to provide gated discovery behavior
|
167
|
+
# @param solr_parameters the current solr parameters
|
168
|
+
# @param user_parameters the current user-subitted parameters
|
169
|
+
def apply_gated_discovery(solr_parameters, user_parameters)
|
170
|
+
# solr_parameters[:q] ||= []
|
171
|
+
solr_parameters[:q] = build_lucene_query(params[:q])
|
172
|
+
# @extra_controller_params ||= {}
|
173
|
+
# @extra_controller_params.merge!(:q=>build_lucene_query(params[:q]))
|
174
|
+
logger.debug("Solr query: #{ solr_parameters[:q] }")
|
175
|
+
end
|
176
|
+
|
177
|
+
# proxy for {enforce_index_permissions}
|
178
|
+
def enforce_search_permissions
|
179
|
+
enforce_index_permissions
|
180
|
+
end
|
181
|
+
|
182
|
+
# proxy for {enforce_show_permissions}
|
183
|
+
def enforce_read_permissions
|
184
|
+
enforce_show_permissions
|
185
|
+
end
|
186
|
+
|
187
|
+
# Build the lucene query that performs gated discovery based on Hydra rightsMetadata information in Solr
|
188
|
+
# @param [String] user_query the user's original query request that will be wrapped in access controls
|
189
|
+
def build_lucene_query(user_query)
|
190
|
+
q = ""
|
191
|
+
# start query of with user supplied query term
|
192
|
+
q << "_query_:\"{!dismax qf=$qf_dismax pf=$pf_dismax}#{user_query}\""
|
193
|
+
|
194
|
+
# Append the exclusion of FileAssets
|
195
|
+
q << " AND NOT _query_:\"info\\\\:fedora/afmodel\\\\:FileAsset\""
|
196
|
+
|
197
|
+
# Append the query responsible for adding the users discovery level
|
198
|
+
permission_types = ["edit","discover","read"]
|
199
|
+
field_queries = []
|
200
|
+
embargo_query = ""
|
201
|
+
permission_types.each do |type|
|
202
|
+
field_queries << "_query_:\"#{type}_access_group_t:public\""
|
203
|
+
end
|
204
|
+
|
205
|
+
unless current_user.nil?
|
206
|
+
# for roles
|
207
|
+
RoleMapper.roles(current_user.login).each do |role|
|
208
|
+
permission_types.each do |type|
|
209
|
+
field_queries << "_query_:\"#{type}_access_group_t:#{role}\""
|
210
|
+
end
|
211
|
+
end
|
212
|
+
# for individual person access
|
213
|
+
permission_types.each do |type|
|
214
|
+
field_queries << "_query_:\"#{type}_access_person_t:#{current_user.login}\""
|
215
|
+
end
|
216
|
+
if current_user.is_being_superuser?(session)
|
217
|
+
permission_types.each do |type|
|
218
|
+
field_queries << "_query_:\"#{type}_access_person_t:[* TO *]\""
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# if it is the depositor and it is under embargo, that is ok
|
223
|
+
# otherwise if it not the depositor and it is under embargo, don't show it
|
224
|
+
embargo_query = " OR ((_query_:\"embargo_release_date_dt:[NOW TO *]\" AND _query_:\"depositor_t:#{current_user.login}\") AND NOT (NOT _query_:\"depositor_t:#{current_user.login}\" AND _query_:\"embargo_release_date_dt:[NOW TO *]\"))"
|
225
|
+
end
|
226
|
+
|
227
|
+
# remove anything with an embargo release date in the future
|
228
|
+
#embargo_query = " AND NOT _query_:\"embargo_release_date_dt:[NOW TO *]\"" if embargo_query.blank?
|
229
|
+
field_queries << " NOT _query_:\"embargo_release_date_dt:[NOW TO *]\"" if embargo_query.blank?
|
230
|
+
|
231
|
+
q << " AND (#{field_queries.join(" OR ")})"
|
232
|
+
q << embargo_query
|
233
|
+
return q
|
234
|
+
end
|
235
|
+
|
236
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# Provides methods for testing permissions
|
2
|
+
# If you include this into a Controller, it will also make a number of these methods available as view helpers.
|
3
|
+
module Hydra::AccessControlsEvaluation
|
4
|
+
|
5
|
+
def self.included(klass)
|
6
|
+
if klass.respond_to?(:helper_method)
|
7
|
+
klass.helper_method(:editor?)
|
8
|
+
klass.helper_method(:reader?)
|
9
|
+
klass.helper_method(:test_permission?)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# Test the current user's permissions. This method is used by the editor? and reader? methods
|
14
|
+
# @param [Symbol] permission_type valid options: :edit, :read
|
15
|
+
# This is available as a view helper method as well as within your controllers.
|
16
|
+
# @example
|
17
|
+
# test_permission(:edit)
|
18
|
+
def test_permission(permission_type)
|
19
|
+
# if !current_user.nil?
|
20
|
+
if (@permissions_solr_document == nil)
|
21
|
+
logger.warn("SolrDocument is nil")
|
22
|
+
end
|
23
|
+
|
24
|
+
if current_user.nil?
|
25
|
+
user = "public"
|
26
|
+
logger.debug("current_user is nil, assigning public")
|
27
|
+
else
|
28
|
+
user = current_user.login
|
29
|
+
end
|
30
|
+
|
31
|
+
user_groups = RoleMapper.roles(user)
|
32
|
+
# everyone is automatically a member of the group 'public'
|
33
|
+
user_groups.push 'public' unless user_groups.include?('public')
|
34
|
+
# logged-in users are automatically members of the group "registered"
|
35
|
+
user_groups.push 'registered' unless (user == "public" || user_groups.include?('registered') )
|
36
|
+
|
37
|
+
logger.debug("User #{user} is a member of groups: #{user_groups.inspect}")
|
38
|
+
case permission_type
|
39
|
+
when :edit
|
40
|
+
logger.debug("Checking edit permissions for user: #{user}")
|
41
|
+
group_intersection = user_groups & edit_groups
|
42
|
+
result = !group_intersection.empty? || edit_persons.include?(user)
|
43
|
+
when :read
|
44
|
+
logger.debug("Checking read permissions for user: #{user}")
|
45
|
+
group_intersection = user_groups & read_groups
|
46
|
+
result = !group_intersection.empty? || read_persons.include?(user)
|
47
|
+
else
|
48
|
+
result = false
|
49
|
+
end
|
50
|
+
logger.debug("test_permission result: #{result}")
|
51
|
+
return result
|
52
|
+
# else
|
53
|
+
# logger.debug("nil user, test_permission returning false")
|
54
|
+
# return false
|
55
|
+
# end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Test whether the the current user has edit permissions.
|
59
|
+
# This is available as a view helper method as well as within your controllers.
|
60
|
+
def editor?
|
61
|
+
test_permission(:edit) or (current_user and current_user.is_being_superuser?(session))
|
62
|
+
end
|
63
|
+
|
64
|
+
# Test whether the the current user has read permissions.
|
65
|
+
# This is available as a view helper method as well as within your controllers.
|
66
|
+
def reader?
|
67
|
+
test_permission(:read) or (current_user and current_user.is_being_superuser?(session))
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
def edit_groups
|
72
|
+
eg = (@permissions_solr_document == nil || @permissions_solr_document['edit_access_group_t'] == nil) ? [] : @permissions_solr_document['edit_access_group_t']
|
73
|
+
logger.debug("edit_groups: #{eg.inspect}")
|
74
|
+
return eg
|
75
|
+
end
|
76
|
+
|
77
|
+
# edit implies read, so read_groups is the union of edit and read groups
|
78
|
+
def read_groups
|
79
|
+
rg = edit_groups | ((@permissions_solr_document == nil || @permissions_solr_document['read_access_group_t'] == nil) ? [] : @permissions_solr_document['read_access_group_t'])
|
80
|
+
logger.debug("read_groups: #{rg.inspect}")
|
81
|
+
return rg
|
82
|
+
end
|
83
|
+
|
84
|
+
def edit_persons
|
85
|
+
ep = (@permissions_solr_document == nil || @permissions_solr_document['edit_access_person_t'] == nil) ? [] : @permissions_solr_document['edit_access_person_t']
|
86
|
+
logger.debug("edit_persons: #{ep.inspect}")
|
87
|
+
return ep
|
88
|
+
end
|
89
|
+
|
90
|
+
# edit implies read, so read_persons is the union of edit and read persons
|
91
|
+
def read_persons
|
92
|
+
rp = edit_persons | ((@permissions_solr_document == nil || @permissions_solr_document['read_access_person_t'] == nil) ? [] : @permissions_solr_document['read_access_person_t'])
|
93
|
+
logger.debug("read_persons: #{rp.inspect}")
|
94
|
+
return rp
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|