feat: restrict certain UI elements for students in course sidebar and lesson pages
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user