Big access control refactor
* 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)
This commit is contained in:
@@ -7,7 +7,7 @@ def url_class(url):
|
||||
return ""
|
||||
%>
|
||||
<%! from django.core.urlresolvers import reverse %>
|
||||
<%! from courseware.courses import has_staff_access_to_course_id %>
|
||||
<%! from courseware.access import has_access %>
|
||||
|
||||
<nav class="${active_page} course-material">
|
||||
<div class="inner-wrapper">
|
||||
@@ -28,7 +28,7 @@ def url_class(url):
|
||||
% if user.is_authenticated():
|
||||
<li class="profile"><a href="${reverse('profile', args=[course.id])}" class="${url_class('profile')}">Profile</a></li>
|
||||
% endif
|
||||
% if has_staff_access_to_course_id(user, course.id):
|
||||
% 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user