diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml new file mode 100644 index 0000000..9e2b3fa --- /dev/null +++ b/.github/workflows/build-main.yml @@ -0,0 +1,27 @@ +name: Build latest from main and deploy to staging + +on: + workflow_run: + workflows: ['Run Tests'] + branches: ['main'] + types: [completed] + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: hathitrust/github_actions/build@v1 + with: + image: ghcr.io/${{ github.repository }}-unstable + dockerfile: Dockerfile.prod + tag: ${{ github.sha }} + push_latest: true + registry_token: ${{ github.token }} + +# TODO: automate deployment w/ argocd +# for now - update image in +# https://github.com/hathitrust/ht_tanka/blob/main/environments/rights_api/staging/main.jsonnet diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml new file mode 100644 index 0000000..933e811 --- /dev/null +++ b/.github/workflows/tag-release.yml @@ -0,0 +1,17 @@ +--- +name: Docker Tag Latest Release + +on: + release: + types: [released] + +jobs: + tag-release: + runs-on: ubuntu-latest + steps: + - uses: hathitrust/github_actions/tag-release@v1 + with: + registry_token: ${{ github.token }} + existing_tag: ghcr.io/${{ github.repository }}-unstable:${{ github.sha }} + image: ghcr.io/${{ github.repository }} + new_tag: ${{ github.event.release.tag_name }} diff --git a/Dockerfile b/Dockerfile index c8e22d2..33cee38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,9 @@ -FROM ruby:3.1 +FROM ruby:3.2 ARG UNAME=app ARG UID=1000 ARG GID=1000 RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \ - libxerces-c-samples \ netcat-traditional # COPY Gemfile* /usr/src/app/ @@ -15,8 +14,3 @@ ENV BUNDLE_PATH /gems RUN gem install bundler RUN wget -O /usr/local/bin/wait-for https://github.com/eficode/wait-for/releases/download/v2.2.3/wait-for; chmod +x /usr/local/bin/wait-for - - - -# -# COPY . /usr/src/app diff --git a/Dockerfile.prod b/Dockerfile.prod new file mode 100644 index 0000000..86fec89 --- /dev/null +++ b/Dockerfile.prod @@ -0,0 +1,18 @@ +FROM ruby:3.2 +ARG UNAME=app +ARG UID=1000 +ARG GID=1000 + +RUN gem install bundler +RUN groupadd -g $GID -o $UNAME +RUN useradd -m -d /usr/src/app -u $UID -g $GID -o -s /bin/bash $UNAME +RUN mkdir -p /gems && chown $UID:$GID /gems +USER $UNAME +COPY --chown=$UID:$GID Gemfile* /usr/src/app/ +WORKDIR /usr/src/app +ENV BUNDLE_PATH /gems +ENV APP_ENV production +RUN bundle install +COPY --chown=$UID:$GID . /usr/src/app + +CMD ["bundle", "exec", "ruby", "lib/rights_api/app.rb", "-o", "0.0.0.0"] diff --git a/Gemfile.lock b/Gemfile.lock index 40a986a..22a50b0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -26,13 +26,13 @@ GEM mysql2 (0.5.5) nio4r (2.5.9) parallel (1.23.0) - parser (3.2.2.3) + parser (3.2.2.4) ast (~> 2.4.1) racc pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - puma (6.3.1) + puma (6.4.0) nio4r (~> 2.0) racc (1.7.1) rack (2.2.8) @@ -41,7 +41,7 @@ GEM rack-test (2.1.0) rack (>= 1.3) rainbow (3.1.1) - regexp_parser (2.8.1) + regexp_parser (2.8.2) rexml (3.2.6) rspec (3.12.0) rspec-core (~> 3.12.0) @@ -56,7 +56,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.1) - rubocop (1.56.2) + rubocop (1.56.4) base64 (~> 0.1.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -70,12 +70,12 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.29.0) parser (>= 3.2.1.0) - rubocop-performance (1.19.0) + rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - sequel (5.72.0) + sequel (5.73.0) bigdecimal simplecov (0.22.0) docile (~> 1.1) @@ -95,20 +95,20 @@ GEM rack-protection (= 3.1.0) sinatra (= 3.1.0) tilt (~> 2.0) - standard (1.31.0) + standard (1.31.2) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.56.0) + rubocop (~> 1.56.4) standard-custom (~> 1.0.0) standard-performance (~> 1.2) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.2.0) + standard-performance (1.2.1) lint_roller (~> 1.1) - rubocop-performance (~> 1.19.0) - tilt (2.2.0) - unicode-display_width (2.4.2) + rubocop-performance (~> 1.19.1) + tilt (2.3.0) + unicode-display_width (2.5.0) PLATFORMS aarch64-linux diff --git a/README.md b/README.md index 3558023..df0f82d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ ```bash git clone https://github.com/hathitrust/rights_api docker-compose build +docker-compose run --rm web bundle install docker-compose up ``` @@ -11,16 +12,16 @@ docker-compose up Visit `http://localhost:4567/` for a usage summary. ``` -http://localhost:4567/attributes -http://localhost:4567/reasons -http://localhost:4567/rights?htid=test.und_open - +http://localhost:4567/v1/attributes +http://localhost:4567/v1/reasons +http://localhost:4567/v1/rights/test.und_open +http://localhost:4567/v1/rights_log/test.und_open ``` +See `lib/rights_api/app.rb` for all of the Sinatra routes. ## TODO -- `rights_log` queries (requires changes to the rights_database gem) -- `db-image` seeds for `rights_log` (currently empty) +- Remove last vestiges of rights_database gem - `/rights?...` query parameters other than HTID (dates, for example) +- `/rights_log?...` query parameters other than HTID (dates, for example) - Results paging -- Add versioning to API routes -- Think carefully about exposing `rights_current.user` and `rights_current.note` in a public API + diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..dd91c41 --- /dev/null +++ b/config.ru @@ -0,0 +1,2 @@ +require "./lib/rights_api/app" +run RightsAPI::App diff --git a/docker-compose.yml b/docker-compose.yml index a96f4ba..4e7fca9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,12 +10,10 @@ services: volumes: - .:/usr/src/app - gem_cache:/gems - command: bundle exec ruby rights_api.rb -o 0.0.0.0 + command: bundle exec rackup --host 0.0.0.0 -p 4567 environment: -# SOLR_URL: http://solr-sdr-catalog:9033/solr/catalog RIGHTS_DATABASE_CONNECTION_STRING: "mysql2://ht_rights:ht_rights@mariadb/ht" depends_on: -# - solr-sdr-catalog - mariadb test: @@ -25,19 +23,14 @@ services: - gem_cache:/gems command: bash -c "/usr/local/bin/wait-for mariadb:3306 && bundle exec rspec" environment: -# SOLR_URL: http://solr-sdr-catalog:9033/solr/catalog RIGHTS_DATABASE_CONNECTION_STRING: "mysql2://ht_rights:ht_rights@mariadb/ht" depends_on: -# - solr-sdr-catalog - mariadb -# solr-sdr-catalog: -# image: ghcr.io/hathitrust/catalog-solr-sample -# ports: -# - "9033:9033" - mariadb: image: ghcr.io/hathitrust/db-image + volumes: + - ./sql/100_rights_log.sql:/docker-entrypoint-initdb.d/100_rights_log.sql restart: always environment: MYSQL_RANDOM_ROOT_PASSWORD: 1 diff --git a/lib/rights_api/app.rb b/lib/rights_api/app.rb new file mode 100644 index 0000000..9ebbb40 --- /dev/null +++ b/lib/rights_api/app.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require "sinatra" +require "sinatra/json" +require "sinatra/reloader" if development? + +require_relative "query" + +module RightsAPI + class App < Sinatra::Base + USAGE = <<~END_USAGE + API_URL => this usage summary + API_URL/access_profiles => contents of the access_profiles table + API_URL/access_profiles/1 => access_profile entry with id=1 + API_URL/access_statements => contents of the access_stmts table + API_URL/access_statements/pd => access_stmts entry with stmt_key=pd + API_URL/attributes => contents of the attributes table + API_URL/attributes/1 => attributes entry with id=1 + API_URL/reasons => contents of the reasons table + API_URL/reasons/1 => reasons entry with id=1 + API_URL/rights/HTID => query rights_current for current rights on HTID + API_URL/rights_log/HTID => query rights_current for rights history on HTID + END_USAGE + + STANDARD_TABLES = %w[attributes access_profiles access_statements reasons sources] + + # Redirect to the current version + get "/" do + redirect(request.url + "v1/") + end + + get "/v1/?" do + json({usage: USAGE}) + end + + get "/v1/rights/:htid" do |htid| + json RightsAPI.rights(htid) + end + + get "/v1/rights_log/:htid" do |htid| + json RightsAPI.rights_log(htid) + end + + # The "all" queries for most tables + STANDARD_TABLES.each do |name| + get "/v1/#{name}/?" do + json(RightsAPI.send(name.to_sym)) + end + end + + # The "by id" queries for most tables + STANDARD_TABLES.each do |name| + get "/v1/#{name}/:id" do |id| + data = (RightsAPI.send name.to_sym)[hash_key(name: name, key: id)] + data = {} if data.nil? + json data + end + end + + private + + # Most tables have integer primary keys, but access_stmts is indexed by string + def hash_key(name:, key:) + (name == "access_statements") ? key.to_s : key.to_i + end + end +end diff --git a/lib/rights_api/query.rb b/lib/rights_api/query.rb new file mode 100644 index 0000000..873a779 --- /dev/null +++ b/lib/rights_api/query.rb @@ -0,0 +1,68 @@ +# frozen_string_literal: true + +require_relative "services" + +module RightsAPI + def access_statements + @access_statements ||= db_connection[:access_stmts].to_hash(:stmt_key) + end + + def access_profiles + @access_profiles ||= db_connection[:access_profiles].to_hash(:id) + end + + def attributes + @attributes ||= db_connection[:attributes].to_hash(:id) + end + + def reasons + @reasons ||= db_connection[:reasons].to_hash(:id) + end + + def rights(htid) + rights_query(htid: htid, table: :rights_current) + end + + def rights_log(htid) + rights_query(htid: htid, table: :rights_log) + end + + def sources + @sources ||= db_connection[:sources].to_hash(:id) + end + + module_function :access_profiles, :access_statements, :attributes, :reasons, + :rights, :rights_log, :sources + + private + + def db_connection + Services[:rights_database].db + end + + # Common code for querying rights or rights_log and returning results + def rights_query(htid:, table:) + namespace, id = htid.split(".", 2) + result = [] + db_connection[table] + .where(:namespace => namespace, Sequel.qualify(table, :id) => id) + .order(:time) + .each do |entry| + result << + { + htid: entry[:namespace] + "." + entry[:id], + namespace: entry[:namespace], + id: entry[:id], + attribute: entry[:attr], + reason: entry[:reason], + source: entry[:source], + access_profile: entry[:access_profile], + time: entry[:time] + } + # Keep note and user out of structure for public API + end + result + end + + module_function :db_connection, :rights_query +end diff --git a/lib/rights_api/rights_api.rb b/lib/rights_api/rights_api.rb deleted file mode 100644 index 2124f17..0000000 --- a/lib/rights_api/rights_api.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require_relative "rights_database_query" -require_relative "services" -require_relative "settings" -require_relative "version" diff --git a/lib/rights_api/rights_database_query.rb b/lib/rights_api/rights_database_query.rb deleted file mode 100644 index 14ff493..0000000 --- a/lib/rights_api/rights_database_query.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -require "rights_database" -require_relative "services" - -module RightsAPI - def access_profiles - @attributes ||= db_connection[:access_profiles].to_hash(:id) - end - - def attributes - @attributes ||= db_connection[:attributes].to_hash(:id) - end - - def reasons - @reasons ||= db_connection[:reasons].to_hash(:id) - end - - # FIXME: rights_database needs a to_h for Rights objects - # FIXME: db-image could use seeds for rights_log maybe based on rights_current - # but with an initial ic/bib entry. - def rights(htid) - entry = RightsAPI::Services[:rights_database]::Rights.new(item_id: htid) - {item_id: entry.item_id, - htid: entry.item_id, - namespace: entry.namespace, - id: entry.id, - attribute_id: entry.attribute.id, - attribute_name: entry.attribute.name, - reason_id: entry.reason.id, - reason_name: entry.reason.name, - source_id: entry.source.id, - source_name: entry.source.name, - access_profile_id: entry.access_profile.id, - access_profile_name: entry.access_profile.name, - time: entry.time, - note: entry.note, - user: entry.user} - end - - def sources - @sources ||= db_connection[:sources].to_hash(:id) - end - - module_function :access_profiles, :attributes, :reasons, :rights, :sources - - private - - def db_connection - Services[:rights_database]::DB.connection - end - - module_function :db_connection -end diff --git a/lib/rights_api/services.rb b/lib/rights_api/services.rb index 341426f..bf0b1af 100644 --- a/lib/rights_api/services.rb +++ b/lib/rights_api/services.rb @@ -1,22 +1,11 @@ # frozen_string_literal: true -# require "oai_solr/settings" require "canister" +require "rights_database" module RightsAPI Services = Canister.new - - # Services.register(:sets) do - # Settings.sets.map { |k, v| [k.to_s, OAISolr::RestrictedSet.new(k.to_s, v)] }.to_h - # end - Services.register(:rights_database) do RightsDatabase end - - # Services.register(:access_profiles) do - # RightsDatabase::DB.connection[:ht_collection_digitizers] - # .map { |v| [[v[:collection], v[:digitization_source]], v[:access_profile]] } - # .to_h - # end end diff --git a/lib/rights_api/version.rb b/lib/rights_api/version.rb deleted file mode 100644 index cf655dd..0000000 --- a/lib/rights_api/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -module RightsAPI - VERSION = "0.0.1" -end diff --git a/rights_api.rb b/rights_api.rb deleted file mode 100644 index b092826..0000000 --- a/rights_api.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -$LOAD_PATH << "./lib" -# require "canister" -require "rights_api/rights_api" -require "sinatra" -require "sinatra/json" -require "sinatra/reloader" if development? - -USAGE = <<~END_USAGE - API_URL => this usage summary - API_URL/access_profiles => contents of the access_profiles table - API_URL/attributes => contents of the attributes table - API_URL/reasons => contents of the reasons table - API_URL/rights?htid=HTID => query rights_current for current rights on HTID -END_USAGE - -get "/" do - json({usage: USAGE}) -end - -get "/access_profiles" do - json RightsAPI.access_profiles -end - -get "/attributes" do - json RightsAPI.attributes -end - -get "/reasons" do - json RightsAPI.reasons -end - -get "/rights" do - htid = params[:htid] - return 400 if htid.nil? - - json(RightsAPI.rights(htid)) -end - -get "/sources" do - json RightsAPI.sources -end - -get "/version" do - json({version: RightsAPI::VERSION}) -end diff --git a/spec/rights_api_spec.rb b/spec/rights_api_spec.rb index 124633b..360dbba 100644 --- a/spec/rights_api_spec.rb +++ b/spec/rights_api_spec.rb @@ -1,12 +1,10 @@ require "spec_helper" require "rack/test" -# require "nokogiri" -# require "set" RSpec.describe "RightsAPI" do include Rack::Test::Methods - let(:rights_api_endpoint) { "/" } + let(:rights_api_endpoint) { "/v1/" } def valid_json?(json) JSON.parse(json) @@ -15,68 +13,112 @@ def valid_json?(json) false end - shared_examples "valid Rights API response" do - it "returns ok" do + shared_examples "valid response" do + it "returns valid JSON with no error" do expect(last_response).to be_ok - end - - it "returns JSON" do expect(last_response.content_type).to eq("application/json") + expect(valid_json?(last_response.body)).to be true end + end - it "returns valid JSON" do + shared_examples "empty response" do + it "returns empty JSON with no error" do + expect(last_response).to be_ok + expect(last_response.content_type).to eq("application/json") expect(valid_json?(last_response.body)).to be true + expect(JSON.parse(last_response.body).count).to eq(0) end end - shared_examples "Rights API 400 response" do - it "does not return ok" do + shared_examples "404 response" do + it "returns an HTTP 404 response" do expect(last_response).not_to be_ok + expect(last_response.status).to eq 404 end + end - it "returns 400" do - expect(last_response.status).to eq 400 + # rights and rights_log responses are arrays rather than hashes + shared_examples "rights response" do + it "returns an array" do + expect(JSON.parse(last_response.body)).to be_an_instance_of(Array) end end describe "/" do before(:each) { get rights_api_endpoint } - it_behaves_like "valid Rights API response" + it_behaves_like "valid response" it "has usage summary" do expect(JSON.parse(last_response.body)["usage"]).not_to be_nil end end - describe "/attributes" do - before(:each) { get(rights_api_endpoint + "attributes") } - it_behaves_like "valid Rights API response" + describe "/ redirect" do + before(:each) { get "/" } + + it "redirects to current version" do + expect(last_response.status).to eq 302 + expect(last_response.location).to match(/v1/) + end end - describe "/access_profiles" do - before(:each) { get(rights_api_endpoint + "access_profiles") } - it_behaves_like "valid Rights API response" + RightsAPI::App::STANDARD_TABLES.each do |table| + describe "/#{table}" do + before(:each) { get(rights_api_endpoint + table) } + it_behaves_like "valid response" + end end - describe "/reasons" do - before(:each) { get(rights_api_endpoint + "reasons") } - it_behaves_like "valid Rights API response" + RightsAPI::App::STANDARD_TABLES.each do |table| + describe "/#{table}/:id" do + context "with a valid identifier" do + identifier = (table == "access_statements") ? "pd" : "1" + before(:each) { get(rights_api_endpoint + table + "/#{identifier}") } + it_behaves_like "valid response" + end + + context "with an invalid identifier" do + before(:each) { get(rights_api_endpoint + table + "/no_such_id") } + it_behaves_like "empty response" + end + end end describe "/rights" do context "with a valid HTID" do - before(:each) { get(rights_api_endpoint + "rights", {htid: "test.pd_google"}) } - it_behaves_like "valid Rights API response" + before(:each) { get(rights_api_endpoint + "rights/test.pd_google") } + it_behaves_like "rights response" + it_behaves_like "valid response" + end + + context "with an invalid HTID" do + before(:each) { get(rights_api_endpoint + "rights/bogus.no_such_id") } + it_behaves_like "rights response" + it_behaves_like "empty response" end context "with no HTID" do before(:each) { get(rights_api_endpoint + "rights") } - it_behaves_like "Rights API 400 response" + it_behaves_like "404 response" end end - describe "/sources" do - before(:each) { get(rights_api_endpoint + "sources") } - it_behaves_like "valid Rights API response" + describe "/rights_log" do + context "with a valid HTID" do + before(:each) { get(rights_api_endpoint + "rights_log/test.pd_google") } + it_behaves_like "rights response" + it_behaves_like "valid response" + end + + context "with an invalid HTID" do + before(:each) { get(rights_api_endpoint + "rights_log/bogus.no_such_id") } + it_behaves_like "rights response" + it_behaves_like "empty response" + end + + context "with no HTID" do + before(:each) { get(rights_api_endpoint + "rights_log") } + it_behaves_like "404 response" + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c09a368..07ef3db 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,8 +13,7 @@ ]) SimpleCov.start -require_relative "../rights_api" -require "rights_api/rights_api" +require_relative "../lib/rights_api/app" # This file was generated by the `rspec --init` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. @@ -114,5 +113,5 @@ end def app - Sinatra::Application + RightsAPI::App end diff --git a/sql/100_rights_log.sql b/sql/100_rights_log.sql new file mode 100644 index 0000000..0e97e95 --- /dev/null +++ b/sql/100_rights_log.sql @@ -0,0 +1,118 @@ +USE ht; +LOCK TABLES `rights_log` WRITE; +/*!40000 ALTER TABLE `rights_log` DISABLE KEYS */; +INSERT INTO `rights_log` VALUES ('test','pd_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','op_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','op_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic-world_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic-world_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic-world_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','nobody_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','nobody_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','nobody_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pdus_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pdus_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pdus_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-3.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-3.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-3.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-3.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-3.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-3.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-3.0_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-3.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-3.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-3.0_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-3.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-3.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-sa-3.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-zero_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-zero_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-zero_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und-world_page+lowres',2,1,1,4,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','icus_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','icus_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-4.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-4.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-4.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-4.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-4.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-4.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-4.0_page',2,1,1,3,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-4.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-4.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-4.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-4.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-sa-4.0_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-sa-4.0_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd-pvt_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd-pvt_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','supp_open',2,1,1,1,'libadm','2008-12-31 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','supp_google',2,1,1,2,'libadm','2008-12-31 05:00:00',NULL); + +INSERT INTO `rights_log` VALUES ('test','pd_open',1,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd_google',1,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd_page',1,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic_open',2,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic_google',2,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic_page',2,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','op_open',3,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','op_google',3,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und_open',5,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und_google',5,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und_page',5,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic-world_open',7,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic-world_google',7,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','ic-world_page',7,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','nobody_open',8,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','nobody_google',8,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','nobody_page',8,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pdus_open',9,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pdus_google',9,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pdus_page',9,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-3.0_open',10,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-3.0_google',10,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-3.0_open',11,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-3.0_google',11,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-3.0_open',12,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-3.0_google',12,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-3.0_page',12,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-3.0_open',13,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-3.0_google',13,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-3.0_page',13,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-3.0_open',14,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-3.0_google',14,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-sa-3.0_google',15,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-zero_open',17,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-zero_google',17,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-zero_page',17,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','und-world_page+lowres',18,1,1,4,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','icus_open',19,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','icus_google',19,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-4.0_open',20,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-4.0_google',20,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-4.0_open',21,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nd-4.0_google',21,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-4.0_open',22,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-4.0_google',22,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-nd-4.0_page',22,1,1,3,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-4.0_open',23,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-4.0_google',23,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-4.0_open',24,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-nc-sa-4.0_google',24,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-sa-4.0_open',25,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','cc-by-sa-4.0_google',25,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd-pvt_open',26,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','pd-pvt_google',26,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','supp_open',27,1,1,1,'libadm','2009-01-01 05:00:00',NULL); +INSERT INTO `rights_log` VALUES ('test','supp_google',27,1,1,2,'libadm','2009-01-01 05:00:00',NULL); +/*!40000 ALTER TABLE `rights_log` ENABLE KEYS */; +UNLOCK TABLES; \ No newline at end of file