This extension expands on the flexible resource permissioning provided by ckanext-initiatives https://github.com/BioplatformsAustralia/ckanext-initiatives. It enables systems administrators to be able to provide time limited access to particular users to download specific datasets irrespective of if they are members of the relevant project.
The extension intercepts the same authentication calls as ckanext-initiatives and is implemented as a chained auth function.
A frontend and API calls are implmented to view, add and remove passes.
The name of the extension is derived from the French
laissez-passer
noun
a permit; pass, especially one issued in lieu of a passport.
Compatibility with core CKAN versions:
CKAN version | Compatible? |
---|---|
2.8 and earlier | not tested |
2.9 | yes |
2.10 | not yet |
2.11 | not yet |
It is strongly suggested to use this extension with
https://github.com/BioplatformsAustralia/ckanext-initiatives
To install ckanext-laissezpasser:
-
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
-
Clone the source and install it on the virtualenv
git clone https://github.com/BioplatformsAustralia/ckanext-laissezpasser.git cd ckanext-laissezpasser pip install -e . pip install -r requirements.txt
-
Add
laissezpasser
to theckan.plugins
setting in your CKAN config file (by default the config file is located at/etc/ckan/default/ckan.ini
). -
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
-
Create the necessary database tables
ckan -c /etc/ckan/default/ckan.ini db upgrade -p laissezpasser
ckanext-laissezpasser has minimal configuration. The default length of time in days for a pass can be set in the CKAN configuration file
# The number of days for a new pass to be valid
# (optional, default: 7).
ckanext.laissezpasser.duration = 1
To enable the plugin, the CKAN configuration file plugins setting needs to be updated
ckan.plugins = .. laissezpasser ... initiatives
It must be listed in the configuration file before the initiatives extension and any other similar extensions that use/override auth functions or chained auth functions.
To install ckanext-laissezpasser for development, activate your CKAN virtualenv and do:
git clone https://github.com/BioplatformsAustralia/ckanext-laissezpasser.git
cd ckanext-laissezpasser
python setup.py develop
pip install -r dev-requirements.txt
To run the tests, do:
pytest --ckan-ini=test.ini
If ckanext-laissezpasser should be available on PyPI you can follow these steps to publish a new version:
-
Update the version number in the
setup.py
file. See PEP 440 for how to choose version numbers. -
Make sure you have the latest version of necessary packages:
pip install --upgrade setuptools wheel twine
-
Create a source and binary distributions of the new version:
python setup.py sdist bdist_wheel && twine check dist/*
Fix any errors you get.
-
Upload the source distribution to PyPI:
twine upload dist/*
-
Commit any outstanding changes:
git commit -a git push
-
Tag the new release of the project on GitHub with the version number from the
setup.py
file. For example if the version number insetup.py
is 0.0.1 then do:git tag 0.0.1 git push --tags