EDUCATOR-3213 make Global EdX Staff able to view all forum posts
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ Common comment client utility functions.
|
||||
"""
|
||||
|
||||
from django_comment_common.models import (
|
||||
CourseDiscussionSettings,
|
||||
FORUM_ROLE_ADMINISTRATOR,
|
||||
FORUM_ROLE_COMMUNITY_TA,
|
||||
FORUM_ROLE_GROUP_MODERATOR,
|
||||
@@ -13,8 +14,6 @@ from django_comment_common.models import (
|
||||
from openedx.core.djangoapps.course_groups.cohorts import get_legacy_discussion_settings
|
||||
from openedx.core.lib.cache_utils import request_cached
|
||||
|
||||
from .models import CourseDiscussionSettings
|
||||
|
||||
|
||||
class ThreadContext(object):
|
||||
""" An enumeration that represents the context of a thread. Used primarily by the comments service. """
|
||||
@@ -34,6 +33,8 @@ GROUP_MODERATOR_ROLE_PERMISSIONS = ["group_edit_content", "group_delete_thread",
|
||||
|
||||
ADMINISTRATOR_ROLE_PERMISSIONS = ["manage_moderator"]
|
||||
|
||||
GLOBAL_STAFF_ROLE_PERMISSIONS = ["see_all_cohorts"]
|
||||
|
||||
|
||||
def _save_forum_role(course_key, name):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user