class TenderUaBidDocumentResource(TenderBidDocumentResource): def _get_doc_view_role(self, doc): return doc.view_role() @json_view( validators=( validate_view_bid_document, validate_download_bid_document, ), permission="view_tender", ) def get(self): return super(TenderUaBidDocumentResource, self).get() @json_view( validators=( validate_file_upload, unless_allowed_by_qualification_milestone( validate_bid_document_in_tender_status, validate_bid_document_operation_in_award_status, ), validate_bid_document_operation_period, ), permission="edit_bid", ) def collection_post(self): return super(TenderUaBidDocumentResource, self).collection_post() @json_view( validators=( validate_file_update, unless_allowed_by_qualification_milestone( validate_bid_document_in_tender_status, validate_bid_document_operation_in_award_status, ), validate_bid_document_operation_period, validate_update_bid_document_confidentiality, ), permission="edit_bid", ) def put(self): return super(TenderUaBidDocumentResource, self).put() @json_view( content_type="application/json", validators=( validate_patch_document_data, unless_allowed_by_qualification_milestone( validate_bid_document_in_tender_status, validate_bid_document_operation_in_award_status, ), validate_bid_document_operation_period, validate_update_bid_document_confidentiality, ), permission="edit_bid", ) def patch(self): return super(TenderUaBidDocumentResource, self).patch()
class TenderEUBidQualificationDocumentResource(TenderEUBidFinancialDocumentResource): container = "qualificationDocuments" @json_view( validators=( validate_file_upload, validate_bid_document_operation_period, validate_bid_document_operation_in_award_status, validate_bid_document_operation_in_bid_status, unless_allowed_by_qualification_milestone( validate_add_bid_document_not_in_allowed_tender_status ), ), permission="edit_bid", ) def collection_post(self): return super(TenderEUBidFinancialDocumentResource, self).collection_post() @json_view( content_type="application/json", validators=( validate_patch_document_data, validate_bid_document_operation_period, validate_bid_document_operation_in_award_status, validate_update_bid_document_confidentiality, validate_bid_document_operation_in_bid_status, unless_allowed_by_qualification_milestone( validate_add_bid_document_not_in_allowed_tender_status ), ), permission="edit_bid", ) def patch(self): return super(TenderEUBidFinancialDocumentResource, self).patch() @json_view( validators=( validate_file_update, validate_bid_document_operation_period, validate_bid_document_operation_in_award_status, validate_update_bid_document_confidentiality, validate_bid_document_operation_in_bid_status, unless_allowed_by_qualification_milestone( validate_add_bid_document_not_in_allowed_tender_status ), ), permission="edit_bid", ) def put(self): return super(TenderEUBidFinancialDocumentResource, self).put()
class TenderUaBidDocumentResource(TenderBidDocumentResource): def _get_doc_view_role(self, doc): parent = doc.__parent__ tender = parent.__parent__ acc_token = extract_access_token(self.request) auth_user_id = self.request.authenticated_userid is_owner = auth_user_id == parent.owner and acc_token == parent.owner_token is_tender_owner = (auth_user_id == tender.owner and acc_token == tender.owner_token) if (not is_owner and not is_tender_owner and doc.confidentiality == "buyerOnly"): return "restricted_view" return "view" @json_view( validators=( validate_view_bid_document, validate_download_bid_document, ), permission="view_tender", ) def get(self): return super(TenderUaBidDocumentResource, self).get() @json_view( validators=( validate_file_upload, unless_allowed_by_qualification_milestone( validate_bid_document_in_tender_status, validate_bid_document_operation_in_award_status, ), validate_bid_document_operation_period, ), permission="edit_bid", ) def collection_post(self): return super(TenderUaBidDocumentResource, self).collection_post() @json_view( validators=( validate_file_update, unless_allowed_by_qualification_milestone( validate_bid_document_in_tender_status, validate_bid_document_operation_in_award_status, ), validate_bid_document_operation_period, validate_update_bid_document_confidentiality, ), permission="edit_bid", ) def put(self): return super(TenderUaBidDocumentResource, self).put() @json_view( content_type="application/json", validators=( validate_patch_document_data, unless_allowed_by_qualification_milestone( validate_bid_document_in_tender_status, validate_bid_document_operation_in_award_status, ), validate_bid_document_operation_period, validate_update_bid_document_confidentiality, ), permission="edit_bid", ) def patch(self): return super(TenderUaBidDocumentResource, self).patch()