31 lines
835 B
Python
31 lines
835 B
Python
# Generated by Django 1.11.27 on 2020-01-27 19:02
|
|
|
|
|
|
from django.db import migrations
|
|
|
|
from common.djangoapps.student.models import CourseAccessRole
|
|
|
|
|
|
def add_data_researcher(apps, schema_editor):
|
|
"""
|
|
Add a `data_researcher` role for everyone who is currently `staff` or `instructor`.
|
|
"""
|
|
for role in CourseAccessRole.objects.filter(role__in=('staff', 'instructor')):
|
|
new_role, created = CourseAccessRole.objects.get_or_create(
|
|
user=role.user,
|
|
org=role.org,
|
|
course_id=role.course_id,
|
|
role='data_researcher'
|
|
)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('student', '0028_historicalmanualenrollmentaudit'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(add_data_researcher, reverse_code=migrations.RunPython.noop),
|
|
]
|