feat: eSHE Instructor role [BB-7489]#561
Conversation
fcecd1f to
90adc68
Compare
Adds the eSHE Instructor role, which inherits Course Staff permissions, but isn't able to enroll / un-enroll students and can't assing course team roles unless in combination with Course Staff / Instructor / Discussion admin roles.
90adc68 to
eba8b0c
Compare
| # eshe_instructor implicitly gets staff access, but shouldn't be able to enroll | ||
| perms[CAN_ENROLL] = ( | ||
| # can enroll if a user is an eshe_instructor and has an explicit staff role | ||
| (HasRolesRule('eshe_instructor') & HasAccessRule('staff', strict=True)) | | ||
| # can enroll if a user is just staff | ||
| (~HasRolesRule('eshe_instructor') & HasAccessRule('staff')) | ||
| ) |
There was a problem hiding this comment.
@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 the HasAccessRule('staff', strict=True), since staff doesn't inherit from the eshe_instructor role, it's the other way around.
There was a problem hiding this comment.
and do we need to check with no inheritance for the HasAccessRule('staff', strict=True), since staff doesn't inherit from the eshe_instructor role, it's the other way around.
Never mind, I got confused. I realize that we need to check strictly because HasAccessRule('staff') can return true if someone has eshe_instructor role, since we are inheriting. And the rest is so we don't break the inheritance for the other roles that inherit from the staff.
There was a problem hiding this comment.
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.
| # 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.
@0x29a I would regroup it like:
| access['eshe_instructor'] and not (access['explicit_staff'] or access['forum_admin']) | |
| not access['forum_admin'] and (access['eshe_instructor'] and not access['explicit_staff']) |
because semantically it makes more sense, e.g. we always display it if user is forum_admin, and if they are an eshe_instructor we have to check if they are explicit_staff or not.
There was a problem hiding this comment.
Actually, should this section be visible if a user is a staff, but not a forum_admin?
There was a problem hiding this comment.
@Cup0fCoffee, yes, should be visible for staff, as they by default it has access to bulk enrollments / assigning course team roles.
|
👍
|
Description
Adds a new course team role,
eSHE Instructor. This role inherits allStaffpermissions, except the ability to assign course team roles and enroll / un-enroll students.The role is designed to be composable with other roles. This means that if a user has
StaffandeSHE Instructorroles, it'll have a union of permission sets of both.Here is the default Instructor Dashboard tabs available to the new role:

The
Membershiptab is hidden here. However, if a user has bothForum discussionandeSHE Instructorrole, theMembershiptab is visible, but without the students enrollment section:Testing instructions
0x29a/bb7489/eshe-instructorbranch from thegit@github.com:open-craft/edx-platform.gitrepo.course_staff@example.comandeshe_instructor@example.com. Give the formerStaffcourse team role using the Instructor Dashboard.CAN_ENROLLpermission, verify thatcourse_staff@example.comstill can enroll students (Membershiptab).eshe_instructor@example.comtheeSHE Instructorrole.eshe_instructor@example.com, verify that you have access to the Instructor Dashboard, but not to theMembershiptab.eshe_instructor@example.comtheStaffrole and verify that it has allStaffpermissions (can enroll students, and see theMembershiptab).Staffrole fromeshe_instructor@example.com, giveDiscussion Adminand verify that it can assign forum moderator roles.Forum Discussionrole fromeshe_instructor@example.com, giveData Researcherand verify that it can access theData Downloadtab.Additionally, this script can be used to test that the
CAN_ENROLLpermission works as expected: