feat: Add EnrollmentsService in XBlockRuntime and block renderer (#34238)

* feat: Add EnrollmentsService in XBlockRuntime and block renderer

These changes give ability to use `EnrollmentsService` in XBlocks
Add `get_active_enrollments_by_course_and_user` method to `EnrollmentsService` which can be used to get active enrollment of user for a give course
This commit is contained in:
Zia Fazal
2024-03-19 09:41:11 +05:00
committed by GitHub
parent 762730ab6f
commit 1556be5851
4 changed files with 77 additions and 0 deletions

View File

@@ -71,6 +71,7 @@ from lms.djangoapps.verify_student.services import XBlockVerificationService
from openedx.core.djangoapps.bookmarks.api import BookmarksService
from openedx.core.djangoapps.crawlers.models import CrawlersConfig
from openedx.core.djangoapps.credit.services import CreditService
from openedx.core.djangoapps.enrollments.services import EnrollmentsService
from openedx.core.djangoapps.util.user_utils import SystemUser
from openedx.core.djangolib.markup import HTML
from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser
@@ -633,6 +634,7 @@ def prepare_runtime_for_user(
'teams_configuration': TeamsConfigurationService(),
'call_to_action': CallToActionService(),
'publish': EventPublishingService(user, course_id, track_function),
'enrollments': EnrollmentsService(),
}
runtime.get_block_for_descriptor = inner_get_block