-
-
-
![]()
-
-
- {{ participant.first_name }}
- {{ participant.last_name }}
-
- {{ participant.email }}
-
-
-
+ {{ $t("a.Personen, die du begleitest") }}
+
+
- {{ $t("cockpit.profileLink") }}
-
+
+
![]()
+
+
+ {{ participant.first_name }}
+ {{ participant.last_name }}
+
+ {{ participant.email }}
+
+
+
+ {{ $t("cockpit.profileLink") }}
+
+
diff --git a/client/src/utils/route.ts b/client/src/utils/route.ts
index fcc8ddf6..0b0c9e26 100644
--- a/client/src/utils/route.ts
+++ b/client/src/utils/route.ts
@@ -23,7 +23,7 @@ export function useRouteLookups() {
}
function inLearningMentor() {
- const regex = new RegExp("/course/[^/]+/mentor($|/)");
+ const regex = new RegExp("/course/[^/]+/learning-mentor($|/)");
return regex.test(route.path);
}
diff --git a/client/src/utils/utils.ts b/client/src/utils/utils.ts
index 272cac03..de32b6ea 100644
--- a/client/src/utils/utils.ts
+++ b/client/src/utils/utils.ts
@@ -14,10 +14,7 @@ function createCourseUrl(courseSlug: string | undefined, specificSub: string): s
return "/";
}
- if (["learn", "media", "competence", "cockpit", "mentor"].includes(specificSub)) {
- return `/course/${courseSlug}/${specificSub}`;
- }
- return `/course/${courseSlug}`;
+ return `/course/${courseSlug}/${specificSub}`;
}
export function getCompetenceNaviUrl(courseSlug: string | undefined): string {
@@ -32,6 +29,10 @@ export function getLearningPathUrl(courseSlug: string | undefined): string {
return createCourseUrl(courseSlug, "learn");
}
+export function getLearningMentorUrl(courseSlug: string | undefined): string {
+ return createCourseUrl(courseSlug, "learning-mentor");
+}
+
export function getCockpitUrl(courseSlug: string | undefined): string {
return createCourseUrl(courseSlug, "cockpit");
}
diff --git a/server/vbv_lernwelt/iam/permissions.py b/server/vbv_lernwelt/iam/permissions.py
index ae94342f..0d09f538 100644
--- a/server/vbv_lernwelt/iam/permissions.py
+++ b/server/vbv_lernwelt/iam/permissions.py
@@ -51,13 +51,6 @@ def has_course_session_preview(user, course_session_id: int):
)
-def has_expert_cockpit(user, course_session_id: int):
- # FIXME: is_learning_mentor is just here WHILE we move cockpit -> learning-mentor THEN remove this!
- return is_learning_mentor(user, course_session_id) or is_course_session_expert(
- user, course_session_id
- )
-
-
def has_media_library(user, course_session_id: int):
if user.is_superuser:
return True
@@ -247,6 +240,40 @@ def has_appointments(user: User, course_session_id: int) -> bool:
return CourseSessionUser.objects.filter(course_session=course_session_id).exists()
+def has_learning_mentor(user: User, course_session_id: int) -> bool:
+ course_session = CourseSession.objects.get(id=course_session_id)
+
+ if course_session is None:
+ return False
+
+ if not course_session.course.configuration.enable_learning_mentor:
+ return False
+
+ if is_learning_mentor(user, course_session_id):
+ return True
+
+ if is_course_session_member(user, course_session_id):
+ return True
+
+ return False
+
+
+def can_have_learning_mentors(user: User, course_session_id: int) -> bool:
+ if not has_learning_mentor(user, course_session_id):
+ return False
+
+ # limit further, since has_learning_mentor is too broad
+ return is_course_session_member(user, course_session_id)
+
+
+def can_feedback_mentees(user: User, course_session_id: int) -> bool:
+ if not has_learning_mentor(user, course_session_id):
+ return False
+
+ # limit further, since has_learning_mentor is too broad
+ return is_learning_mentor(user, course_session_id)
+
+
def can_view_profile(user: User, profile_user: CourseSessionUser) -> bool:
if user.is_superuser:
return True
@@ -291,11 +318,18 @@ def course_session_permissions(user: User, course_session_id: int) -> list[str]:
{
# FIXME: Just here WHILE we move cockpit -> learning-mentor THEN remove this!
"deprecated-mentor": is_course_session_member(user, course_session_id),
- "learning-mentor": is_learning_mentor(user, course_session_id),
+ # has learning mentor "tab" access?
+ "learning-mentor": has_learning_mentor(user, course_session_id),
+ "learning-mentor::edit-mentors": can_have_learning_mentors(
+ user, course_session_id
+ ),
+ "learning-mentor::feedback-mentees": can_feedback_mentees(
+ user, course_session_id
+ ),
"preview": has_course_session_preview(user, course_session_id),
"media-library": has_media_library(user, course_session_id),
"appointments": has_appointments(user, course_session_id),
- "expert-cockpit": has_expert_cockpit(user, course_session_id),
+ "expert-cockpit": is_course_session_expert(user, course_session_id),
"learning-path": is_course_session_member(user, course_session_id),
"competence-navi": is_course_session_member(user, course_session_id),
"complete-learning-content": can_complete_learning_content(