* All access control logic is now in access.py * It exports a single method for general use: has_access(user, object, action) - possible actions depend on object type (e.g. 'see_exists', 'enroll', 'staff') * Removed DARK_LAUNCH feature flag--it is now the default behavior * Replaced check_course with three separate more focused functions that use has_access Minor things: * note on using pdb in testing * moved time parsing helper into timeparse.py * x_modules now have a .start attribute (None if not in metadata)
37 lines
1.4 KiB
HTML
37 lines
1.4 KiB
HTML
<%page args="active_page" />
|
|
|
|
<%
|
|
def url_class(url):
|
|
if url == active_page:
|
|
return "active"
|
|
return ""
|
|
%>
|
|
<%! from django.core.urlresolvers import reverse %>
|
|
<%! from courseware.access import has_access %>
|
|
|
|
<nav class="${active_page} course-material">
|
|
<div class="inner-wrapper">
|
|
<ol class="course-tabs">
|
|
<li class="courseware"><a href="${reverse('courseware', args=[course.id])}" class="${url_class('courseware')}">Courseware</a></li>
|
|
<li class="info"><a href="${reverse('info', args=[course.id])}" class="${url_class('info')}">Course Info</a></li>
|
|
% if user.is_authenticated():
|
|
% if settings.MITX_FEATURES.get('ENABLE_TEXTBOOK'):
|
|
<li class="book"><a href="${reverse('book', args=[course.id])}" class="${url_class('book')}">Textbook</a></li>
|
|
% endif
|
|
% if settings.MITX_FEATURES.get('ENABLE_DISCUSSION'):
|
|
<li class="discussion"><a href="${reverse('questions')}">Discussion</a></li>
|
|
% endif
|
|
% endif
|
|
% if settings.WIKI_ENABLED:
|
|
<li class="wiki"><a href="${reverse('wiki_root', args=[course.id])}" class="${url_class('wiki')}">Wiki</a></li>
|
|
% endif
|
|
% if user.is_authenticated():
|
|
<li class="profile"><a href="${reverse('profile', args=[course.id])}" class="${url_class('profile')}">Profile</a></li>
|
|
% endif
|
|
% if has_access(user, course, 'staff'):
|
|
<li class="instructor"><a href="${reverse('instructor_dashboard', args=[course.id])}" class="${url_class('instructor')}">Instructor</a></li>
|
|
% endif
|
|
|
|
</ol>
|
|
</div>
|
|
</nav> |