Commit 70d9721d by Calen Pennington

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...
parents f637cc57 e3d065a6
...@@ -87,7 +87,8 @@ def remove_user_from_course_group(caller, user, location, role): ...@@ -87,7 +87,8 @@ def remove_user_from_course_group(caller, user, location, role):
def is_user_in_course_group_role(user, location, role): def is_user_in_course_group_role(user, location, role):
if user.is_active and user.is_authenticated: 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 return False
......
...@@ -99,6 +99,7 @@ def index(request): ...@@ -99,6 +99,7 @@ def index(request):
def has_access(user, location, role=EDITOR_ROLE_NAME): def has_access(user, location, role=EDITOR_ROLE_NAME):
'''Return True if user allowed to access this piece of data''' '''Return True if user allowed to access this piece of data'''
'''Note that the CMS permissions model is with respect to courses''' '''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) return is_user_in_course_group_role(user, get_course_location_for_item(location), role)
......
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