hydra 6.2.0.rc1 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CONTRIBUTING.md +3 -0
- data/RELEASE-POLICY.md +40 -0
- data/doc/Configuring-solr-and-fedora.md +16 -0
- data/doc/Content-Type-Example:-Journal-Article.textile +735 -0
- data/doc/Dive-into-Hydra.md +62 -0
- data/doc/Filtering-search-results-with-hydra-access-controls.md +16 -0
- data/doc/For-Developers.md +47 -0
- data/doc/Home.md +33 -0
- data/doc/Lesson:-Define-Relationships-Between-Objects.md +127 -0
- data/doc/Lesson:-Generate-Rails-Scaffolding-for-Creating-and-Editing-Books.md +167 -0
- data/doc/Lesson:-Reading-Hydra-rightsMetadata-XML.md +87 -0
- data/doc/Lesson:-Use-Hydra-Access-Controls-to-Control-Access-to-Blacklight-show-Pages.md +37 -0
- data/doc/Lesson:-Using-Hydra-Access-Controls-and-CanCan-to-conditionally-render-part-of-a-page.md +29 -0
- data/doc/Lesson:-add-the-Hydra-dependencies.md +28 -0
- data/doc/Lesson:-adding-content-datastreams.md +60 -0
- data/doc/Lesson:-build-a-book-model.md +262 -0
- data/doc/Lesson:-create-a-git-repository.md +35 -0
- data/doc/Lesson:-generate-a-rails-application.md +53 -0
- data/doc/Lesson:-install-hydra-jetty.md +57 -0
- data/doc/Lesson:-make-blacklight-return-search-results.md +47 -0
- data/doc/Lesson:-run-the-Hydra-generator.md +39 -0
- data/doc/Lesson:-set-up-your-Rails-Application-to-use-rspec.md +41 -0
- data/doc/Lesson:-start-jetty.md +85 -0
- data/doc/Lesson:-start-the-application-&-search-for-results.md +43 -0
- data/doc/Lesson:-turn-off-access-controls.md +37 -0
- data/doc/Migrating-to-Hydra-6.2.md +12 -0
- data/doc/Migration-Notes.md +2 -0
- data/doc/Models---Defining-a-Custom-Hydra-Model.textile +198 -0
- data/doc/Rake-Tasks-in-Hydra-Head.textile +40 -0
- data/doc/Reference.textile +19 -0
- data/doc/Solr-Schema.rdoc +44 -0
- data/doc/Tools-for-Developing-and-Testing-your-Application.textile +69 -0
- data/doc/YOUR-Hydra-Application---Initial-Modifications.textile +357 -0
- data/lib/hydra/version.rb +1 -1
- metadata +35 -4
@@ -0,0 +1,35 @@
|
|
1
|
+
This lesson is known to work with hydra (gem) version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
Note: This lesson is basically equivalent to the [Create A New Git Repo](http://curriculum.railsbridge.org/curriculum/create_a_new_git_repo) step in the RailsBridge Curriculum.
|
5
|
+
|
6
|
+
# Goals
|
7
|
+
* Create a local git repository that will track all changes to this application's code
|
8
|
+
|
9
|
+
# Explanation
|
10
|
+
|
11
|
+
In order to track the changes you make to your code, to share your changes with others, and to pull other people's changes into your code, you need some form of Version Control. All of the Hydra projects use Git for version control and share their work on Github.
|
12
|
+
|
13
|
+
# Steps
|
14
|
+
|
15
|
+
Now, let's turn this directory into a git repository. Type the following:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$> git init .
|
19
|
+
```
|
20
|
+
|
21
|
+
Then you should see something like this:
|
22
|
+
|
23
|
+
```
|
24
|
+
Initialized empty Git repository in /Users/justin/hydra-demo/.git/
|
25
|
+
```
|
26
|
+
|
27
|
+
Next, we'll add all the files rails created into the repository. This way we can jump back to this state later if the need arises.
|
28
|
+
|
29
|
+
```bash
|
30
|
+
$> git add .
|
31
|
+
$> git commit -m "Initial rails application"
|
32
|
+
```
|
33
|
+
|
34
|
+
# Next Step
|
35
|
+
Go on to [[Lesson: Add the Hydra Dependencies]] or return to the [[Dive into Hydra]] page.
|
@@ -0,0 +1,53 @@
|
|
1
|
+
This lesson is known to work with hydra (gem) version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
* Create your new Ruby on Rails Application
|
6
|
+
|
7
|
+
# Explanation
|
8
|
+
|
9
|
+
**Note:** This lesson is basically equivalent to the [Getting Started](http://curriculum.railsbridge.org/curriculum/getting_started) step in the RailsBridge Curriculum.
|
10
|
+
|
11
|
+
This lesson assumes you are using a **3.2 or 4.0 version of rails**. To avoid confusion, it's better to have a clean gemset with only one version of rails installed. Most people use either [RVM](http://rvm.io) or [rbenv](https://github.com/sstephenson/rbenv) to handle gemsets and ruby versions.
|
12
|
+
|
13
|
+
The first step to creating a Hydra Head, or any other type of Rails Application, is to generate the basic skeleton of the application code.
|
14
|
+
|
15
|
+
# Steps
|
16
|
+
|
17
|
+
### Step 1: Create a new rails application
|
18
|
+
|
19
|
+
Once you have installed a suitable rails gem (any 3.2 or 4.0 release), begin by using it to generate a new rails application. You can choose any name for your application. In this tutorial we are calling it hydra-demo
|
20
|
+
|
21
|
+
```bash
|
22
|
+
$> rails new hydra-demo
|
23
|
+
```
|
24
|
+
|
25
|
+
This generates the file structure for an empty rails application. And it runs 'bundler' which loads in all of the external dependencies for rails.
|
26
|
+
|
27
|
+
Enter the directory for the new rails app: ```cd hydra-demo```, then you should see a file structure like this:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
$> ls
|
31
|
+
Gemfile Rakefile config.ru lib script vendor
|
32
|
+
Gemfile.lock app db log test
|
33
|
+
README.rdoc config doc public tmp
|
34
|
+
```
|
35
|
+
|
36
|
+
### Step 2: Set your Ruby version for this project
|
37
|
+
|
38
|
+
Create the file ```.ruby-version``` in your project's directory (hydra-demo). Put your Ruby's version inside that file. For example, if you're using ruby-2.0.0, your file would look like this:
|
39
|
+
|
40
|
+
```text
|
41
|
+
2.0.0
|
42
|
+
```
|
43
|
+
|
44
|
+
If you're using a Ruby environment manager such as RVM or rbenv, this will make it so you switch to the correct version of Ruby when you enter this directory.
|
45
|
+
|
46
|
+
> ### Linux only step: Enable javascript runtime
|
47
|
+
>
|
48
|
+
> Find the line in your Gemfile that has ```# gem 'therubyracer', :platforms => :ruby``` and uncomment that line. This allows your system to identify the appropriate javascript runtime.
|
49
|
+
>
|
50
|
+
> Now save the Gemfile and run ```bundle install```. This tells bundler to update your dependencies to reflect the change in your Gemfile.
|
51
|
+
|
52
|
+
# Next Step
|
53
|
+
Go on to [[Lesson: Create a git Repository]] or return to the [[Dive into Hydra]] page.
|
@@ -0,0 +1,57 @@
|
|
1
|
+
This lesson is known to work with hydra release version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
* Install a copy of hydra-jetty, which includes pre-configured copies of Fedora and Solr
|
6
|
+
|
7
|
+
# Explanation
|
8
|
+
In order to use blacklight and hydra-head, you need an installation of Solr. Additionally, hydra-head requires a copy of the Fedora repository. We have created a package called hydra-jetty, which provides both of these within a Jetty Java application server.
|
9
|
+
|
10
|
+
# Steps
|
11
|
+
|
12
|
+
|
13
|
+
### Step 1: Install the hydra-jetty package
|
14
|
+
|
15
|
+
Use the hydra:jetty generator to install the hydra-jetty package by running:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$> rails g hydra:jetty
|
19
|
+
```
|
20
|
+
|
21
|
+
This generator is provided by the jettywrapper gem.
|
22
|
+
|
23
|
+
|
24
|
+
This can be very slow (over 100Mb of download). When it's done you'll see the directory named ```jetty``` has been created. If you run '''git status''' you will see
|
25
|
+
|
26
|
+
```text
|
27
|
+
# On branch master
|
28
|
+
# Untracked files:
|
29
|
+
# (use "git add <file>..." to include in what will be committed)
|
30
|
+
#
|
31
|
+
# jetty/
|
32
|
+
```
|
33
|
+
|
34
|
+
**Windows Tip**: Currently this rake task doesn't work on Windows (see [jettywrapper issue #14](https://github.com/projecthydra/jettywrapper/issues/14) for status). Workaround: Download https://github.com/projecthydra/hydra-jetty/archive/new-solr-schema.zip, unpack it, and move the unpacked 'jetty' directory to the root of your application.
|
35
|
+
|
36
|
+
### Step 2: Make git ignore the jetty directory
|
37
|
+
|
38
|
+
We want git to ignore the jetty directory for the same reasons that we don't check our development databases into git -- because it's big and bulky and you don't actually need other developers to have exact copies of your jetty as long as they have all the other code.
|
39
|
+
|
40
|
+
We do that by editing ```.gitignore``` and adding the something like this:
|
41
|
+
|
42
|
+
```text
|
43
|
+
# Ignore jetty directory (from hydra-jetty)
|
44
|
+
/jetty
|
45
|
+
|
46
|
+
```
|
47
|
+
|
48
|
+
Now commit this change
|
49
|
+
|
50
|
+
```
|
51
|
+
git add .gitignore
|
52
|
+
git commit -m "Adds /jetty to .gitignore"
|
53
|
+
```
|
54
|
+
|
55
|
+
|
56
|
+
# Next Step
|
57
|
+
Go on to [[Lesson: Start Jetty]] or return to the [[Dive into Hydra]] page.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
This lesson is known to work with hydra version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
* Tell Blacklight which fields to use in searches
|
6
|
+
* Run a search in Blacklight and see results rendered
|
7
|
+
|
8
|
+
# Explanation
|
9
|
+
|
10
|
+
In [[Lesson: Build a Book Model]] you made a Book object, saved it, and saw that the Book's metadata was indexed in Solr. Now we will make that Book appear in your Blacklight searches.
|
11
|
+
|
12
|
+
# Steps
|
13
|
+
|
14
|
+
### Step 1: Run a search in the CatalogController
|
15
|
+
|
16
|
+
Visit or reload the page at [[http://localhost:3000/]]. You should see the Blacklight search interface with a search box. If you search for 'Anna' you don't see any results even though we created a Book called "Anna Karenina" and indexed it in Solr in the last lesson.
|
17
|
+
|
18
|
+
### Step 2: Tell Blacklight which fields to use in Queries
|
19
|
+
|
20
|
+
The reason why we're not getting any hits is because we haven't told Blacklight which fields to search in. Let's fix that by setting the default 'qf' solr parameter. Open `app/controllers/catalog_controller.rb` and set the `default_solr_params` section (around line 18) to this:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
config.default_solr_params = {
|
24
|
+
:qf => 'title_tesim author_tesim',
|
25
|
+
:qt => 'search',
|
26
|
+
:rows => 10
|
27
|
+
}
|
28
|
+
```
|
29
|
+
|
30
|
+
### Step 3: Re-run your search
|
31
|
+
|
32
|
+
Save the file, and refresh your web browser. You should now see a result for "Anna Karenina" when you search for "Anna"
|
33
|
+
|
34
|
+
**Tip:** When you make changes like this, you *don't* need to restart the Rails server. This is because in development mode (which is the default environment for the Rails server), the Rails server reloads any files in app/models, app/controllers, app/views, etc. for every request it receives from a browser. This makes the server slower, but it makes life much smoother when you're actively developing and making changes.
|
35
|
+
|
36
|
+
### Step 4: Commit your changes
|
37
|
+
|
38
|
+
Now that we've updated our search functionality, it's a great time to commit to git:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
$> git add .
|
42
|
+
$> git commit -m "Disabled access controls and set default search fields"
|
43
|
+
```
|
44
|
+
|
45
|
+
# Next Step
|
46
|
+
Go on to [[Lesson: Define Relationships Between Objects]] or
|
47
|
+
explore other [Dive into Hydra](Dive into Hydra#Bonus) tutorial bonus lessons.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
This lesson is known to work with hydra version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
* Add Hydra (Hydra, Blacklight, and Devise) functionality to your Rails Application
|
6
|
+
|
7
|
+
# Explanation
|
8
|
+
|
9
|
+
Hydra builds on and extends the features provided by Blacklight, the generator integrates core hydra and blacklight functionality into your application. To do this, we run the custom [Rails generator](http://guides.rubyonrails.org/generators.html) provided by the hydra gem. The generator creates a number of files in your application that will allow you to build a Hydra application and use and modify Blacklight's features in your application. The default generator also installs [devise](https://github.com/plataformatec/devise) to provide simple user authentication and management.
|
10
|
+
|
11
|
+
**Tip:** If you want to see clearly what changes that the generator has made, make sure that before you run the generator all of your current changes have been checked into git -- so before running the generator running 'git status' should report that there are no changes ("nothing to commit"). Then when you run the generator you will be able to see all of the changes it's made by runing 'git status'.
|
12
|
+
|
13
|
+
# Steps
|
14
|
+
|
15
|
+
**Note:** You must have completed the steps in [[Lesson: Add the Hydra Dependencies]] in order for the following steps to work.
|
16
|
+
|
17
|
+
|
18
|
+
### Step 1: Run the code generator provided by the Hydra gem.
|
19
|
+
|
20
|
+
We do this by typing
|
21
|
+
|
22
|
+
```bash
|
23
|
+
$> rails generate hydra:install
|
24
|
+
```
|
25
|
+
|
26
|
+
The hydra generator invokes both the blacklight generator and the hydra-head generator. Additionally, the blacklight generator installed the devise gem and the bootstrap gem. It's created an important file in our application `app/controllers/catalog_controller.rb`. This is the primary place where you configure the blacklight search.
|
27
|
+
|
28
|
+
When they are done, the generators have created a few database migrations that support saving user data, searches and bookmarks. Normally you would have to run `rake db:migrate` to update your database tables, but the hydra installer does this for you as one of its last steps.
|
29
|
+
|
30
|
+
### Step 2: Commit your changes
|
31
|
+
At this point it's a good idea to commit the changes:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
$> git add .
|
35
|
+
$> git commit -m "Ran hydra generator"
|
36
|
+
```
|
37
|
+
|
38
|
+
# Next Step
|
39
|
+
Go on to [[Lesson: Install hydra-jetty]] or return to the [[Dive into Hydra]] page.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
This Tutorial is known to work with hydra version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
|
6
|
+
* Set up a Rails application to use RSpec
|
7
|
+
|
8
|
+
# Explanation
|
9
|
+
We strongly recommend building a habit of using Test Driven Development. Most people using Hydra use RSpec for Test Driven Development. Also, RSpec tests are required with any contributions to any of the core Hydra gems. Here's how to set up your Rails application to use RSpec for testing.
|
10
|
+
|
11
|
+
# Steps
|
12
|
+
|
13
|
+
### Step 1: Install the rspec and rspec-rails gems
|
14
|
+
|
15
|
+
Ensure your Gemfile includes `rspec-rails`, e.g.:
|
16
|
+
```ruby
|
17
|
+
group :development, :test do
|
18
|
+
gem "rspec-rails"
|
19
|
+
end
|
20
|
+
```
|
21
|
+
If you had to add `rspec-rails`, run bundle install
|
22
|
+
```bash
|
23
|
+
$ bundle install
|
24
|
+
```
|
25
|
+
|
26
|
+
### Step 2: Run the rspec rails generator
|
27
|
+
|
28
|
+
On the Command line
|
29
|
+
```text
|
30
|
+
rails generate rspec:install
|
31
|
+
```
|
32
|
+
|
33
|
+
### Step 3: Commit your changes
|
34
|
+
|
35
|
+
```text
|
36
|
+
git add .
|
37
|
+
git commit -m"added rspec"
|
38
|
+
```
|
39
|
+
|
40
|
+
# Next Steps
|
41
|
+
Return to the [[Dive into Hydra]] page.
|
@@ -0,0 +1,85 @@
|
|
1
|
+
This lesson is known to work with hydra release version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
* Start and Stop Jetty (which contains Fedora and Solr)
|
6
|
+
|
7
|
+
# Explanation
|
8
|
+
Fedora and Solr are both Java web applications that need to run in a servlet container like Tomcat or Jetty. We installed hydra-jetty in the [[Lesson: Install hydra-jetty]]. Now whenever you need Fedora and Solr running, just start or stop that copy of hydra-jetty.
|
9
|
+
|
10
|
+
**Tip:** Sometimes people are confused about whether they need to restart jetty when they restart their Rails application. In most cases it is fine to leave jetty running when you start, stop, and restart the Rails application. The only exception is when you make changes to Solr's configuration or Fedora's configuration -- these would be changes to files inside of your copy of hydra-jetty (ie. jetty/solr/config), not changes to files in your Rails application's Ruby code. In those cases, where you have made changes to Solr or Fedora's configuration, you need to restart Jetty in order for those changes to take effect. The most common change that requires restarting jetty is when you modify the solrconfig.xml or schema.xml in your solr config directory.
|
11
|
+
|
12
|
+
# Steps
|
13
|
+
|
14
|
+
### Step 1: Start Jetty
|
15
|
+
At the project root, type
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$> rake jetty:start
|
19
|
+
```
|
20
|
+
|
21
|
+
You should see output like this:
|
22
|
+
|
23
|
+
```text
|
24
|
+
Starting jetty with these values:
|
25
|
+
jetty_home: /Users/justin/hydra-demo/jetty
|
26
|
+
jetty_command: java -Djetty.port=8983 -Dsolr.solr.home=/Users/justin/hydra-demo/jetty/solr -Xmx256m -XX:MaxPermSize=128m -jar start.jar
|
27
|
+
Logging jettywrapper stdout to /Users/justin/hydra-demo/jetty/jettywrapper.log
|
28
|
+
Wrote pid file to /Users/justin/hydra-demo/tmp/pids/_Users_justin_hydra-demo_jetty.pid with value 8315
|
29
|
+
Waited 5 seconds for jetty to start, but it is not yet listening on port 8983. Continuing anyway.
|
30
|
+
Started jetty (5575.9ms)
|
31
|
+
```
|
32
|
+
|
33
|
+
hydra-jetty has a fair amount of stuff in it, so it may take up to a minute to start. You can check to see if it's started by going to [[http://localhost:8983/solr]]
|
34
|
+
|
35
|
+
If Fedora, Solr, or jetty itself are not starting, you'll want to look at the jettywrapper log to diagnose.
|
36
|
+
|
37
|
+
**Windows Tip:* This rake task is not currently working on Windows (see [jettywrapper issue #13](https://github.com/projecthydra/jettywrapper/issues/13) for status). In the meantime, start jetty manually
|
38
|
+
```
|
39
|
+
cd jetty
|
40
|
+
java -Djetty.port=8983 -Dsolr.solr.home=/Users/justin/hydra-demo/jetty/solr -Xmx256m -XX:MaxPermSize=128m -jar start.jar
|
41
|
+
```
|
42
|
+
|
43
|
+
### Step 2: Look at the jettywrapper log
|
44
|
+
|
45
|
+
The jetty:start rake task runs jetty as a background job, so jetty's logs won't appear in your terminal. Instead they're written to the file ```jetty/jettywrapper.log```. If you look at the output from running the jetty:start task, you'll see that one line gives you the full path to the file, for example:
|
46
|
+
|
47
|
+
```text
|
48
|
+
Logging jettywrapper stdout to /Users/justin/hydra-demo/jetty/jettywrapper.log
|
49
|
+
```
|
50
|
+
|
51
|
+
You can open this log file with any text editor or log reader.
|
52
|
+
|
53
|
+
```bash
|
54
|
+
$> vi jetty/jettywrapper.log
|
55
|
+
```
|
56
|
+
|
57
|
+
### Step 3: Monitor the jettywrapper log
|
58
|
+
|
59
|
+
|
60
|
+
**Tip:** if jetty is taking a long time to start, you can watch its output using the tail command with the path to your jettywrapper.log. For example:
|
61
|
+
|
62
|
+
```bash
|
63
|
+
$> tail -f jetty/jettywrapper.log
|
64
|
+
```
|
65
|
+
|
66
|
+
As Jetty, Fedora, and Solr start you will see more info being written to the log file. After a few moments you will be able to open jetty at [[http://localhost:8983]] or [[http://0.0.0.0:8983]] (**note:** The root page will give a 404 error, but should have three links to the applications running in Jetty: /solr, /fedora and /fedora-test)
|
67
|
+
|
68
|
+
### Step 4: Stop Jetty
|
69
|
+
You might have guessed this one. In order to stop jetty, at the project root, type
|
70
|
+
|
71
|
+
```bash
|
72
|
+
$> rake jetty:stop
|
73
|
+
```
|
74
|
+
|
75
|
+
### Step 5: Start Jetty again
|
76
|
+
Before proceeding to the next step, make sure jetty is running. If you're not sure whether it's running, go to http://localhost:8983. If jetty is running a page will load. If jetty is not running no page will load.
|
77
|
+
|
78
|
+
If it's not running, just use the jetty:start rake task again.
|
79
|
+
|
80
|
+
```bash
|
81
|
+
$> rake jetty:start
|
82
|
+
```
|
83
|
+
|
84
|
+
# Next Step
|
85
|
+
Go on to [[Lesson: Start the Application & Search for Results]] or return to the [[Dive into Hydra]] page.
|
@@ -0,0 +1,43 @@
|
|
1
|
+
This lesson is known to work with hydra release version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
* Start and Stop a local "development" copy of the application
|
6
|
+
* Remove the default Welcome page provided by Rails
|
7
|
+
* Run a Search in Blacklight through your browser
|
8
|
+
|
9
|
+
# Steps
|
10
|
+
|
11
|
+
### Step 1: Start the Rails server
|
12
|
+
|
13
|
+
Now, let's see our model on the web. You can start 'webrick', a development server that comes with rails by typing:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$> rails server
|
17
|
+
```
|
18
|
+
|
19
|
+
Leave that terminal window open. It will print info whenever the server does anything. You will return to this window when you want to stop or restart the server.
|
20
|
+
|
21
|
+
### Step 2: Look at the application in your Browser
|
22
|
+
|
23
|
+
Now you can visit your local copy of the application with a web browser when you point the browser at [[http://localhost:3000/]]
|
24
|
+
|
25
|
+
> ####Rails 3-only step: Remove the Rails default "Welcome" page
|
26
|
+
>
|
27
|
+
> If it worked you should see a page with the text: "Welcome aboard. You’re riding Ruby on Rails!". This is the default page, but now that we know it works, we can delete it. In Rails 4 you will **NOT** see the default rails welcome page and you can proceed to the 'Run a Search' step.
|
28
|
+
>
|
29
|
+
> Open a new terminal (so we can keep the server running) and type:
|
30
|
+
>
|
31
|
+
> ```bash
|
32
|
+
> $> rm public/index.html
|
33
|
+
> ```
|
34
|
+
> Then reload the page at [[http://localhost:3000/]].
|
35
|
+
|
36
|
+
### Step 3: Run a Search
|
37
|
+
|
38
|
+
Now that you've removed the default "Welcome" page and reloaded the page in your browser, you should see something that looks like a default Blacklight install. If you enter a search query you don't see any results because we haven't created any objects yet -- your Solr index is empty.
|
39
|
+
|
40
|
+
In the next step we will create a Book object that will then show up in your search results.
|
41
|
+
|
42
|
+
# Next Step
|
43
|
+
Go on to [[Lesson: Build a Book Model]] or return to the [[Dive into Hydra]] page.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
This lesson is known to work with hydra version 6.1.0.
|
2
|
+
_Please update this wiki to reflect any other versions that have been tested._
|
3
|
+
|
4
|
+
# Goals
|
5
|
+
* *(for now)* Turn off access controls for Blacklight-based searches and "show" views
|
6
|
+
|
7
|
+
# Explanation
|
8
|
+
One of the main features that Hydra adds to Blacklight is the ability to control who has access to which information in search results. That topic gets a little bit complicated. For the purpose of this Tutorial we want to stay focused on showing you how to set up an app, define models and create objects based on those models, so in order to keep things simple we will make this Hydra Head behave like an open access repository where everyone can see everything. Once you've completed this tutorial, you can check out [Access Controls with Hydra](https://github.com/projecthydra/hydra-head/wiki/Access-Controls-with-Hydra) to learn how to assert access controls on objects and enforce those access controls in a Hydra Head.
|
9
|
+
|
10
|
+
# Steps
|
11
|
+
|
12
|
+
### Step 1: Comment out the lines that enforce access controls in Blacklight's CatalogController
|
13
|
+
|
14
|
+
If you open ```app/controllers/catalog_controller.rb``` and look at the code near lines 8-12 you should see this:
|
15
|
+
```ruby
|
16
|
+
# These before_filters apply the hydra access controls
|
17
|
+
before_filter :enforce_show_permissions, :only=>:show
|
18
|
+
# This applies appropriate access controls to all solr queries
|
19
|
+
CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
20
|
+
```
|
21
|
+
|
22
|
+
This code tells blacklight to enforce access controls on the search and result view pages. For the time being we will turn this off by commenting out two lines so that it looks like this:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
# These before_filters apply the hydra access controls
|
26
|
+
#before_filter :enforce_show_permissions, :only=>:show
|
27
|
+
# This applies appropriate access controls to all solr queries
|
28
|
+
#CatalogController.solr_search_params_logic += [:add_access_controls_to_solr_params]
|
29
|
+
```
|
30
|
+
|
31
|
+
### Step 2: Save the file
|
32
|
+
|
33
|
+
Then, save the file.
|
34
|
+
|
35
|
+
|
36
|
+
# Next Step
|
37
|
+
Go on to [[Lesson: Make Blacklight Return Search Results]] or return to the [[Dive into Hydra]] page.
|