Allow override of "create" permission in API

This commit is contained in:
Lance Edgar 2021-09-03 18:26:55 -05:00
parent fa700d53ad
commit 4474f30718

View file

@ -151,7 +151,11 @@ class APIMasterView2(APIMasterView):
# create
if cls.creatable:
cls.establish_method('collection_post')
resource.add_view(cls.collection_post, permission='{}.create'.format(permission_prefix))
if hasattr(cls, 'permission_to_create'):
permission = cls.permission_to_create
else:
permission = '{}.create'.format(permission_prefix)
resource.add_view(cls.collection_post, permission=permission)
# view
if cls.viewable: