Skip to content

Commit 286a11a

Browse files
committed
feat: add org property to ContentLibraryData and CourseOverviewData classes
1 parent c64fe18 commit 286a11a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

openedx_authz/api/data.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,15 @@ class ContentLibraryData(ScopeData):
392392

393393
NAMESPACE: ClassVar[str] = "lib"
394394

395+
@property
396+
def org(self) -> str:
397+
"""Get the organization name from the library key.
398+
399+
Returns:
400+
str: The organization name (e.g., ``DemoX`` from ``lib:DemoX:CSPROB``).
401+
"""
402+
return self.library_key.org
403+
395404
@property
396405
def library_id(self) -> str:
397406
"""The library identifier as used in Open edX (e.g., 'lib:DemoX:CSPROB').
@@ -494,6 +503,15 @@ class CourseOverviewData(ScopeData):
494503

495504
NAMESPACE: ClassVar[str] = "course-v1"
496505

506+
@property
507+
def org(self) -> str:
508+
"""Get the organization name from the course key.
509+
510+
Returns:
511+
str: The organization name (e.g., ``DemoX`` from ``course-v1:DemoX+TestCourse+2024_T1``).
512+
"""
513+
return self.course_key.org
514+
497515
@property
498516
def course_id(self) -> str:
499517
"""The course identifier as used in Open edX (e.g., 'course-v1:TestOrg+TestCourse+2024_T1').

0 commit comments

Comments
 (0)