feat: restrict certain UI elements for students in course sidebar and lesson pages

This commit is contained in:
Rotimi Best
2026-03-12 06:15:39 +01:00
parent 51db162829
commit c87cc4b868
5 changed files with 37 additions and 26 deletions
@@ -1,4 +1,5 @@
import { derived, writable } from 'svelte/store';
import { PUBLIC_IS_SELFHOSTED } from '$env/static/public';
import { currentOrgPath } from './org';
@@ -17,6 +18,12 @@ export const globalStore = writable<{
/**
* Single source of truth: is this a student experience?
* Cloud: orgSite is always student. Self-hosted: check role.
*
* why are we not using isOrgStudent from org store?
* because this is derived from the currentOrg which returns null if no org OR boolean if org is present. Once org data is set, we then update globalStore.isStudent to the same value.
*
* why are we not using only globalStore.isStudent for this?
* because in the cloud instance, when a teacher logs into the lms aka org site, they need to be treated as a student so they see what the student sees.
*/
export const isStudentExperience = derived(globalStore, ($gs) => {
const isCloud = PUBLIC_IS_SELFHOSTED !== 'true';