Skip to content
Snippets Groups Projects
Commit 668a9adf authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Fix up mixin for API views to inherit default permissions

parent 4c6d3b21
No related branches found
No related tags found
No related merge requests found
......@@ -127,7 +127,12 @@ class InheritDefaultPermissionsMixin(object):
permission_classes = ()
def get_permissions(self):
# Cast to lists to be safe, since these might be tuples
permission_list = list(api_settings.DEFAULT_PERMISSION_CLASSES) + \
list(self.permission_classes)
# Cast default permissions to a list
permission_list = list(api_settings.DEFAULT_PERMISSION_CLASSES)
# Add any class-level permissions that aren't already included
permission_list += [p for p in self.permission_classes
if p not in permission_list]
# Return full list of instantiated permissions
return [permission() for permission in permission_list]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment