Repository navigation
feat: add validation to issue badge - #3007
luisfelipec95 wants to merge 3 commits into
Conversation
|
Thanks for the pull request, @luisfelipec95! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
45730de to
5188d05
Compare
|
@luisfelipec95 Thanks for the PR. Before I proceed with review can you please create a new Issue in the repository describing this as functionality request with business need details and acceptance criteria or definition of done. Additionally, can you please include documentation updates into this PR because in other case this new feature is basically invisible for Open edX users. |
|
Hi @GlugovGrGlib, I create this issue #3011 and updated the PR, thanks. |
Description
This change adds an optional, settings-driven badge issuance restriction check for Credly badges.
When enabled, the badge completion flow evaluates whether badge issuance is allowed by querying a configurable external API for each related course fulfillment before issuing the badge. If any exact course match indicates that badge issuance is restricted, the badge is not issued.
The restriction logic is kept separate from the signal handler, and authenticated requests use the existing
SiteConfiguration.api_clientandOAuthAPIClientimplementation.This feature is disabled by default and is designed to remain generic so it can support different integrations.
Changes
Added a new feature flag:
BADGES_ENABLE_ISSUANCE_RESTRICTIONSAdded configurable settings for the external restrictions check:
BADGES_ISSUANCE_RESTRICTIONS_API_URLBADGES_ISSUANCE_RESTRICTIONS_FLAG_NAMEAdded a
course_keyfield to badge fulfillments:Added a dedicated badge restriction utility:
handle_badge_completionccx_idreturned by the external APIUpdated
handle_badge_completionto:course_keySiteConfiguration.api_clientfor authenticated inter-service requestsWhy
Some deployments need badge issuance to depend on external business rules. This change introduces a flexible mechanism to evaluate those rules at issuance time while keeping the default behavior unchanged for the community.
The
course_keyfield is required so each fulfillment carries the course identifier needed to evaluate issuance restrictions on a per-course basis.Reusing
SiteConfiguration.api_clientavoids duplicating OAuth2 client-credentials logic that is already provided by Credentials andedx-rest-api-client, including token handling and refresh behavior.Default behavior
This feature is disabled by default.
When
BADGES_ENABLE_ISSUANCE_RESTRICTIONSis disabled, or when no matching restriction data is returned by the external API, badge issuance continues as before.