Open edX plugin that includes an API endpoint to generate a JSON file with the European Learning Model (ELMv3) data model format. Only learners who have completed a course and have a certificate of completion are included in the files generated by the API endpoint.
This plugin has been created as an open source contribution to the Open edX platform and has been funded by the Unidigital project from the Spanish Government - 2024.
| Open edX Release | Version |
|---|---|
| Palm | >= 0.2.0 |
| Quince | >= 0.2.0 |
| Redwood | >= 0.2.0 |
The settings can be changed in platform_plugin_elm_credentials/settings/common.py
or, for example, in tutor configurations.
NOTE: the current common.py works with Open edX Palm, Quince and
Redwood version.
Clone the repository:
git clone git@github.com:eduNEXT/platform_plugin_elm_credentials.git
cd platform_plugin_elm_credentialsSet up a virtualenv with the same name as the repo and activate it. Here's how
you might do that if you have virtualenv set up:
virtualenv -p python3.8 platform_plugin_elm_credentialsActivate the virtualenv. Here's how you might do that if you're using
virtualenv:
source platform_plugin_elm_credentials/bin/activateGrab the latest code:
git checkout main
git pullInstall/update the dev requirements:
make requirementsRun the tests and quality checks (to verify the status before you make any changes):
make validateMake a new branch for your changes:
git checkout -b <your_github_username>/<short_description>Using your favorite editor, edit the code to make your change:
vim ...Run your new tests:
pytest ./path/to/new/testsRun all the tests and quality checks:
make validateCommit all your changes, push your branch to github, and open a PR:
git commit ...
git pushTo use this plugin in a Tutor environment, you must install it as a requirement
of the openedx image. To achieve this, follow these steps:
tutor config save --append OPENEDX_EXTRA_PIP_REQUIREMENTS=git+https://github.com/edunext/platform-plugin-elm-credentials@vX.Y.Z
tutor images build openedxThen, deploy the resultant image in your environment.
IMPORTANT: To use the API, you need to have a course with certificates enabled. You should consider the following:
- You should configure from the Django administrator the coursemode, the certificate generation configuration, and the certificate html view configuration.
- You should activate certificates in the course from Studio in the Settings > Certificates.
Now, you can use the API. The API endpoint is protected with the same auth method as the Open edX platform. For generate a token, you can use the next endpoint:
POST
/<lms_host>/oauth2/access_token/: Generate a token for the user. The content type of the request must beapplication/x-www-form-urlencoded.Body parameters
client_id: Client ID of the OAuth2 application. You can find it in the Django admin panel. Normally, it islogin-service-client-id.grant_type: Grant type of the OAuth2 application. Normally, it ispassword.username: Username of the user.password: Password of the user.token_type: Type of the token. By default, it isbearer
Alternatively, you can use a new OAuth2 application. You can create a new application in the Django admin panel. The body parameters are the same as the previous endpoint, but you must use the
client_idandclient_secretof the new application. Thegrant_typemust beclient_credentials.Response
access_token: Access token of the user. You must use this token in theAuthorizationheader of the requests to the API.
Finally, you are ready to use the API. You must take into account that only users with django staff, course staff or course instructor role can use the API. The next endpoint are available:
GET
/<lms_host>/platform-plugin-elm-credentials/<course_id>/api/credential-builder/: Generate a ZIP file with the credential(s) in ELMv3 format.Path parameters
- course_id (Required): ID of the course.
Query parameters
- username (Optional): The username of the learner to generate the
credential for. If it is not provided, all the learners who have a
certificate will be used to generate the credentials. By default, it is
None. - expires_at (Optional): Date of the expiration of the credential. It
must be in the format
YYYY-MM-DDTHH:mm:ss±hh:mm. This parameter modifies the propertiesvalidUntilandexpirationDateof the ELMv3 format. By default, it isNone. - to_file (Optional): If it is
true, the response will be a ZIP file with the ELMv3 format. If it isfalse, the response will be a JSON with the ELMv3 format. By default, it istrue.
IMPORTANT: Bulk download of credentials does not include staff or superuser users.
You can configure some settings for the plugin. The available settings are the following:
- language_code: Language code of the credential. It is used to generate
the
LanguageandprimaryLanguageproperty of the ELMv3 format. By default, the language defined by the Django settingLANGUAGE_CODEis used. - language_map: Map of the language code with the language. This settings is useful when the language defined in the language code is different from English or Spanish.
- org_country_code: Country code of the organization. It is used to
generate the
countryCodeproperty of the ELMv3 format. By default, it isESP. - issuer_id: ID of the issuer. It is used to generate the
issuerproperty of the ELMv3 format. By default, a random in-memory UUID is generated.
Default settings are defined for Unidigital project. If you want to change the settings, you can do this in two ways:
You can configure the settings in a specific course using
Other Course Settingsin theAdvanced Settingssection in Studio.{ ... "ELM_CREDENTIALS_DEFAULTS": { "language_code": "POR", "language_map": {"fr": "FRA", "de": "DEU"}, "org_country_code": "PRT", "issuer_id": "8fb2a434-e46b-4fd9-80d1-ce7ff11c0048" } }You can configure the settings using a Django setting in the LMS.
ELM_CREDENTIALS_DEFAULTS = { "language_code": "POR", "language_map": {"fr": "FRA", "de": "DEU"}, "org_country_code": "PRT", "issuer_id": "8fb2a434-e46b-4fd9-80d1-ce7ff11c0048", }
The order of precedence is the following:
- Course settings
- Django settings
- Default settings
Test the API-generated JSON file using the EU credential builder. In step #3 (Upload), submit the JSON file created by the API and verify that the credential is valid.
If you're having trouble, we have discussion forums at discussions where you can connect with others in the community.
Our real-time conversations are on Slack. You can request a Slack invitation, then join our community Slack workspace.
For anything non-trivial, the best path is to open an issue in this repository with as many details about the issue you are facing as you can provide.
For more information about these options, see the Getting Help page.
The code in this repository is licensed under the AGPL 3.0 unless otherwise noted.
Please see LICENSE.txt for details.
Contributions are very welcome. Please read How To Contribute for details.
This project is currently accepting all types of contributions, bug fixes, security fixes, maintenance work, or new features. However, please make sure to have a discussion about your new feature idea with the maintainers prior to beginning development to maximize the chances of your change being accepted. You can start a conversation by creating a new issue on this repo summarizing your idea.
The current implementation has the minimum properties to build a credential under the format ELMv3. If you want to add more properties, you can do it following the next steps:
- Add the new properties in the
serializers.pyfile. In this file, you will all models that are used in the API. Most of the properties require you create a new class that inherits fromConfigModel. - Normally, you will also need to add the new properties in the
CredentialBuilderclass. - You must take into account the ELMv3 format to add the new properties.
Normally, properties have an
idand atype.
Please do not report security issues in public. Please email security@edunext.co.