Package: ckanext-dcor-schemas
This module introduces/lifts restrictions (authorization) for the management
of data and meta data on DCOR. The corresponding UI elements are modified
accordingly:Authorization (auth.py)datasets: do not allow deleting datasets unless they are draftsdatasets: allow purging of deleted datasetsdatasets: do not allow switching to a more restrictive licensedatasets: do not allow changing the name (slug)datasets: do not allow adding resources to non-draft datasetsdatasets: do not allow to set the visibility of a public dataset to privatedatasets: do not allow uploading datasets via the web interfaceorganization: do not allow bulk_update_delete (e.g. datasets by organization admins)resources: do not allow deleting resources unless they are draftsresources: only allow changing the “description”resources: do not allow setting a resource id when uploadinguser: allow all logged-in users to create datasets, circles, and collectionsValidation (validate.py)datasets: force user to select authorsdatasets: author list “authors” is CSVdatasets: parse DOI field (remove URL part)datasets: force user to select a licensedatasets: restrict to basic CC licensesdatasets: automatically generate dataset name (slug) using random characters
if necessary (does not apply to admins)datasets: a dataset without resources is considered to be a draft;
it’s state cannot be set to “active”datasets: the state of a dataset that does not contain at least one
valid .rtdc resource cannot be set to “active”resources: do not allow uploading resources with the same name
for a dataset (important for ckanext-dcor_depot)resources: make sure the resource name matches the file name of the
upload; this is actually implemented in plugin.before_create
(IResourceController) and not in validate.pyresources: custom resource name is overridden during uploadresources: do not allow weird characters in resource namesresources: restrict upload data extensions to .’.rtdc’, ‘.ini’, ‘.csv’,
‘.tsv’, ‘.pdf’, ‘.txt’, ‘.jpg’, ‘.png’, ‘.tif’, ‘.py’, ‘.ipynb’, ‘.poly’,
‘.sof’, ‘.so2’resources: configuration metadata (usingdclab.dfn.config_funcs)resources: ‘s3_available’ and ‘s3_url’ for identifying objects that
are available on S3 and for downloading public datasets.IPermissionLabels (plugin.py)Allow a user A to see user B’s private dataset if the private dataset
is in a group that user A is a member of.UI Dataset:hide “add new resource” button intemplates/package/resources.htmladd fieldauthors(csv list)add fielddoi(validator parses URLs)add fieldreferences(parses arxiv, bioRxiv, DOI, links)add CC license filelicenses.json(only show less restrictive licenses
when editing the dataset)UI Organization:remove “Delete” button in bulk viewUI Resource:Do not show these variables (because they are redundant):
[‘last modified’, ‘revision id’, ‘url type’, ‘state’, ‘on same domain’]
(templates/package/resource_read.html)Show DC config data via “toggle-more”Add supplementary resource schema via json files located indcor_schemas/resource_schema_supplementsBackground jobs:set the mimetype for each datasetpopulate “dc:sec:key” metadata for each DC datasetgenerates sha256 hash upon resource creationConfiguration keywords:theckanext.dcor_schemas.allow_public_datasetsboolean parameter
can be used to disable the creation of public datasets (e.g. for DCOR-med).theckanext.dcor_schemas.json_resource_schema_dirparameter
can be used to specify a directory containing .json files that
define the supplementary resource schema. The default ispackagewhich means that the supplementary resource schema of
this extension is used.API extensions:resource_schema_supplementsreturns a dictionary of the
current supplementary resource schemasupported_resource_suffixesreturns a list of supported
resource suffixesCLI:add CKAN commandlist-zombie-usersfor users with no datasets and
no activity for a certain amount of timeadd CKAN commandrun-jobs-dcor-schemasthat runs all background
jobs for all resources (if not already done)InstallationSimply runpip install ckanext-dcor_schemasIn the configuration file ckan.ini:ckan.plugins = [...] dcor_schemas
ckan.extra_resource_fields = sha256TestingIf CKAN/DCOR is installed and setup for testing, this extension can
be tested with pytest:pytest ckanextTesting can also be done via vagrant in a virtualmachine using thedcor-test <https://app.vagrantup.com/paulmueller/boxes/dcor-test/>image.
Make sure thatvagrantandvirtualboxare installed and run the
following commands in the root of this repository:# Setup virtual machine using `Vagrantfile`
vagrant up
# Run the tests
vagrant ssh -- sudo bash /testing/vagrant-run-tests.sh