Merged develop into fix/sso-logout

This commit is contained in:
Christian Cueni 2024-09-30 05:44:18 +00:00
commit fbd6b19edb
5 changed files with 33 additions and 24 deletions

View File

@ -65,20 +65,6 @@ const actionButtonProps = computed<{ href: string; text: string; cyKey: string }
cyKey: "lm-dashboard-link",
};
}
if (props.courseConfig?.role_key === "Berufsbildner") {
return {
href: getLearningPathUrl(props.courseConfig?.course_slug),
text: "a.Vorschau Teilnehmer",
cyKey: "progress-dashboard-continue-course-link",
};
}
if (props.courseConfig?.role_key === "Ausbildungsverantwortlicher") {
return {
href: getLearningPathUrl(props.courseConfig?.course_slug),
text: "a.Vorschau Teilnehmer",
cyKey: "tr-dashboard-link",
};
}
return {
href: getLearningPathUrl(props.courseConfig?.course_slug),
text: "Weiter lernen",
@ -88,7 +74,11 @@ const actionButtonProps = computed<{ href: string; text: string; cyKey: string }
);
function hasActionButton(): boolean {
return props.courseConfig?.role_key !== "MentorUK";
return (
props.courseConfig?.role_key !== "MentorUK" &&
props.courseConfig?.role_key !== "Ausbildungsverantwortlicher" &&
props.courseConfig?.role_key !== "Berufsbildner"
);
}
</script>

View File

@ -2,6 +2,8 @@
import CourseSessionsMenu from "@/components/header/CourseSessionsMenu.vue";
import type { User } from "@/stores/user";
import type { CourseSession } from "@/types";
import { useRouteLookups } from "@/utils/route";
import { computed } from "vue";
import { useRouter } from "vue-router";
const props = defineProps<{
@ -13,6 +15,9 @@ const props = defineProps<{
const emit = defineEmits(["selectCourseSession", "logout", "close"]);
const router = useRouter();
const { inCourse } = useRouteLookups();
const showCourseSessionMenu = computed(() => inCourse() && props.courseSessions.length);
async function navigate(routeName: string) {
await router.push({ name: routeName });
@ -41,7 +46,7 @@ async function navigate(routeName: string) {
</div>
</div>
<div v-if="props.courseSessions.length" class="border-b py-4">
<div v-if="showCourseSessionMenu" class="border-b py-4">
<CourseSessionsMenu
:items="courseSessions"
:selected="selectedCourseSession"

View File

@ -90,12 +90,17 @@ const hasMediaLibraryMenu = computed(() =>
)
);
const hasCockpitMenu = computed(() =>
Boolean(courseSessionsStore.currentCourseSession?.actions.includes("expert-cockpit"))
const hasCockpitMenu = computed(
() =>
Boolean(
courseSessionsStore.currentCourseSession?.actions.includes("expert-cockpit")
) && inCourse()
);
const hasPreviewMenu = computed(() =>
Boolean(courseSessionsStore.currentCourseSession?.actions.includes("preview"))
const hasPreviewMenu = computed(
() =>
Boolean(courseSessionsStore.currentCourseSession?.actions.includes("preview")) &&
inCourse()
);
const hasAppointmentsMenu = computed(() =>

View File

@ -259,8 +259,15 @@ def collect_course_sessions_by_course(
def has_preview(role_key: RoleKeyType) -> bool:
print("has_preview", role_key)
return (
role_key in [RoleKeyType.MENTOR_VV, RoleKeyType.MENTOR_UK]
role_key
in [
RoleKeyType.MENTOR_VV,
RoleKeyType.MENTOR_UK,
RoleKeyType.BERUFSBILDNER,
RoleKeyType.TRAINING_RESPONSIBLE,
]
and not role_key == RoleKeyType.MEMBER
)

View File

@ -51,9 +51,11 @@ def has_course_session_preview(user, course_session_id: int):
if is_course_session_member(user, course_session_id):
return False
return is_course_session_learning_mentor(
user, course_session_id
) or is_course_session_expert(user, course_session_id)
return (
is_course_session_learning_mentor(user, course_session_id)
or is_course_session_berufsbildner(user, course_session_id)
or is_course_session_expert(user, course_session_id)
)
def has_media_library(user, course_session_id: int):