-
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
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.
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
# 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 comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, should this section be visible if a user is a staff
, but not a forum_admin
?
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.
@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 allStaff
permissions, 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
Staff
andeSHE Instructor
roles, it'll have a union of permission sets of both.Here is the default Instructor Dashboard tabs available to the new role:
The
Membership
tab is hidden here. However, if a user has bothForum discussion
andeSHE Instructor
role, theMembership
tab is visible, but without the students enrollment section:Testing instructions
0x29a/bb7489/eshe-instructor
branch from the[email protected]:open-craft/edx-platform.git
repo.[email protected]
and[email protected]
. Give the formerStaff
course team role using the Instructor Dashboard.CAN_ENROLL
permission, verify that[email protected]
still can enroll students (Membership
tab).[email protected]
theeSHE Instructor
role.[email protected]
, verify that you have access to the Instructor Dashboard, but not to theMembership
tab.[email protected]
theStaff
role and verify that it has allStaff
permissions (can enroll students, and see theMembership
tab).Staff
role from[email protected]
, giveDiscussion Admin
and verify that it can assign forum moderator roles.Forum Discussion
role from[email protected]
, giveData Researcher
and verify that it can access theData Download
tab.Additionally, this script can be used to test that the
CAN_ENROLL
permission works as expected: