Merge pull request #805 from MITx/fix/cdodge/add-user-admin-permissions
allow 'is_staff' flagged user accounts to run as super-admin, which mean...
This commit is contained in:
@@ -87,7 +87,8 @@ def remove_user_from_course_group(caller, user, location, role):
|
||||
|
||||
def is_user_in_course_group_role(user, location, role):
|
||||
if user.is_active and user.is_authenticated:
|
||||
return user.groups.filter(name=get_course_groupname_for_role(location,role)).count() > 0
|
||||
# all "is_staff" flagged accounts belong to all groups
|
||||
return user.is_staff or user.groups.filter(name=get_course_groupname_for_role(location,role)).count() > 0
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ def index(request):
|
||||
def has_access(user, location, role=EDITOR_ROLE_NAME):
|
||||
'''Return True if user allowed to access this piece of data'''
|
||||
'''Note that the CMS permissions model is with respect to courses'''
|
||||
'''There is a super-admin permissions if user.is_staff is set'''
|
||||
return is_user_in_course_group_role(user, get_course_location_for_item(location), role)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user