Commit 3853c926 by Greg Price

Merge pull request #1850 from edx/gprice/change-staff-forum-role

Change forum role granted to staff on enrollment
parents f7d86bff 88610cb8
...@@ -11,6 +11,10 @@ Common: Switch over from MITX_FEATURES to just FEATURES. To override items in ...@@ -11,6 +11,10 @@ Common: Switch over from MITX_FEATURES to just FEATURES. To override items in
the FEATURES dict, the environment variable you must set to do so is also the FEATURES dict, the environment variable you must set to do so is also
now called FEATURES instead of MITX_FEATURES. now called FEATURES instead of MITX_FEATURES.
LMS: Change the forum role granted to global staff on enrollment in a
course. Previously, staff were given the Moderator role; now, they are
given the Student role.
Blades: Fix Numerical input to support mathematical operations. BLD-525. Blades: Fix Numerical input to support mathematical operations. BLD-525.
Blades: Improve calculator's tooltip accessibility. Add possibility to navigate Blades: Improve calculator's tooltip accessibility. Add possibility to navigate
......
...@@ -32,13 +32,8 @@ def assign_default_role(sender, instance, **kwargs): ...@@ -32,13 +32,8 @@ def assign_default_role(sender, instance, **kwargs):
# instance.user.roles.remove(*course_roles) # instance.user.roles.remove(*course_roles)
# return # return
# We've enrolled the student, so make sure they have a default role # We've enrolled the student, so make sure they have the Student role
if instance.user.is_staff: role = Role.objects.get_or_create(course_id=instance.course_id, name="Student")[0]
role = Role.objects.get_or_create(course_id=instance.course_id, name="Moderator")[0]
else:
role = Role.objects.get_or_create(course_id=instance.course_id, name="Student")[0]
logging.info("assign_default_role: adding %s as %s" % (instance.user, role))
instance.user.roles.add(role) instance.user.roles.add(role)
......
...@@ -10,6 +10,7 @@ class RoleAssignmentTest(TestCase): ...@@ -10,6 +10,7 @@ class RoleAssignmentTest(TestCase):
""" """
def setUp(self): def setUp(self):
# Check a staff account because those used to get the Moderator role
self.staff_user = User.objects.create_user( self.staff_user = User.objects.create_user(
"patty", "patty",
"patty@fake.edx.org", "patty@fake.edx.org",
...@@ -25,18 +26,13 @@ class RoleAssignmentTest(TestCase): ...@@ -25,18 +26,13 @@ class RoleAssignmentTest(TestCase):
CourseEnrollment.enroll(self.student_user, self.course_id) CourseEnrollment.enroll(self.student_user, self.course_id)
def test_enrollment_auto_role_creation(self): def test_enrollment_auto_role_creation(self):
moderator_role = Role.objects.get(
course_id=self.course_id,
name="Moderator"
)
student_role = Role.objects.get( student_role = Role.objects.get(
course_id=self.course_id, course_id=self.course_id,
name="Student" name="Student"
) )
self.assertIn(moderator_role, self.staff_user.roles.all())
self.assertIn(student_role, self.student_user.roles.all()) self.assertEqual([student_role], list(self.staff_user.roles.all()))
self.assertNotIn(moderator_role, self.student_user.roles.all()) self.assertEqual([student_role], list(self.student_user.roles.all()))
# The following was written on the assumption that unenrolling from a course # The following was written on the assumption that unenrolling from a course
# should remove all forum Roles for that student for that course. This is # should remove all forum Roles for that student for that course. This is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment