-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: eSHE Instructor role [BB-7489] #561
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,7 +35,9 @@ | |||||
CourseFinanceAdminRole, | ||||||
CourseInstructorRole, | ||||||
CourseSalesAdminRole, | ||||||
CourseStaffRole | ||||||
CourseStaffRole, | ||||||
eSHEInstructorRole, | ||||||
strict_role_checking, | ||||||
) | ||||||
from common.djangoapps.util.json_request import JsonResponse | ||||||
from lms.djangoapps.bulk_email.api import is_bulk_email_feature_enabled | ||||||
|
@@ -124,13 +126,17 @@ def instructor_dashboard_2(request, course_id): # lint-amnesty, pylint: disable | |||||
access = { | ||||||
'admin': request.user.is_staff, | ||||||
'instructor': bool(has_access(request.user, 'instructor', course)), | ||||||
'eshe_instructor': eSHEInstructorRole(course_key).has_user(request.user), | ||||||
'finance_admin': CourseFinanceAdminRole(course_key).has_user(request.user), | ||||||
'sales_admin': CourseSalesAdminRole(course_key).has_user(request.user), | ||||||
'staff': bool(has_access(request.user, 'staff', course)), | ||||||
'forum_admin': has_forum_access(request.user, course_key, FORUM_ROLE_ADMINISTRATOR), | ||||||
'data_researcher': request.user.has_perm(permissions.CAN_RESEARCH, course_key), | ||||||
} | ||||||
|
||||||
with strict_role_checking(): | ||||||
access['explicit_staff'] = bool(has_access(request.user, 'staff', course)) | ||||||
|
||||||
if not request.user.has_perm(permissions.VIEW_DASHBOARD, course_key): | ||||||
raise Http404() | ||||||
|
||||||
|
@@ -488,7 +494,15 @@ def _section_membership(course, access): | |||||
'update_forum_role_membership', | ||||||
kwargs={'course_id': str(course_key)} | ||||||
), | ||||||
'is_reason_field_enabled': configuration_helpers.get_value('ENABLE_MANUAL_ENROLLMENT_REASON_FIELD', False) | ||||||
'is_reason_field_enabled': configuration_helpers.get_value('ENABLE_MANUAL_ENROLLMENT_REASON_FIELD', False), | ||||||
|
||||||
# Membership section should be hidden for eSHE instructors. | ||||||
# Since they get Course Staff role implicitly, we need to hide this | ||||||
# section if the user doesn't have the Course Staff role set explicitly | ||||||
# or have the Discussion Admin role. | ||||||
'is_hidden': ( | ||||||
access['eshe_instructor'] and not (access['explicit_staff'] or access['forum_admin']) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @0x29a I would regroup it like:
Suggested change
because semantically it makes more sense, e.g. we always display it if user is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, should this section be visible if a user is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Cup0fCoffee, yes, should be visible for |
||||||
) | ||||||
0x29a marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
} | ||||||
return section_data | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0x29a Could you explain this more in depth for me? I don't understand why we can't set it to
HasAccessRule('staff')
, and do we need to check with no inheritance for theHasAccessRule('staff', strict=True)
, sincestaff
doesn't inherit from theeshe_instructor
role, it's the other way around.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never mind, I got confused. I realize that we need to check strictly because
HasAccessRule('staff')
can returntrue
if someone haseshe_instructor
role, since we are inheriting. And the rest is so we don't break the inheritance for the other roles that inherit from thestaff
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that's right @Cup0fCoffee. Actually, I'm not sure that
explicit
/implicit
wording in comments explaining this is the best choice. I'll think how I can explain this workaround more clearly.