EDUCATOR-3213 make Global EdX Staff able to view all forum posts

This commit is contained in:
rabiaiftikhar
2018-10-09 15:17:55 +05:00
parent 6be27ed08d
commit aac430da34
4 changed files with 23 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ from six import text_type
from openedx.core.djangoapps.xmodule_django.models import NoneToEmptyManager
from student.models import CourseEnrollment
from student.roles import GlobalStaff
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
@@ -157,6 +158,13 @@ def all_permissions_for_user_in_course(user, course_id): # pylint: disable=inva
if not permission_blacked_out(course, role_names, permission.name):
permission_names.add(permission.name)
# Prevent a circular import
from django_comment_common.utils import GLOBAL_STAFF_ROLE_PERMISSIONS
if GlobalStaff().has_user(user):
for permission in GLOBAL_STAFF_ROLE_PERMISSIONS:
permission_names.add(permission)
return permission_names