I have added the following JavaScript code to hide the navigation tab in courses for faculty. However, when I have impersonated a user assigned to a sub-account with one of the custom admin account roles I created, they are still able to see the navigation tab when they go into courses. How do I make it so only those users that are assigned the default account admin role can see the navigation tab in Courses?
- Here is my Java Script code:
//hides Navigation tab in course settings
var navigationTab = document.getElementById('navigation_tab');
function isAdmin() {
if (window.ENV && Array.isArray(window.ENV.current_user_roles)) {
return window.ENV.current_user_roles.includes('admin') || window.ENV.current_user_roles.includes('root_admin');
}
return false;
}
if (navigationTab && !isAdmin()) {
navigationTab.style.display = 'none';
}