diff --git a/src/instructor-toolbar/InstructorToolbar.jsx b/src/instructor-toolbar/InstructorToolbar.jsx index 71d968c869..1646a5dc89 100644 --- a/src/instructor-toolbar/InstructorToolbar.jsx +++ b/src/instructor-toolbar/InstructorToolbar.jsx @@ -55,6 +55,7 @@ const InstructorToolbar = (props) => { const { courseId, unitId, + studioButtonVisible, tab, } = props; @@ -72,13 +73,13 @@ const InstructorToolbar = (props) => {
- {(urlStudio || urlInsights) && ( + {((urlStudio && studioButtonVisible) || urlInsights) && ( <>
View course in: )} - {urlStudio && ( + {urlStudio && studioButtonVisible && ( Studio @@ -114,12 +115,14 @@ const InstructorToolbar = (props) => { InstructorToolbar.propTypes = { courseId: PropTypes.string, unitId: PropTypes.string, + studioButtonVisible: PropTypes.bool, tab: PropTypes.string, }; InstructorToolbar.defaultProps = { courseId: undefined, unitId: undefined, + studioButtonVisible: true, tab: '', }; diff --git a/src/tab-page/LoadedTabPage.jsx b/src/tab-page/LoadedTabPage.jsx index 0259aa1bfd..c4b5d6ae5a 100644 --- a/src/tab-page/LoadedTabPage.jsx +++ b/src/tab-page/LoadedTabPage.jsx @@ -15,6 +15,8 @@ import useLogistrationAlert from '../alerts/logistration-alert'; import ProductTours from '../product-tours/ProductTours'; +const restrictedStudioAccessRoles = ['limited_staff']; + const LoadedTabPage = ({ activeTabSlug, children, @@ -28,6 +30,7 @@ const LoadedTabPage = ({ originalUserIsStaff, tabs, title, + userRoles, verifiedMode, } = useModel('courseHomeMeta', courseId); @@ -38,6 +41,8 @@ const LoadedTabPage = ({ const activeTab = tabs.filter(tab => tab.slug === activeTabSlug)[0]; + const canVisitStudio = !restrictedStudioAccessRoles.some(role => userRoles.includes(role)); + const streakLengthToCelebrate = celebrations && celebrations.streakLengthToCelebrate; const streakDiscountCouponEnabled = celebrations && celebrations.streakDiscountEnabled && verifiedMode; const [isStreakCelebrationOpen,, closeStreakCelebration] = useToggle(streakLengthToCelebrate); @@ -58,6 +63,7 @@ const LoadedTabPage = ({ courseId={courseId} unitId={unitId} tab={activeTabSlug} + studioButtonVisible={canVisitStudio} /> )}