bug fixed: there is no point in having self.AUTH for view DocumentDef
This commit is contained in:
parent
994f1d0e5f
commit
cdf36583a9
|
@ -153,7 +153,6 @@ class DocumentDef(Resource):
|
||||||
__type__ = 'Document'
|
__type__ = 'Document'
|
||||||
SCHEMA = None
|
SCHEMA = None
|
||||||
VIEW = None # We do not want to create default / documents endpoint
|
VIEW = None # We do not want to create default / documents endpoint
|
||||||
AUTH = False
|
|
||||||
|
|
||||||
def __init__(self, app,
|
def __init__(self, app,
|
||||||
import_name=__name__,
|
import_name=__name__,
|
||||||
|
@ -171,18 +170,17 @@ class DocumentDef(Resource):
|
||||||
get = {'GET'}
|
get = {'GET'}
|
||||||
|
|
||||||
view = DocumentView.as_view('main', definition=self, auth=app.auth)
|
view = DocumentView.as_view('main', definition=self, auth=app.auth)
|
||||||
if self.AUTH:
|
|
||||||
view = app.auth.requires_auth(view)
|
view = app.auth.requires_auth(view)
|
||||||
self.add_url_rule('/erasures/', defaults=d, view_func=view, methods=get)
|
self.add_url_rule('/erasures/', defaults=d, view_func=view, methods=get)
|
||||||
self.add_url_rule('/erasures/<{}:{}>'.format(self.ID_CONVERTER.value, self.ID_NAME),
|
self.add_url_rule('/erasures/<{}:{}>'.format(self.ID_CONVERTER.value, self.ID_NAME),
|
||||||
view_func=view, methods=get)
|
view_func=view, methods=get)
|
||||||
devices_view = DevicesDocumentView.as_view('devicesDocumentView',
|
devices_view = DevicesDocumentView.as_view('devicesDocumentView',
|
||||||
definition=self,
|
definition=self,
|
||||||
auth=app.auth)
|
auth=app.auth)
|
||||||
|
devices_view = app.auth.requires_auth(devices_view)
|
||||||
|
|
||||||
stock_view = StockDocumentView.as_view('stockDocumentView', definition=self)
|
stock_view = StockDocumentView.as_view('stockDocumentView', definition=self)
|
||||||
|
|
||||||
if self.AUTH:
|
|
||||||
devices_view = app.auth.requires_auth(devices_view)
|
|
||||||
self.add_url_rule('/devices/', defaults=d, view_func=devices_view, methods=get)
|
self.add_url_rule('/devices/', defaults=d, view_func=devices_view, methods=get)
|
||||||
self.add_url_rule('/stock/', defaults=d, view_func=stock_view, methods=get)
|
self.add_url_rule('/stock/', defaults=d, view_func=stock_view, methods=get)
|
||||||
|
|
Reference in New Issue