Allow override of "create" permission in API
This commit is contained in:
parent
fa700d53ad
commit
4474f30718
|
@ -151,7 +151,11 @@ class APIMasterView2(APIMasterView):
|
||||||
# create
|
# create
|
||||||
if cls.creatable:
|
if cls.creatable:
|
||||||
cls.establish_method('collection_post')
|
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
|
# view
|
||||||
if cls.viewable:
|
if cls.viewable:
|
||||||
|
|
Loading…
Reference in a new issue