Skip to content

Instantly share code, notes, and snippets.

@robkooper
Last active November 4, 2021 17:32
Show Gist options
  • Save robkooper/22c24454373557ad079a9fd93036f0fb to your computer and use it in GitHub Desktop.
Save robkooper/22c24454373557ad079a9fd93036f0fb to your computer and use it in GitHub Desktop.
this describes how to manually change the license for all files/datasets in clowder

Pick your license, copy to the script at the end, and update the database. For large databases this can take some time, but should not impact clowder.

Custom Licsens

Custom license, the default. If you set rightsHolder to be "" it will default to the uploader. Set m_allowDownload to true (allow downloads) or false (no downloads except admins and owner).

var license={
  "licenseData": {
    "m_licenseType" : "license1",
    "m_licenseUrl" : "",
    "m_licenseText" : "All rights reserved",
    "m_rightsHolder" : "",
    "m_allowDownload" : true
  }
};

Creative Commons License

allow commercial, allow derivatives

var license={
  "licenseData": {
    "m_licenseType" : "license2",
    "m_licenseUrl" : "http://creativecommons.org/licenses/by/3.0/",
    "m_licenseText" : "Attribution",
  }
};

allow commercial, allow derivatives, require share-alike

var license={
  "licenseData": {
    "m_licenseType" : "license2",
    "m_licenseUrl" : "http://creativecommons.org/licenses/by-sa/3.0/",
    "m_licenseText" : "Attribution-ShareAlike",
  }
};

allow commercial, no derivatives

var license={
  "licenseData": {
    "m_licenseType" : "license2",
    "m_licenseUrl" : "http://creativecommons.org/licenses/by-nd/3.0/",
    "m_licenseText" : "Attribution-NoDerivs",
  }
};

no commercial, no derivatives

var license={
  "licenseData": {
    "m_licenseType" : "license2",
    "m_licenseUrl" : "http://creativecommons.org/licenses/by-nc-nd/3.0/",
    "m_licenseText" : "Attribution-NonCommercial-NoDerivs",
  }
};

no commercial, allow derivatives, require share-alike

var license={
  "licenseData": {
    "m_licenseType" : "license2",
    "m_licenseUrl" : "http://creativecommons.org/licenses/by-nc-sa/3.0/",
    "m_licenseText" : "Attribution-NonCommercial-ShareAlike",
  }
};

public domain

var license={
  "licenseData": {
    "m_licenseType" : "license3",
    "m_licenseUrl" : "http://creativecommons.org/publicdomain/zero/1.0/",
    "m_licenseText" : "Public Domain Dedication",
    "m_rightsHolder" : "Public Domain Dedication",
  }
};

update license

Pick the license from above and copy it and run the following 3 statements. This will overwrite the license for ALL files.

db.uploads.update({}, {$set: license}, {"multi": 1})
db.curationFiles.update({}, {$set: license}, {"multi": 1})
db.datasets.update({}, {$set: license}, {"multi": 1})

For example the following will set the license for all files to be public domain:

var license={
  "licenseData": {
    "m_licenseType" : "license3",
    "m_licenseUrl" : "http://creativecommons.org/publicdomain/zero/1.0/",
    "m_licenseText" : "Public Domain Dedication",
    "m_rightsHolder" : "Public Domain Dedication",
  }
};

db.uploads.update({}, {$set: license}, {"multi": 1})
db.curationFiles.update({}, {$set: license}, {"multi": 1})
db.datasets.update({}, {$set: license}, {"multi": 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment