Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Badgr backend support v2 API and authentication for Juniper #94

Merged

Conversation

ztraboo
Copy link

@ztraboo ztraboo commented Sep 18, 2020

It's important to note the creation of the badges cache table. Currently this is a manual step for devstack but setup with configuration for production.

Details:
appsembler#343

To create the database cache table, a task was added to the edxapp Ansible role, so this PR relies on a merge of appsembler/configuration#212 at least to automate setup. You can also just manually run ./manage.py lms createcachetable --settings=devstack_appsembler etc.

ztraboo and others added 20 commits September 8, 2020 09:50
(cache auth token til expiry then use refresh token to renew)
working assertion with v2 API
(note requires using updated Ansible edxapp role or manual step to
creat the db cache table)
backend slugs no longer generated from component and submitted slug
because Badgr.io creates its own uuid-based slugs now
BadgeClasses unique by slug, and also by course mode w/ course id
Criteria passed to Badgr as criteria_text or criteria_url depending
look up Badge Classes by slug if passed or if not by mode + id
instead to reject if course id, mode combo already exists ONLY IF
course id is set... i.e., blank/null course id and mode dupes OK
(commented out some tests which should be reworked when BadgeClass
slug and backend id are separated out.  You can no longer
set a Badgr id based on a hash of the BadgeClass slug.  Badgr backend
id is set by Badgr and returned in the response JSON. )
Fix badges tests, update to support Badgr API v1 and v2

(commented out some tests which should be reworked when BadgeClass
slug and backend id are separated out.  You can no longer
set a Badgr id based on a hash of the BadgeClass slug.  Badgr backend
id is set by Badgr and returned in the response JSON. )
…-497

Following has changed:
- Moved `BADGR_` settings after the `AUTH_TOKENS` file is read within the `production` env file.
- Moved Badges cache values after `private` env file has been read for `production` env file.
- `SessionAuthenticationAllowInactiveUser` has moved to https://github.com/edx/edx-drf-extensions
- Setup the Open edX BadgeClass `slug` to have default random value of 22 alphanumeric characters prefixed with `edx_` to help it standout from Badgr BadgeClass entityID which updates it automatically when the Badgr BadgeClass is created. This prevents us from having to manually create a BadgeClass with defined `slug` value in the Django admin page everytime a course is created.
- Setup the BadgeClass `clean()` to check for records > 1 to avoid duplicates. Previously it used `exists()` QuerySet to make this determination, however, it appears that even before the `.save()` call the new object gets stored in the QuerySet and therefore it exists without the save.
- Added `openedx__course` BadgeClass `issuing_component` to the `course_complete` code.
@ztraboo ztraboo merged commit 343613e into develop/juniper.master Sep 18, 2020
@ztraboo ztraboo added this to the cu-release/juniper.master milestone Sep 18, 2020
@ztraboo ztraboo added the badging label Jan 6, 2022
@ztraboo ztraboo mentioned this pull request Feb 9, 2022
33 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants