-
Notifications
You must be signed in to change notification settings - Fork 9
Checkpoint Integration
Greg Kostin edited this page Jun 8, 2018
·
1 revision
./Gemfile
# Canister provides containers
gem 'canister', '~> 0.9.0'
# Checkpoint provides authorization support
# gem 'checkpoint', '~> 1.0.0'
gem 'checkpoint', git: 'https://github.com/mlibrary/checkpoint', branch: 'master'
./app/controllers/application_controller.rb
# TODO: See gkostin about this comment if you have any questions.
# Ensure CanCan by authorize!(<action>, <resource> || <resouce_class>)
# rescue_from CanCan::AccessDenied, with: :render_unauthorized # TODO: Might be needed
# check_authorization unless: :devise_controller? || :checkpoint_controller?
def checkpoint_controller?
false # Overridden in CheckpointController to return true
end
./app/controllers/checkpoint_controller.rb
./app/models/ability_checkpoint.rb
./app/policies/*
./bin/setup
files = ['keycard-development', 'keycard-test', 'checkpoint-development', 'checkpoint-test']
./bin/travis
files = ['keycard-development', 'keycard-test', 'checkpoint-development', 'checkpoint-test']
./config/initializers/services.rb
if Settings.checkpoint&.database
Checkpoint::DB.config.opts = Settings.checkpoint.database
end
Services = Canister.new
Services.register(:checkpoint) { Checkpoint::Authority.new } # Use default implementation
./config/settings/development.yml
checkpoint:
database:
adapter: sqlite
database: db/checkpoint-development.sqlite3
pool: 5
timeout: 5000
./config/settings/test.yml
checkpoint:
database:
adapter: sqlite
database: db/checkpoint-test.sqlite3
pool: 5
timeout: 5000
./db/checkpoint-development.sqlite3.sample
./db/checkpoint-test.sqlite3.sample
NOTE: ./db/checkpoint-test.sqlite3.sample
was added to the git repository to support Travis CI integration a.k.a. the database needs to exists for Travis to run.